blob: 4faed8c70d315ca790b96078c21e548e24b863e2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
import os
import shutil
import tempfile
from pathlib import Path
import pytest
from engine.config import Config
@pytest.fixture
def master() -> Path:
return Path.cwd() / "datamaps" / "tests" / "resources" / "master.xlsx"
@pytest.fixture
def temp_input_dir() -> Path:
pth = tempfile.mkdtemp()
yield pth
@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() / "datamaps" / "tests" / "resources"
|