Skip to content

Commit a6dc73e

Browse files
committed
add back user_filesystem fixture
1 parent b19a95b commit a6dc73e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/conftest.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
import importlib.resources
2+
import json
23
import logging
34
from functools import lru_cache
5+
from pathlib import Path
46

57
import pytest
68

79
logger = logging.getLogger(__name__)
810

911

12+
@pytest.fixture
13+
def user_filesystem(tmp_path):
14+
base_dir = Path(tmp_path)
15+
home_dir = base_dir / "home_dir"
16+
home_dir.mkdir(parents=True, exist_ok=True)
17+
cwd_dir = base_dir / "cwd_dir"
18+
cwd_dir.mkdir(parents=True, exist_ok=True)
19+
20+
home_config_data = {"username": "home_username", "email": "[email protected]"}
21+
with open(home_dir / "diffpyconfig.json", "w") as f:
22+
json.dump(home_config_data, f)
23+
yield tmp_path
24+
25+
1026
# diffpy.structure
1127
@lru_cache()
1228
def has_diffpy_structure():

0 commit comments

Comments
 (0)