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 6
6
import _pytest
7
7
import pytest
8
8
9
+ pytestmark = pytest .mark .slow
10
+
9
11
MODSET = [
10
12
x
11
13
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 =
171
171
pytester_example_dir = testing/example_scripts
172
172
markers =
173
173
issue
174
+ slow
174
175
175
176
[flake8]
176
177
max-line-length = 120
You can’t perform that action at this time.
0 commit comments