File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,3 +119,27 @@ def mplcleanup():
119119 mpl .units .registry .clear ()
120120 mpl .units .registry .update (save )
121121 mpl .pyplot .close ("all" )
122+
123+
124+ #
125+ # Functionality to skip slow tests using --skipslow
126+ #
127+ # See https://docs.pytest.org/en/latest/example/simple.html
128+ # #control-skipping-of-tests-according-to-command-line-option
129+ #
130+ def pytest_addoption (parser ):
131+ parser .addoption (
132+ "--skipslow" , action = "store_true" , default = False ,
133+ help = "skip slow tests" )
134+
135+
136+ def pytest_configure (config ):
137+ config .addinivalue_line ("markers" , "slow: mark test as slow to run" )
138+
139+
140+ def pytest_collection_modifyitems (config , items ):
141+ if config .getoption ("--skipslow" ):
142+ skip_slow = pytest .mark .skip (reason = "skipping slow tests" )
143+ for item in items :
144+ if "slow" in item .keywords :
145+ item .add_marker (skip_slow )
You can’t perform that action at this time.
0 commit comments