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
512e012a
Commit
512e012a
authored
Mar 13, 2026
by
Eric Duminil
Browse files
More tests
parent
ace2fe1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/test_runner.py
View file @
512e012a
...
...
@@ -7,9 +7,9 @@ from simstadt.runner import run_workflow_with_citygml
TEST_DATA
=
Path
(
__file__
).
parent
/
"data"
CITYGML
=
TEST_DATA
/
"TestRepo"
/
"MiniBuchwald.gml"
TEMPLATE
1
=
TEST_DATA
/
"Templates"
/
"01_HeatDemand"
TEMPLATE
2
=
TEST_DATA
/
"Templates"
/
"02_LoadProfile"
TEMPLATE
3
=
TEST_DATA
/
"Templates"
/
"03_PV"
HEAT_
TEMPLATE
=
TEST_DATA
/
"Templates"
/
"01_HeatDemand"
LOAD_
TEMPLATE
=
TEST_DATA
/
"Templates"
/
"02_LoadProfile"
PV_
TEMPLATE
=
TEST_DATA
/
"Templates"
/
"03_PV"
def
test_citygml_in_proj_folder
(
mock_simstadt
,
tmp_path
):
...
...
@@ -19,24 +19,33 @@ def test_citygml_in_proj_folder(mock_simstadt, tmp_path):
gml
=
proj
/
CITYGML
.
name
shutil
.
copy
(
CITYGML
,
gml
)
results
=
run_workflow_with_citygml
(
TEMPLATE
1
,
gml
)
results
=
run_workflow_with_citygml
(
HEAT_
TEMPLATE
,
gml
)
assert
results
is
not
None
assert
CITYGML
.
name
in
results
.
citygml
assert
results
.
workflow_path
.
parent
==
proj
rich
.
print
(
results
.
kpis
)
assert
len
(
results
.
dataframe
)
>
0
assert
len
(
results
.
kpis
)
==
10
import
rich
def
test_citygml_with_explicit_project_path
(
mock_simstadt
,
tmp_path
):
"""CityGML outside .proj with project_path — CityGML is copied to project_path."""
proj
=
tmp_path
/
"Test.proj"
proj
.
mkdir
()
results
=
run_workflow_with_citygml
(
TEMPLATE
2
,
CITYGML
,
project_path
=
proj
)
results
=
run_workflow_with_citygml
(
LOAD_
TEMPLATE
,
CITYGML
,
project_path
=
proj
)
assert
(
proj
/
CITYGML
.
name
).
exists
()
assert
results
is
not
None
assert
results
.
workflow_path
.
parent
==
proj
assert
len
(
results
.
dataframe
)
>
0
assert
len
(
results
.
kpis
)
==
3
assert
results
.
kpi
(
'Average load'
).
unit
==
'kWh / h'
def
test_citygml_with_explicit_project_path_no_double_copy
(
mock_simstadt
,
tmp_path
):
"""CityGML already present in project_path — not copied again."""
...
...
@@ -46,14 +55,18 @@ def test_citygml_with_explicit_project_path_no_double_copy(mock_simstadt, tmp_pa
shutil
.
copy
(
CITYGML
,
dest
)
mtime_before
=
dest
.
stat
().
st_mtime
run_workflow_with_citygml
(
TEMPLATE
3
,
CITYGML
,
project_path
=
proj
)
results
=
run_workflow_with_citygml
(
PV_
TEMPLATE
,
CITYGML
,
project_path
=
proj
)
assert
dest
.
stat
().
st_mtime
==
mtime_before
assert
len
(
results
.
dataframe
)
>
0
assert
len
(
results
.
kpis
)
==
5
assert
results
.
kpi
(
'Irradiance in module plane'
).
unit
==
'W / m²'
def
test_citygml_creates_temp_repo
(
mock_simstadt
):
"""CityGML outside .proj with no project_path — temporary repository created."""
results
=
run_workflow_with_citygml
(
TEMPLATE
1
,
CITYGML
)
results
=
run_workflow_with_citygml
(
HEAT_
TEMPLATE
,
CITYGML
)
assert
results
is
not
None
assert
"simstadt_repo"
in
str
(
results
.
workflow_path
)
...
...
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