-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
66 lines (44 loc) · 1.6 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import os
import logging
from pathlib import Path
import tempfile
import pytest
from fileformats.medimage.dicom import DicomDir
# Set DEBUG logging for unittests
log_level = logging.WARNING
logger = logging.getLogger("fileformats")
logger.setLevel(log_level)
sch = logging.StreamHandler()
sch.setLevel(log_level)
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
sch.setFormatter(formatter)
logger.addHandler(sch)
# For debugging in IDE's don't catch raised exceptions and let the IDE
# break at it
if os.getenv("_PYTEST_RAISE", "0") != "0":
@pytest.hookimpl(tryfirst=True)
def pytest_exception_interact(call):
raise call.excinfo.value
@pytest.hookimpl(tryfirst=True)
def pytest_internalerror(excinfo):
raise excinfo.value
@pytest.fixture
def work_dir():
work_dir = tempfile.mkdtemp()
return Path(work_dir)
@pytest.fixture(scope="session")
def dummy_t1w_dicom():
import medimages4tests.dummy.dicom.mri.t1w.siemens.skyra.syngo_d13c as module
return DicomDir(module.get_image())
@pytest.fixture(scope="session")
def dummy_magfmap_dicom():
import medimages4tests.dummy.dicom.mri.fmap.siemens.skyra.syngo_d13c as module
return DicomDir(module.get_image())
@pytest.fixture(scope="session")
def dummy_dwi_dicom():
import medimages4tests.dummy.dicom.mri.dwi.siemens.skyra.syngo_d13c as module
return DicomDir(module.get_image())
@pytest.fixture(scope="session")
def dummy_mixedfmap_dicom():
import medimages4tests.dummy.dicom.mri.fmap.ge.discovery_mr888.dv26_0_r05_2008a as module
return DicomDir(module.get_image())