Revision 496d90f7
Added by koszko over 1 year ago
conftest.py | ||
---|---|---|
9 | 9 |
|
10 | 10 |
import pytest |
11 | 11 |
import pkgutil |
12 |
from tempfile import TemporaryDirectory |
|
13 |
from typing import Iterable |
|
12 | 14 |
|
13 | 15 |
here = Path(__file__).resolve().parent |
14 | 16 |
sys.path.insert(0, str(here / 'src')) |
... | ... | |
67 | 69 |
for module in modules_to_process: |
68 | 70 |
if hasattr(module, '_'): |
69 | 71 |
monkeypatch.setattr(module, '_', lambda message: message) |
72 |
|
|
73 |
@pytest.fixture |
|
74 |
def tmpdir() -> Iterable[Path]: |
|
75 |
""" |
|
76 |
Provide test case with a temporary directory that will be automatically |
|
77 |
deleted after the test. |
|
78 |
""" |
|
79 |
with TemporaryDirectory() as tmpdir: |
|
80 |
yield Path(tmpdir) |
Also available in: Unified diff
make it easier to reuse/cache foreign package files when building a Hydrilla source package multiple times