MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / pytest_collection_modifyitems

Function pytest_collection_modifyitems

conftest.py:95–127  ·  view source on GitHub ↗
(config, items)

Source from the content-addressed store, hash-verified

93
94@pytest.mark.trylast
95def pytest_collection_modifyitems(config, items):
96 test_suite = config.getvalue('test_suite')
97 run_everything = test_suite == 'validate'
98 run_slow_test = test_suite in ('all', 'validate')
99 run_only_plugins = test_suite == 'plugins'
100
101 tests_to_run = []
102 tests_to_skip = []
103
104 for item in items:
105 is_validate = bool(item.get_closest_marker(VALIDATION_TEST))
106 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
112
113 if is_validate and not run_everything:
114 tests_to_skip.append(item)
115 continue
116
117 if is_slow and not run_slow_test:
118 tests_to_skip.append(item)
119 continue
120
121 tests_to_run.append(item)
122
123 print()
124 print('{} tests selected, {} tests skipped.'.format(len(tests_to_run), len(tests_to_skip)))
125
126 items[:] = tests_to_run
127 config.hook.pytest_deselected(items=tests_to_skip)

Callers

nothing calls this directly

Calls 3

boolFunction · 0.85
appendMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected