Skip to content

Commit 89c2ee9

Browse files
committed
Fix test errors
1 parent 9620970 commit 89c2ee9

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

conftest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
from __future__ import annotations
77

8+
import sys
9+
810
import pytest
911

1012

@@ -34,3 +36,11 @@ def pytest_collection_modifyitems(config, items):
3436
for item in items:
3537
if "extra_mlips" in item.keywords:
3638
item.add_marker(skip_extra_mlips)
39+
40+
41+
@pytest.fixture(autouse=True)
42+
def capture_wrap():
43+
"""Block closure of stderr and stdout."""
44+
sys.stderr.close = lambda *args, **kwargs: None
45+
sys.stdout.close = lambda *args, **kwargs: None
46+
yield

tests/test_neb_cli.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,30 +42,26 @@ def test_neb():
4242

4343
assert not results_dir.exists()
4444

45-
import subprocess
46-
4745
try:
48-
result = subprocess.run(
46+
result = runner.invoke(
47+
app,
4948
[
50-
"janus",
5149
"neb",
5250
"--init-struct",
53-
str(DATA_PATH / "LiFePO4_start.cif"),
51+
DATA_PATH / "LiFePO4_start.cif",
5452
"--final-struct",
55-
str(DATA_PATH / "LiFePO4_end.cif"),
53+
DATA_PATH / "LiFePO4_end.cif",
5654
"--interpolator",
5755
"pymatgen",
5856
"--fmax",
59-
str(5),
57+
5,
6058
"--n-images",
61-
str(5),
59+
5,
6260
"--plot-band",
6361
"--write-band",
6462
],
65-
capture_output=True,
66-
check=True,
6763
)
68-
assert result.returncode == 0
64+
assert result.exit_code == 0
6965

7066
assert results_path.exists()
7167
assert band_path.exists()

0 commit comments

Comments
 (0)