Skip to content

Commit 2d25aa2

Browse files
authored
Merge pull request #4283 from Avasam/deduplicate-testing-dependencies-by-dropping-testing-integration
Deduplicate testing dependencies by dropping `[testing-integration]`
2 parents 48eb575 + 6c118be commit 2d25aa2

File tree

5 files changed

+27
-22
lines changed

5 files changed

+27
-22
lines changed

conftest.py

+23-6
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def pytest_addoption(parser):
2424
def pytest_configure(config):
2525
config.addinivalue_line("markers", "integration: integration tests")
2626
config.addinivalue_line("markers", "uses_network: tests may try to download files")
27+
_IntegrationTestSpeedups.disable_plugins_already_run(config)
2728

2829

2930
collect_ignore = [
@@ -47,9 +48,25 @@ def pytest_configure(config):
4748

4849
@pytest.fixture(autouse=True)
4950
def _skip_integration(request):
50-
running_integration_tests = request.config.getoption("--integration")
51-
is_integration_test = request.node.get_closest_marker("integration")
52-
if running_integration_tests and not is_integration_test:
53-
pytest.skip("running integration tests only")
54-
if not running_integration_tests and is_integration_test:
55-
pytest.skip("skipping integration tests")
51+
_IntegrationTestSpeedups.conditional_skip(request)
52+
53+
54+
class _IntegrationTestSpeedups:
55+
"""Speed-up integration tests by only running what does not run in other tests."""
56+
57+
RUNS_ON_NORMAL_TESTS = ("checkdocks", "cov", "mypy", "perf", "ruff")
58+
59+
@classmethod
60+
def disable_plugins_already_run(cls, config):
61+
if config.getoption("--integration"):
62+
for plugin in cls.RUNS_ON_NORMAL_TESTS: # no need to run again
63+
config.pluginmanager.set_blocked(plugin)
64+
65+
@staticmethod
66+
def conditional_skip(request):
67+
running_integration_tests = request.config.getoption("--integration")
68+
is_integration_test = request.node.get_closest_marker("integration")
69+
if running_integration_tests and not is_integration_test:
70+
pytest.skip("running integration tests only")
71+
if not running_integration_tests and is_integration_test:
72+
pytest.skip("skipping integration tests")

mypy.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ ignore_missing_imports = True
3232
# - pkg_resources tests create modules that won't exists statically before the test is run.
3333
# Let's ignore all "import-not-found" since, if an import really wasn't found, then the test would fail.
3434
# - setuptools._vendor.packaging._manylinux: Mypy issue, this vendored module is already excluded!
35-
[mypy-pkg_resources.tests.*,setuptools._vendor.packaging._manylinux]
35+
[mypy-pkg_resources.tests.*,setuptools._vendor.packaging._manylinux,setuptools.config._validate_pyproject.*]
3636
disable_error_code = import-not-found

newsfragments/4282.misc.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Removed the ``setuptools[testing-integration]`` in favor of ``setuptools[testing]`` -- by :user:`Avasam`

setup.cfg

+1-14
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ testing =
6060
jaraco.envs>=2.2
6161
pytest-xdist>=3 # Dropped dependency on pytest-fork and py
6262
jaraco.path>=3.2.0
63-
build[virtualenv]
63+
build[virtualenv]>=1.0.3
6464
filelock>=3.4.0
6565
ini2toml[lite]>=0.9
6666
tomli-w>=1.0.0
@@ -77,19 +77,6 @@ testing =
7777
# No Python 3.12 dependencies require importlib_metadata, but needed for type-checking since we import it directly
7878
importlib_metadata
7979

80-
testing-integration =
81-
pytest
82-
pytest-xdist
83-
pytest-enabler
84-
virtualenv>=13.0.0
85-
tomli
86-
wheel
87-
jaraco.path>=3.2.0
88-
jaraco.envs>=2.2
89-
build[virtualenv]>=1.0.3
90-
filelock>=3.4.0
91-
packaging>=23.2
92-
9380
docs =
9481
# upstream
9582
sphinx >= 3.5

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pass_env =
2323

2424
[testenv:integration]
2525
deps = {[testenv]deps}
26-
extras = testing-integration
26+
extras = {[testenv]extras}
2727
pass_env =
2828
{[testenv]pass_env}
2929
DOWNLOAD_PATH

0 commit comments

Comments
 (0)