From 3fd0dec3a124df0c95dfd5843cdafc19abed6eca Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Mon, 30 Sep 2019 19:46:58 +0100 Subject: starting to test cli now - starting with expected error from missing sheet in importable template --- datamaps/tests/conftest.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'datamaps/tests/conftest.py') 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" -- cgit v1.2.3