generated from ArcanaFramework/fileformats-extension-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
37 lines (27 loc) · 845 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
33
34
35
36
37
import os
import logging
from pathlib import Path
import tempfile
import pytest
# 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)