3838################################################################################
3939SLOW_TEST = 'scanslow'
4040VALIDATION_TEST = 'scanvalidate'
41+ PLUGINS_TEST = 'scanplugins'
4142
4243
4344def pytest_configure (config ):
@@ -53,8 +54,14 @@ def pytest_configure(config):
5354 ': Mark a ScanCode test as a validation test, super slow, long running test.' ,
5455 )
5556
57+ config .addinivalue_line (
58+ 'markers' ,
59+ PLUGINS_TEST +
60+ ': Mark a ScanCode test as a special CI test to tests installing additional plugins.' ,
61+ )
62+
5663
57- TEST_SUITES = 'standard' , 'all' , 'validate'
64+ TEST_SUITES = ( 'standard' , 'all' , 'validate' , 'plugins' ,)
5865
5966
6067def pytest_addoption (parser ):
@@ -72,9 +79,11 @@ def pytest_addoption(parser):
7279 help = 'Select which test suite to run: '
7380 '"standard" runs the standard test suite designed to run reasonably fast. '
7481 '"all" runs "standard" and "slow" (long running) tests. '
75- '"validate" runs all the tests. '
82+ '"validate" runs all the tests, except the "plugins" tests. '
83+ '"plugins" runs special plugins tests. Needs extra setup, and is used only in the CI. '
7684 'Use the @pytest.mark.scanslow marker to mark a test as "slow" test. '
7785 'Use the @pytest.mark.scanvalidate marker to mark a test as a "validate" test.'
86+ 'Use the @pytest.mark.scanplugins marker to mark a test as a "plugins" test.'
7887 )
7988
8089################################################################################
@@ -87,13 +96,19 @@ def pytest_collection_modifyitems(config, items):
8796 test_suite = config .getvalue ('test_suite' )
8897 run_everything = test_suite == 'validate'
8998 run_slow_test = test_suite in ('all' , 'validate' )
99+ run_only_plugins = test_suite == 'plugins'
90100
91101 tests_to_run = []
92102 tests_to_skip = []
93103
94104 for item in items :
95105 is_validate = bool (item .get_closest_marker (VALIDATION_TEST ))
96106 is_slow = bool (item .get_closest_marker (SLOW_TEST ))
107+ is_plugins = bool (item .get_closest_marker (PLUGINS_TEST ))
108+
109+ if is_plugins and not run_only_plugins :
110+ tests_to_skip .append (item )
111+ continue
97112
98113 if is_validate and not run_everything :
99114 tests_to_skip .append (item )
0 commit comments