From 5e0c44b65e070c23be2a9480b61a51307944a207 Mon Sep 17 00:00:00 2001 From: Stefan Zabka Date: Thu, 19 Jan 2023 07:24:52 +0100 Subject: [PATCH] Unify tool configuration in pyproject.toml (#1028) * refactor(pytest): use pyproject.toml instead of pytest.ini * refactor(isort): use pyproject.toml instead of setup.cfg * refactor(mypy): use pyproject.toml instead of setup.cfg * fix(coverage): make coverage consider multiprocess this should increase the code coverage from our tests * fix(coverage): specify concurrency as an array --- pyproject.toml | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ pytest.ini | 7 ------- setup.cfg | 31 ---------------------------- 3 files changed, 55 insertions(+), 38 deletions(-) create mode 100644 pyproject.toml delete mode 100644 pytest.ini delete mode 100644 setup.cfg diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..5585cc6e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,55 @@ +[tool.pytest.ini_options] +python_files = "test_*.py" +testpaths = "test" +addopts = "--strict-markers" + +markers = [ + "pyonly: marks a test as being python only and so server and xpi not needed", + "slow: marks a test as slow (omit slow tests with '-m \"not slow\"')", +] + +[tool.isort] +profile = "black" +known_future_library = "future" +known_first_party = ["openwpm", "openwpmtest", "test"] +default_section = "THIRDPARTY" +skip = ["venv", "Extension", "firefox-bin"] + +[tool.mypy] +follow_imports = "silent" +python_version = 3.10 +warn_unused_configs = true +ignore_missing_imports = true +disallow_incomplete_defs = true +disallow_untyped_defs = true + +[[tool.mypy.overrides]] +module = "openwpm.storage.*" +disallow_incomplete_defs = true +disallow_untyped_defs = true + +[[tool.mypy.overrides]] +module = "openwpm.*" +disallow_untyped_defs = false + +[[tool.mypy.overrides]] +module = [ + "openwpm.utilities.*", + "openwpm.mp_logger", + "openwpm.commands.browser_commands", +] +disallow_incomplete_defs = false + +[[tool.mypy.overrides]] +module = "openwpm.browser_manager" +allow_redefinition = true +disallow_incomplete_defs = false + +[[tool.mypy.overrides]] +module = "test.*" +allow_untyped_defs = true + +[tool.coverage.run] +concurrency = ["multiprocessing"] +parallel = true +sigterm = true \ No newline at end of file diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 0ee2310c..00000000 --- a/pytest.ini +++ /dev/null @@ -1,7 +0,0 @@ -[pytest] -python_files=test_*.py -testpaths=test - -markers = - pyonly: marks a test as being python only and so server and xpi not needed - slow: marks a test as slow (omit slow tests with '-m "not slow"') diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index cf6e9de4..00000000 --- a/setup.cfg +++ /dev/null @@ -1,31 +0,0 @@ -[tool:isort] -profile = black -known_future_library = future -known_first_party = openwpm,openwpmtest,test -default_section = THIRDPARTY -skip = venv,Extension,firefox-bin - -[mypy] -follow_imports = silent -python_version = 3.10 -warn_unused_configs = True -ignore_missing_imports = True -disallow_incomplete_defs = True -disallow_untyped_defs = True - -[mypy-openwpm.storage.*] -disallow_incomplete_defs = True -disallow_untyped_defs = True - -[mypy-openwpm.*] -disallow_untyped_defs = False - -[mypy-openwpm.utilities.*,openwpm.mp_logger,openwpm.commands.browser_commands] -disallow_incomplete_defs = False - -[mypy-openwpm.browser_manager] -allow_redefinition = True -disallow_incomplete_defs = False - -[mypy-test.*] -allow_untyped_defs = True \ No newline at end of file