Skip to content

Commit b3dd42b

Browse files
committed
test: Use acres loader for interfaces.tests.data
1 parent 65cfabc commit b3dd42b

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

fmriprep/interfaces/conftest.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
from pathlib import Path
21
from shutil import copytree
32

43
import pytest
54

5+
from .tests.data import load
6+
67
try:
78
from contextlib import chdir as _chdir
89
except ImportError: # PY310
@@ -19,17 +20,19 @@ def _chdir(path):
1920
os.chdir(cwd)
2021

2122

22-
@pytest.fixture(scope='module')
23+
@pytest.fixture
2324
def data_dir():
24-
return Path(__file__).parent / 'tests' / 'data'
25+
with load.as_path() as data_dir:
26+
yield data_dir
2527

2628

2729
@pytest.fixture(autouse=True)
2830
def _docdir(request, tmp_path):
2931
# Trigger ONLY for the doctests.
3032
doctest_plugin = request.config.pluginmanager.getplugin('doctest')
3133
if isinstance(request.node, doctest_plugin.DoctestItem):
32-
copytree(Path(__file__).parent / 'tests' / 'data', tmp_path, dirs_exist_ok=True)
34+
with load.as_path() as data_dir:
35+
copytree(data_dir, tmp_path, dirs_exist_ok=True)
3336

3437
# Chdir only for the duration of the test.
3538
with _chdir(tmp_path):
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from acres import Loader
2+
3+
load = Loader(__spec__.name)

0 commit comments

Comments
 (0)