Skip to content

Commit f5d2ee1

Browse files
Add comprehensive test suite for QuantUI
Introduce a full pytest-based test suite for QuantUI. Adds tests/ with conftest.py (shared fixtures for sample molecules, temp dirs, and pytest markers) and many test modules covering core functionality: ase_bridge (ASE integration, round-trips, file reading, presets), calculator (PySCFCalculation setup, script generation, descriptions/notes, factory), comparison (CalcSummary builders, HTML table, plotting), help_content (help topics and widget), molecule (validation, parsing, properties, presets), plus additional test modules for notebook interactions, optimizer, orbital visualization, phase1, preopt, progress, pubchem, security, session_calc, templates, utils, and visualization_integration. ASE-dependent tests are skipped gracefully when ASE is not available. This commit adds extensive unit and integration tests to improve coverage and catch regressions.
1 parent bad2979 commit f5d2ee1

19 files changed

Lines changed: 5179 additions & 0 deletions

tests/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""
2+
QuantUI Test Suite
3+
4+
Tests for all QuantUI modules.
5+
"""

tests/conftest.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
"""
2+
Pytest Configuration and Fixtures
3+
4+
Shared test fixtures for QuantUI test suite.
5+
"""
6+
7+
import pytest
8+
from pathlib import Path
9+
10+
11+
@pytest.fixture
12+
def sample_water_xyz():
13+
"""Simple water molecule XYZ coordinates."""
14+
return """O 0.0 0.0 0.0
15+
H 0.757 0.587 0.0
16+
H -0.757 0.587 0.0"""
17+
18+
19+
@pytest.fixture
20+
def sample_methane_xyz():
21+
"""Simple methane molecule XYZ coordinates."""
22+
return """C 0.0 0.0 0.0
23+
H 0.63 0.63 0.63
24+
H -0.63 -0.63 0.63
25+
H -0.63 0.63 -0.63
26+
H 0.63 -0.63 -0.63"""
27+
28+
29+
@pytest.fixture
30+
def sample_sdf_water():
31+
"""Sample SDF content for water molecule."""
32+
return """
33+
Mrv2311 02131511003D
34+
35+
3 2 0 0 0 0 999 V2000
36+
0.0000 0.0000 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
37+
0.7570 0.5870 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
38+
-0.7570 0.5870 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0
39+
1 2 1 0 0 0 0
40+
1 3 1 0 0 0 0
41+
M END
42+
$$$$
43+
"""
44+
45+
46+
@pytest.fixture
47+
def temp_test_dir(tmp_path):
48+
"""Create a temporary directory for test files."""
49+
test_dir = tmp_path / "quantui_test"
50+
test_dir.mkdir()
51+
return test_dir
52+
53+
54+
# Markers for test categorization
55+
def pytest_configure(config):
56+
"""Configure pytest with custom markers."""
57+
config.addinivalue_line(
58+
"markers", "network: tests that require network connectivity"
59+
)
60+
config.addinivalue_line(
61+
"markers", "slow: tests that take significant time to run"
62+
)
63+
config.addinivalue_line(
64+
"markers", "integration: integration tests requiring external services"
65+
)

0 commit comments

Comments
 (0)