diff options
Diffstat (limited to 'datamaps/tests/conftest.py')
-rw-r--r-- | datamaps/tests/conftest.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/datamaps/tests/conftest.py b/datamaps/tests/conftest.py index 22f20bf..1e9bf07 100644 --- a/datamaps/tests/conftest.py +++ b/datamaps/tests/conftest.py @@ -1,9 +1,39 @@ import os +import shutil import pytest from pathlib import Path +from engine.config import Config @pytest.fixture def master() -> Path: return Path.cwd() / "tests" / "resources" / "master.xlsx" + + +@pytest.fixture +def mock_config(monkeypatch): + monkeypatch.setattr(Config, "PLATFORM_DOCS_DIR", Path("/tmp/Documents/datamaps")) + monkeypatch.setattr( + Config, "DATAMAPS_LIBRARY_DATA_DIR", Path("/tmp/.local/share/datamaps-data") + ) + monkeypatch.setattr( + Config, "DATAMAPS_LIBRARY_CONFIG_DIR", Path("/tmp/.config/datamaps-data") + ) + monkeypatch.setattr( + Config, + "DATAMAPS_LIBRARY_CONFIG_FILE", + Path("/tmp/.config/datamaps-data/config.ini"), + ) + yield Config + try: + shutil.rmtree(Config.DATAMAPS_LIBRARY_DATA_DIR) + shutil.rmtree(Config.DATAMAPS_LIBRARY_CONFIG_DIR) + shutil.rmtree(Config.PLATFORM_DOCS_DIR) + except FileNotFoundError: + pass + + +@pytest.fixture +def resource_dir(): + return Path.cwd() / "tests" / "resources" |