Commit 4cfb1914 authored by Eric Duminil's avatar Eric Duminil
Browse files

Updated tests

parent eef5b8c9
...@@ -95,6 +95,7 @@ def test_run_kpis_on_stdout(mock_simstadt, run_cli, capsys, tmp_path): ...@@ -95,6 +95,7 @@ def test_run_kpis_on_stdout(mock_simstadt, run_cli, capsys, tmp_path):
out, err = run_cli(capsys, HEAT_TEMPLATE, CITYGML, "-p", proj) out, err = run_cli(capsys, HEAT_TEMPLATE, CITYGML, "-p", proj)
assert "Heated area" in out assert "Heated area" in out
assert "Year of construction" in out assert "Year of construction" in out
assert "Output files:" not in out
assert err == "" # silent on success assert err == "" # silent on success
...@@ -108,18 +109,12 @@ def test_run_files_flag(mock_simstadt, run_cli, capsys, tmp_path): ...@@ -108,18 +109,12 @@ def test_run_files_flag(mock_simstadt, run_cli, capsys, tmp_path):
assert "Mean Uvalue" in out assert "Mean Uvalue" in out
def test_run_no_files_flag(mock_simstadt, run_cli, capsys, tmp_path): def broken_simstadt(workflow_path: Path, name: str) -> str:
proj = tmp_path / "Test.proj" raise ValueError("BOOM!")
proj.mkdir()
out, _ = run_cli(capsys, HEAT_TEMPLATE, CITYGML, "-p", proj)
assert "Output files:" not in out
def test_run_error_on_stderr(monkeypatch, capsys, tmp_path): def test_run_error_on_stderr(monkeypatch, capsys, tmp_path):
monkeypatch.setattr( monkeypatch.setattr("simstadt.runner.run_simstadt", broken_simstadt)
"simstadt.runner.run_simstadt",
lambda *a, **kw: (_ for _ in ()).throw(ValueError("boom")),
)
monkeypatch.setattr( monkeypatch.setattr(
sys, sys,
"argv", "argv",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment