File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import pytest
2+ from packaging .version import Version
3+
14try :
25 from mp_api .client .contribs import ContribsClient
36except ImportError :
47 ContribsClient = None
58
69
7- def pytest_ignore_collect (path , config ):
8- # Skip tests if contribs client isn't installed
9- if ContribsClient is None and "contribs" in str (path ):
10- return True
11- return False
10+ _pytest_version = Version (pytest .__version__ )
11+ PYTEST_GE_8_0 = any (
12+ [
13+ _pytest_version .is_devrelease ,
14+ _pytest_version .is_prerelease ,
15+ _pytest_version >= Version ("8.0" ),
16+ ]
17+ )
18+
19+
20+ if PYTEST_GE_8_0 :
21+
22+ def pytest_ignore_collect (collection_path , config ):
23+ # Skip tests if contribs client isn't installed
24+ if ContribsClient is None and "contribs" in str (collection_path ):
25+ return True
26+ return False
27+
28+ else :
29+
30+ def pytest_ignore_collect (path , config ):
31+ # Skip tests if contribs client isn't installed
32+ if ContribsClient is None and "contribs" in str (path ):
33+ return True
34+ return False
You can’t perform that action at this time.
0 commit comments