Skip to content

Commit 56c689d

Browse files
committed
Add tests
1 parent 7600606 commit 56c689d

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

tests/conftest.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import json
2+
from pathlib import Path
3+
4+
import pytest
5+
6+
7+
@pytest.fixture
8+
def user_filesystem(tmp_path):
9+
base_dir = Path(tmp_path)
10+
home_dir = base_dir / "home_dir"
11+
home_dir.mkdir(parents=True, exist_ok=True)
12+
cwd_dir = base_dir / "cwd_dir"
13+
cwd_dir.mkdir(parents=True, exist_ok=True)
14+
15+
home_config_data = {"username": "home_username", "email": "[email protected]"}
16+
with open(home_dir / "diffpyconfig.json", "w") as f:
17+
json.dump(home_config_data, f)
18+
19+
yield tmp_path

tests/test_NMF_analysis_code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import pytest
77

8-
from diffpy.nmf_mapping.nmf_mapping.main import main
8+
from diffpy.nmf_mapping.main import main
99

1010
dir = Path(__file__).parent.resolve()
1111

tests/test_version.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""Unit tests for __version__.py
2+
"""
3+
4+
import diffpy.nmf_mapping
5+
6+
7+
def test_package_version():
8+
"""Ensure the package version is defined and not set to the initial placeholder."""
9+
assert hasattr(diffpy.nmf_mapping, "__version__")
10+
assert diffpy.nmf_mapping.__version__ != "0.0.0"

0 commit comments

Comments
 (0)