Skip to content

Commit 00cbe11

Browse files
committed
Test generated precice-config with checker
1 parent 8cc101e commit 00cbe11

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

tests/test_examples.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,21 @@ def list_examples():
1010

1111

1212
@pytest.mark.parametrize("example", list_examples())
13-
def test_application_with_example(example: Path):
13+
def test_application_with_example(tmp_path, example: Path):
1414
"""Test the application with each example topology files"""
1515

1616
assert example.exists() and example.is_file(), "topology file doesn't exist"
1717

18-
with tempfile.TemporaryDirectory() as temp_dir:
19-
cmd = ["precice-case-generate", "-f", str(example), "-o", temp_dir]
20-
print(f"Running {cmd}")
21-
subprocess.run(cmd)
18+
cmd = ["precice-case-generate", "-f", str(example), "-o", str(tmp_path)]
19+
print(f"Running {cmd}")
20+
subprocess.run(cmd, check=True)
2221

23-
output = [p.name for p in Path(temp_dir).iterdir()]
24-
print(f"Output {output}")
25-
assert output, "Nothing generated"
22+
output = list(tmp_path.iterdir())
23+
print(f"Output {[p.name for p in output]}")
24+
assert output, "Nothing generated"
25+
26+
config = tmp_path / "precice-config.xml"
27+
28+
assert config.exists(), "No precice-config.xml generated"
29+
30+
subprocess.run(["precice-cli", "config", "check", str(config)], check=True)

tox.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ description = run the tests with pytest
99
package = wheel
1010
wheel_build_env = .pkg
1111
deps =
12+
precice-cli@ git+https://github.com/precice/cli.git
1213
pytest>=6
1314
commands =
1415
pytest {tty:--color=yes} {posargs}

0 commit comments

Comments
 (0)