FIX: Create test data in tempdir
@@ -10,7 +10,10 @@ from ..cifti import GenerateCifti, CIFTI_STRUCT_WITH_LABELS
@pytest.fixture(scope="module")
def cifti_data():
- out = Path().absolute()
+ import tempfile
+
+ with tempfile.TemporaryDirectory('cifti-data') as tmp:
+ out = Path(tmp).absolute()
volume_file = str(out / "volume.nii.gz")
left_gii = str(out / "left.gii")
right_gii = str(out / "right.gii")
@@ -22,8 +25,6 @@ def cifti_data():
gii.to_filename(left_gii)
gii.to_filename(right_gii)
yield volume_file, left_gii, right_gii
- for f in (volume_file, left_gii, right_gii):
- Path(f).unlink()
def test_GenerateCifti(tmpdir, cifti_data):
