@@ -24,6 +24,7 @@ def pytest_addoption(parser):
24
24
def pytest_configure (config ):
25
25
config .addinivalue_line ("markers" , "integration: integration tests" )
26
26
config .addinivalue_line ("markers" , "uses_network: tests may try to download files" )
27
+ _IntegrationTestSpeedups .disable_plugins_already_run (config )
27
28
28
29
29
30
collect_ignore = [
@@ -47,9 +48,25 @@ def pytest_configure(config):
47
48
48
49
@pytest .fixture (autouse = True )
49
50
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" )
0 commit comments