summaryrefslogtreecommitdiff
path: root/conftest.py
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-05-11 12:33:31 +0200
committerWojtek Kosior <koszko@koszko.org>2022-05-11 12:33:31 +0200
commit496d90f70a58c0040f8493aa8a5e4e2f106bfac7 (patch)
treeaf6ace104ad9a02f2fb15820dd6ea3469d4577d5 /conftest.py
parent9e2cd3a25b6ff5addd7109414fdf5a535b9cbce3 (diff)
downloadhydrilla-builder-496d90f70a58c0040f8493aa8a5e4e2f106bfac7.tar.gz
hydrilla-builder-496d90f70a58c0040f8493aa8a5e4e2f106bfac7.zip
make it easier to reuse/cache foreign package files when building a Hydrilla source package multiple times
Diffstat (limited to 'conftest.py')
-rw-r--r--conftest.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/conftest.py b/conftest.py
index 65d13d5..e41a61d 100644
--- a/conftest.py
+++ b/conftest.py
@@ -9,6 +9,8 @@ from pathlib import Path
import pytest
import pkgutil
+from tempfile import TemporaryDirectory
+from typing import Iterable
here = Path(__file__).resolve().parent
sys.path.insert(0, str(here / 'src'))
@@ -67,3 +69,12 @@ def no_gettext(monkeypatch, request):
for module in modules_to_process:
if hasattr(module, '_'):
monkeypatch.setattr(module, '_', lambda message: message)
+
+@pytest.fixture
+def tmpdir() -> Iterable[Path]:
+ """
+ Provide test case with a temporary directory that will be automatically
+ deleted after the test.
+ """
+ with TemporaryDirectory() as tmpdir:
+ yield Path(tmpdir)