File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 5
5
import numpy as np
6
6
import nibabel as nb
7
7
import pytest
8
+ from bids .layout import BIDSLayout
8
9
from dipy .data .fetcher import _make_fetcher , UW_RW_URL
9
10
10
11
_dipy_datadir_root = os .getenv ('DMRIPREP_TESTS_DATA' ) or Path .home ()
28
29
'bvals' : np .loadtxt (dipy_datadir / "HARDI193.bval" ),
29
30
}
30
31
32
+ test_data_env = os .getenv ('TEST_DATA_HOME' , '/tmp/data' )
33
+ test_output_dir = os .getenv ('TEST_OUTPUT_DIR' )
34
+ test_workdir = os .getenv ('TEST_WORK_DIR' )
35
+
36
+ layouts = {p .name : BIDSLayout (str (p ), validate = False , derivatives = True )
37
+ for p in Path (test_data_env ).glob ('*' ) if p .is_dir ()}
38
+
39
+
40
+ def pytest_report_header (config ):
41
+ msg = "Datasets found: %s" % ', ' .join ([v .root for v in layouts .values ()])
42
+ if test_output_dir is not None :
43
+ msg += '\n Output folder: %s' % Path (test_output_dir ).resolve ()
44
+ return msg
45
+
31
46
32
47
@pytest .fixture (autouse = True )
33
48
def doctest_autoimport (doctest_namespace ):
@@ -48,3 +63,18 @@ def doctest_autoimport(doctest_namespace):
48
63
def dipy_test_data (scope = 'session' ):
49
64
"""Create a temporal directory shared across tests to pull data in."""
50
65
return _sherbrooke_data
66
+
67
+
68
+ @pytest .fixture
69
+ def workdir ():
70
+ return None if test_workdir is None else Path (test_workdir )
71
+
72
+
73
+ @pytest .fixture
74
+ def output_path ():
75
+ return None if test_output_dir is None else Path (test_output_dir )
76
+
77
+
78
+ @pytest .fixture
79
+ def bids_layouts ():
80
+ return layouts
You can’t perform that action at this time.
0 commit comments