aboutsummaryrefslogtreecommitdiffstats
path: root/datamaps/tests/conftest.py
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2019-10-02 08:26:00 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2019-10-02 08:26:00 +0100
commit9a387339e1933cb7255b8dd1c8175a42be19b24d (patch)
tree679f696e0ad2fac0c91f94cc7692a78e3df96adc /datamaps/tests/conftest.py
parenta15fd3fe7bead9599fbfe49d8b81ab227fd55259 (diff)
parent240e9d6dbb8b1e26c50889e3f91765f943b78740 (diff)
Merge branch 'master' of github.com:hammerheadlemon/datamaps
Diffstat (limited to 'datamaps/tests/conftest.py')
-rw-r--r--datamaps/tests/conftest.py30
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"