File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ def pytest_collection_modifyitems (config , items ):
2+ """Prefer faster tests."""
3+ fast_items = []
4+ slow_items = []
5+ neutral_items = []
6+
7+ slow_fixturenames = ("testdir" ,)
8+
9+ for item in items :
10+ try :
11+ fixtures = item .fixturenames
12+ except AttributeError :
13+ # doctest at least
14+ # (https://github.com/pytest-dev/pytest/issues/5070)
15+ neutral_items .append (item )
16+ else :
17+ if any (x for x in fixtures if x in slow_fixturenames ):
18+ slow_items .append (item )
19+ else :
20+ marker = item .get_closest_marker ("slow" )
21+ if marker :
22+ slow_items .append (item )
23+ else :
24+ fast_items .append (item )
25+
26+ items [:] = fast_items + neutral_items + slow_items
Original file line number Diff line number Diff line change 66import _pytest
77import pytest
88
9+ pytestmark = pytest .mark .slow
10+
911MODSET = [
1012 x
1113 for x in py .path .local (_pytest .__file__ ).dirpath ().visit ("*.py" )
Original file line number Diff line number Diff line change @@ -171,6 +171,7 @@ filterwarnings =
171171pytester_example_dir = testing/example_scripts
172172markers =
173173 issue
174+ slow
174175
175176[flake8]
176177max-line-length = 120
You can’t perform that action at this time.
0 commit comments