Skip to content

Commit 81ed771

Browse files
committed
FIX: Avoid importing __future__ features during test collection
1 parent 27136a4 commit 81ed771

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

nibabel/__future__/conftest.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import pytest
2+
from packaging.version import Version
3+
from . import future_flags
4+
5+
if Version(pytest.__version__) >= Version("7"):
6+
def pytest_ignore_collect(collection_path):
7+
if collection_path.name == "example_feature.py":
8+
return True
9+
if collection_path.stem in future_flags:
10+
return True
11+
else:
12+
def pytest_ignore_collect(path):
13+
if path.basename == "example_feature.py":
14+
return True
15+
if path.basename[:-3] in future_flags:
16+
return True

0 commit comments

Comments
 (0)