aboutsummaryrefslogtreecommitdiffstats
path: root/datamaps/tests/conftest.py
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2019-09-30 19:46:58 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2019-09-30 19:46:58 +0100
commit3fd0dec3a124df0c95dfd5843cdafc19abed6eca (patch)
tree6257d975658c2496b04c125ae64a14b8a092dd5d /datamaps/tests/conftest.py
parent24240cdf548e4c047e81a0c8c4be0268c9fe044a (diff)
starting to test cli now - starting with expected error from missing sheet in importable template
Diffstat (limited to '')
-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"