Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SimStadt
simstadtpy
Commits
4cfb1914
Commit
4cfb1914
authored
Mar 14, 2026
by
Eric Duminil
Browse files
Updated tests
parent
eef5b8c9
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/test_cli.py
View file @
4cfb1914
...
@@ -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"
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment