From 9698925c4f6d5cf59d182dcc73682a07cb16b924 Mon Sep 17 00:00:00 2001 From: Avasam Date: Sat, 16 Mar 2024 12:16:34 -0400 Subject: [PATCH 1/4] Deduplicate testing dependencies by dropping testing-integration --- newsfragments/4282.misc.rst | 1 + setup.cfg | 15 +-------------- tox.ini | 2 +- 3 files changed, 3 insertions(+), 15 deletions(-) create mode 100644 newsfragments/4282.misc.rst diff --git a/newsfragments/4282.misc.rst b/newsfragments/4282.misc.rst new file mode 100644 index 0000000000..841d1b292c --- /dev/null +++ b/newsfragments/4282.misc.rst @@ -0,0 +1 @@ +Removed the ``setuptools[testing-integration]`` in favor of ``setuptools[testing]`` -- by :user:`Avasam` diff --git a/setup.cfg b/setup.cfg index f7479e047f..214964fa98 100644 --- a/setup.cfg +++ b/setup.cfg @@ -60,7 +60,7 @@ testing = jaraco.envs>=2.2 pytest-xdist>=3 # Dropped dependency on pytest-fork and py jaraco.path>=3.2.0 - build[virtualenv] + build[virtualenv]>=1.0.3 filelock>=3.4.0 ini2toml[lite]>=0.9 tomli-w>=1.0.0 @@ -77,19 +77,6 @@ testing = # No Python 3.12 dependencies require importlib_metadata, but needed for type-checking since we import it directly importlib_metadata -testing-integration = - pytest - pytest-xdist - pytest-enabler - virtualenv>=13.0.0 - tomli - wheel - jaraco.path>=3.2.0 - jaraco.envs>=2.2 - build[virtualenv]>=1.0.3 - filelock>=3.4.0 - packaging>=23.2 - docs = # upstream sphinx >= 3.5 diff --git a/tox.ini b/tox.ini index 8815a697ab..fa4864f27b 100644 --- a/tox.ini +++ b/tox.ini @@ -23,7 +23,7 @@ pass_env = [testenv:integration] deps = {[testenv]deps} -extras = testing-integration +extras = testing pass_env = {[testenv]pass_env} DOWNLOAD_PATH From 3b6781d1d980d7ce16caacf3310c9f418b1feb56 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Wed, 20 Mar 2024 15:40:32 +0000 Subject: [PATCH 2/4] Update tox.ini --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index fa4864f27b..7412730008 100644 --- a/tox.ini +++ b/tox.ini @@ -23,7 +23,7 @@ pass_env = [testenv:integration] deps = {[testenv]deps} -extras = testing +extras = {[testenv]extras} pass_env = {[testenv]pass_env} DOWNLOAD_PATH From 3ca45b7374ca8262b71e8197aba28f5580ab9550 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Wed, 20 Mar 2024 09:19:25 -0700 Subject: [PATCH 3/4] Ignore 'import-not-found' for _validate_pyproject --- mypy.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy.ini b/mypy.ini index ee12ebb193..45671826b1 100644 --- a/mypy.ini +++ b/mypy.ini @@ -32,5 +32,5 @@ ignore_missing_imports = True # - pkg_resources tests create modules that won't exists statically before the test is run. # Let's ignore all "import-not-found" since, if an import really wasn't found, then the test would fail. # - setuptools._vendor.packaging._manylinux: Mypy issue, this vendored module is already excluded! -[mypy-pkg_resources.tests.*,setuptools._vendor.packaging._manylinux] +[mypy-pkg_resources.tests.*,setuptools._vendor.packaging._manylinux,setuptools.config._validate_pyproject.*] disable_error_code = import-not-found From 6c118beac827d233e0d5af76a1555092f631ce70 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Tue, 16 Apr 2024 12:02:47 +0100 Subject: [PATCH 4/4] Disable plugins that already run on normal tests when running integration --- conftest.py | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/conftest.py b/conftest.py index 90b653146f..328d45d351 100644 --- a/conftest.py +++ b/conftest.py @@ -24,6 +24,7 @@ def pytest_addoption(parser): def pytest_configure(config): config.addinivalue_line("markers", "integration: integration tests") config.addinivalue_line("markers", "uses_network: tests may try to download files") + _IntegrationTestSpeedups.disable_plugins_already_run(config) collect_ignore = [ @@ -47,9 +48,25 @@ def pytest_configure(config): @pytest.fixture(autouse=True) def _skip_integration(request): - running_integration_tests = request.config.getoption("--integration") - is_integration_test = request.node.get_closest_marker("integration") - if running_integration_tests and not is_integration_test: - pytest.skip("running integration tests only") - if not running_integration_tests and is_integration_test: - pytest.skip("skipping integration tests") + _IntegrationTestSpeedups.conditional_skip(request) + + +class _IntegrationTestSpeedups: + """Speed-up integration tests by only running what does not run in other tests.""" + + RUNS_ON_NORMAL_TESTS = ("checkdocks", "cov", "mypy", "perf", "ruff") + + @classmethod + def disable_plugins_already_run(cls, config): + if config.getoption("--integration"): + for plugin in cls.RUNS_ON_NORMAL_TESTS: # no need to run again + config.pluginmanager.set_blocked(plugin) + + @staticmethod + def conditional_skip(request): + running_integration_tests = request.config.getoption("--integration") + is_integration_test = request.node.get_closest_marker("integration") + if running_integration_tests and not is_integration_test: + pytest.skip("running integration tests only") + if not running_integration_tests and is_integration_test: + pytest.skip("skipping integration tests")