generated from nipype/pydra-tasks-template
-
Notifications
You must be signed in to change notification settings - Fork 5
/
conftest.py
32 lines (25 loc) · 940 Bytes
/
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
import os
import typing as ty
import pytest
from pathlib import Path
os.environ["PATH"] = (
str(Path(__file__).parent.parent.parent / "bin") + ":" + os.environ["PATH"]
)
os.environ["MRTRIX_CLI_PARSE_ONLY"] = "0"
@pytest.fixture
def cli_parse_only():
os.environ["MRTRIX_CLI_PARSE_ONLY"] = "1"
# You can set more environment variables here if needed
yield
# Clean up or reset environment variables if necessary
del os.environ["MRTRIX_CLI_PARSE_ONLY"]
# 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: pytest.CallInfo[ty.Any]) -> None:
if call.excinfo is not None:
raise call.excinfo.value
@pytest.hookimpl(tryfirst=True)
def pytest_internalerror(excinfo: pytest.ExceptionInfo[BaseException]) -> None:
raise excinfo.value