Skip to content

Commit cfda42e

Browse files
committed
TEST: Add fixtures for testing interfaces with doctests
1 parent e78aa4b commit cfda42e

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

nibabies/interfaces/conftest.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""py.test configuration"""
2+
from pathlib import Path
3+
import pytest
4+
from tempfile import TemporaryDirectory
5+
6+
7+
FILES = (
8+
'functional.nii',
9+
'anatomical.nii',
10+
'epi.nii',
11+
'T1w.nii',
12+
'func_to_struct.mat',
13+
'sub-01_run-01_echo-1_bold.nii.gz',
14+
'sub-01_run-01_echo-2_bold.nii.gz',
15+
'sub-01_run-01_echo-3_bold.nii.gz',
16+
)
17+
18+
19+
@pytest.fixture(scope="package")
20+
def data_dir():
21+
with TemporaryDirectory() as tmpdir:
22+
tmp_path = Path(tmpdir)
23+
for fname in FILES:
24+
Path.touch(tmp_path / fname)
25+
yield tmp_path
26+
27+
28+
@pytest.fixture(autouse=True)
29+
def set_namespace(doctest_namespace, data_dir):
30+
doctest_namespace["data_dir"] = data_dir

0 commit comments

Comments
 (0)