Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deduplicate testing dependencies by dropping [testing-integration] #4283

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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")
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions newsfragments/4282.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed the ``setuptools[testing-integration]`` in favor of ``setuptools[testing]`` -- by :user:`Avasam`
15 changes: 1 addition & 14 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pass_env =

[testenv:integration]
deps = {[testenv]deps}
extras = testing-integration
extras = {[testenv]extras}
pass_env =
{[testenv]pass_env}
DOWNLOAD_PATH
Expand Down
Loading