Skip to content

Commit 7020dda

Browse files
committed
Nexus: Update PySCF test_check_sim_status to use a more likely failure case
1 parent d2b396d commit 7020dda

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

nexus/nexus/tests/test_pyscf_simulation.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ def test_get_result(tmp_path):
121121

122122
@isolate_nexus_core
123123
def test_check_sim_status(tmp_path):
124+
"""Check that ``check_sim_status`` catches failures.
125+
126+
This tests the case that a user has installed PySCF, but has not
127+
installed ``pyscf-dispersion`` with it, then tries to import it.
128+
"""
124129

125130
nexus_core.runs = ''
126131
nexus_core.local_directory = str(tmp_path)
@@ -191,9 +196,9 @@ def test_check_sim_status(tmp_path):
191196

192197
err_text = """
193198
Traceback (most recent call last):
194-
File "/dummy/path", line 1, in <module>
195-
from pyscf import scf
196-
ModuleNotFoundError: No module named 'pyscf'
199+
File "/home/runs/scf/scf.py", line 2, in <module>
200+
from pyscf import dispersion
201+
ImportError: cannot import name 'dispersion' from 'pyscf' (/home/.venv/lib/python3.14/site-packages/pyscf/__init__.py)
197202
"""
198203
err_path.write_text(err_text)
199204
assert(err_text in err_path.read_text())

nexus/nexus/tests/test_pyscf_simulation_files/scf_template.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#! /usr/bin/env python3
2-
2+
from pyscf import dispersion
33
from pyscf import scf
44

5+
56
# Nexus expands this with Mole info
67
$system
78

0 commit comments

Comments
 (0)