Browse Source

refactor tests: shared SUBJECTS_DIR across test modules

Fabian Peter Hammerle 5 years ago
parent
commit
c9f4d33298
3 changed files with 6 additions and 2 deletions
  1. 4 0
      tests/conftest.py
  2. 1 1
      tests/freesurfer_test.py
  3. 1 1
      tests/hippocampus_test.py

+ 4 - 0
tests/conftest.py

@@ -1,6 +1,10 @@
+import os
+
 import pandas
 import pytest
 
+SUBJECTS_DIR = os.path.join(os.path.dirname(__file__), 'subjects')
+
 
 def _assert_volume_frames_equal(left: pandas.DataFrame, right: pandas.DataFrame):
     sort_by = ['volume_mm^3', 'analysis_id']

+ 1 - 1
tests/freesurfer_test.py

@@ -7,7 +7,7 @@ import pytest
 
 from freesurfer_volume_reader.freesurfer import HippocampalSubfieldsVolumeFile
 
-SUBJECTS_DIR = os.path.join(os.path.dirname(__file__), 'subjects')
+from conftest import SUBJECTS_DIR
 
 
 @pytest.mark.parametrize(('volume_file_path', 'expected_attrs'), [

+ 1 - 1
tests/hippocampus_test.py

@@ -10,7 +10,7 @@ import pytest
 import freesurfer_volume_reader
 import freesurfer_volume_reader.freesurfer
 
-SUBJECTS_DIR = os.path.join(os.path.dirname(__file__), 'subjects')
+from conftest import SUBJECTS_DIR
 
 
 @pytest.mark.parametrize(('source_pattern', 'expected_pattern'), [