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
eb959ebe
Commit
eb959ebe
authored
Mar 13, 2026
by
Eric Duminil
Browse files
Marking tests with integration / slow
parent
78e52892
Changes
5
Show whitespace changes
Inline
Side-by-side
Makefile
View file @
eb959ebe
...
@@ -13,7 +13,7 @@ coverage: ## Run tests, and save coverage
...
@@ -13,7 +13,7 @@ coverage: ## Run tests, and save coverage
gio open coverage/index.html
gio open coverage/index.html
simple_tests
:
##
Run simple tests
,
without running SimStadt
simple_tests
:
##
Run simple tests
,
without running SimStadt
uv run pytest
-v
-m
"not
live
"
uv run pytest
-v
-m
"not
integration
"
simstadt
:
##
Run simstadt script
,
and display info about SimStadt
simstadt
:
##
Run simstadt script
,
and display info about SimStadt
uv run simstadt
uv run simstadt
...
...
pyproject.toml
View file @
eb959ebe
...
@@ -24,7 +24,8 @@ dev = ["pytest>=8.0", "rich", "pytest-cov"]
...
@@ -24,7 +24,8 @@ dev = ["pytest>=8.0", "rich", "pytest-cov"]
[tool.pytest.ini_options]
[tool.pytest.ini_options]
testpaths
=
["tests"]
testpaths
=
["tests"]
markers
=
[
markers
=
[
"live: tests that require a SimStadt installation and a live project path"
,
"integration: tests that require a SimStadt installation and run full workflows end-to-end"
,
"slow: tests that take a long time to run"
,
]
]
[build-system]
[build-system]
...
...
tests/test_simulations.py
View file @
eb959ebe
...
@@ -17,7 +17,7 @@ def to_dict(values: list[KPI]) -> dict[str, KPI]:
...
@@ -17,7 +17,7 @@ def to_dict(values: list[KPI]) -> dict[str, KPI]:
return
{
kpi
.
name
:
kpi
for
kpi
in
values
}
return
{
kpi
.
name
:
kpi
for
kpi
in
values
}
@
pytest
.
mark
.
live
@
pytest
.
mark
.
integration
def
test_heat_demand
():
def
test_heat_demand
():
results
=
run_workflow_with_citygml
(
results
=
run_workflow_with_citygml
(
TEST_TEMPLATES
/
"01_HeatDemand"
,
TEST_TEMPLATES
/
"01_HeatDemand"
,
...
@@ -34,7 +34,7 @@ def test_heat_demand():
...
@@ -34,7 +34,7 @@ def test_heat_demand():
assert
kpis
[
"Heated area"
].
value
>
0
assert
kpis
[
"Heated area"
].
value
>
0
@
pytest
.
mark
.
live
@
pytest
.
mark
.
integration
def
test_pv
():
def
test_pv
():
results
=
run_workflow_with_citygml
(
results
=
run_workflow_with_citygml
(
TEST_TEMPLATES
/
"03_PV"
,
TEST_TEMPLATES
/
"03_PV"
,
...
@@ -50,7 +50,7 @@ def test_pv():
...
@@ -50,7 +50,7 @@ def test_pv():
assert
kpis
[
"Roof area for PV"
].
value
>
0
assert
kpis
[
"Roof area for PV"
].
value
>
0
@
pytest
.
mark
.
live
@
pytest
.
mark
.
integration
def
test_load_profile
():
def
test_load_profile
():
results
=
run_workflow_with_citygml
(
results
=
run_workflow_with_citygml
(
TEST_TEMPLATES
/
"02_LoadProfile"
,
TEST_TEMPLATES
/
"02_LoadProfile"
,
...
...
tests/test_version.py
View file @
eb959ebe
...
@@ -12,7 +12,7 @@ SIMSTADT_MIN_DATE = "20250701"
...
@@ -12,7 +12,7 @@ SIMSTADT_MIN_DATE = "20250701"
SIMSTADT_VERSION_FORMAT
=
re
.
compile
(
r
"Launching SimStadt (\S+) \((\w+), rev. (\w+), (\d+)\)"
)
SIMSTADT_VERSION_FORMAT
=
re
.
compile
(
r
"Launching SimStadt (\S+) \((\w+), rev. (\w+), (\d+)\)"
)
@
pytest
.
mark
.
live
@
pytest
.
mark
.
integration
def
test_version
(
simstadt_folder
):
def
test_version
(
simstadt_folder
):
output
=
get_simstadt_output
(
simstadt_folder
)
output
=
get_simstadt_output
(
simstadt_folder
)
m
=
SIMSTADT_VERSION_FORMAT
.
search
(
output
)
m
=
SIMSTADT_VERSION_FORMAT
.
search
(
output
)
...
...
tests/test_workflows.py
View file @
eb959ebe
...
@@ -18,7 +18,8 @@ def to_dict(values: list[KPI]) -> dict[str, KPI]:
...
@@ -18,7 +18,8 @@ def to_dict(values: list[KPI]) -> dict[str, KPI]:
return
{
kpi
.
name
:
kpi
for
kpi
in
values
}
return
{
kpi
.
name
:
kpi
for
kpi
in
values
}
@
pytest
.
mark
.
live
@
pytest
.
mark
.
integration
@
pytest
.
mark
.
slow
def
test_pv_no_shadow
(
simstadt_folder
):
def
test_pv_no_shadow
(
simstadt_folder
):
results
=
photovoltaic_simulation
(
MINI
,
METEONORM
,
with_shadows
=
False
,
min_roof_insolation
=
800
,
results
=
photovoltaic_simulation
(
MINI
,
METEONORM
,
with_shadows
=
False
,
min_roof_insolation
=
800
,
project_path
=
PROJECT_PATH
)
project_path
=
PROJECT_PATH
)
...
@@ -28,7 +29,8 @@ def test_pv_no_shadow(simstadt_folder):
...
@@ -28,7 +29,8 @@ def test_pv_no_shadow(simstadt_folder):
assert
abs
(
kpis
[
"PV specific yield"
].
value
-
1_100
)
<
200
assert
abs
(
kpis
[
"PV specific yield"
].
value
-
1_100
)
<
200
@
pytest
.
mark
.
live
@
pytest
.
mark
.
integration
@
pytest
.
mark
.
slow
def
test_pv_more_modules
(
simstadt_folder
):
def
test_pv_more_modules
(
simstadt_folder
):
base_kpis
=
to_dict
(
photovoltaic_simulation
(
MINI
,
METEONORM
,
with_shadows
=
False
,
min_roof_insolation
=
800
,
base_kpis
=
to_dict
(
photovoltaic_simulation
(
MINI
,
METEONORM
,
with_shadows
=
False
,
min_roof_insolation
=
800
,
project_path
=
PROJECT_PATH
).
kpis
)
project_path
=
PROJECT_PATH
).
kpis
)
...
@@ -41,7 +43,8 @@ def test_pv_more_modules(simstadt_folder):
...
@@ -41,7 +43,8 @@ def test_pv_more_modules(simstadt_folder):
assert
abs
(
more_kpis
[
"Roof area for PV"
].
value
-
base_kpis
[
"Roof area for PV"
].
value
)
<
100
assert
abs
(
more_kpis
[
"Roof area for PV"
].
value
-
base_kpis
[
"Roof area for PV"
].
value
)
<
100
@
pytest
.
mark
.
live
@
pytest
.
mark
.
integration
@
pytest
.
mark
.
slow
def
test_pv_shadow_reduces_yield
(
simstadt_folder
):
def
test_pv_shadow_reduces_yield
(
simstadt_folder
):
kpis
=
to_dict
(
photovoltaic_simulation
(
MINI
,
METEONORM
,
with_shadows
=
False
,
min_roof_insolation
=
800
,
kpis
=
to_dict
(
photovoltaic_simulation
(
MINI
,
METEONORM
,
with_shadows
=
False
,
min_roof_insolation
=
800
,
project_path
=
PROJECT_PATH
).
kpis
)
project_path
=
PROJECT_PATH
).
kpis
)
...
@@ -51,7 +54,8 @@ def test_pv_shadow_reduces_yield(simstadt_folder):
...
@@ -51,7 +54,8 @@ def test_pv_shadow_reduces_yield(simstadt_folder):
assert
shadow_kpis
[
"Irradiance in module plane"
].
value
<
kpis
[
"Irradiance in module plane"
].
value
assert
shadow_kpis
[
"Irradiance in module plane"
].
value
<
kpis
[
"Irradiance in module plane"
].
value
@
pytest
.
mark
.
live
@
pytest
.
mark
.
integration
@
pytest
.
mark
.
slow
def
test_pv_trees_reduce_yield
(
simstadt_folder
):
def
test_pv_trees_reduce_yield
(
simstadt_folder
):
shadow_kpis
=
to_dict
(
photovoltaic_simulation
(
MINI
,
METEONORM
,
with_shadows
=
True
,
min_roof_insolation
=
800
,
shadow_kpis
=
to_dict
(
photovoltaic_simulation
(
MINI
,
METEONORM
,
with_shadows
=
True
,
min_roof_insolation
=
800
,
project_path
=
PROJECT_PATH
).
kpis
)
project_path
=
PROJECT_PATH
).
kpis
)
...
@@ -63,7 +67,8 @@ def test_pv_trees_reduce_yield(simstadt_folder):
...
@@ -63,7 +67,8 @@ def test_pv_trees_reduce_yield(simstadt_folder):
assert
tree_kpis
[
"PV potential yield"
].
value
<
shadow_kpis
[
"PV potential yield"
].
value
*
0.8
assert
tree_kpis
[
"PV potential yield"
].
value
<
shadow_kpis
[
"PV potential yield"
].
value
*
0.8
@
pytest
.
mark
.
live
@
pytest
.
mark
.
integration
@
pytest
.
mark
.
slow
def
test_heatdemand_heating_and_cooling
(
simstadt_folder
):
def
test_heatdemand_heating_and_cooling
(
simstadt_folder
):
kpis
=
to_dict
(
heatdemand_simulation
(
MINI
,
METEONORM
,
with_shadows
=
False
,
kpis
=
to_dict
(
heatdemand_simulation
(
MINI
,
METEONORM
,
with_shadows
=
False
,
calculation_mode
=
"HEATING_AND_COOLING"
,
calculation_mode
=
"HEATING_AND_COOLING"
,
...
@@ -74,7 +79,8 @@ def test_heatdemand_heating_and_cooling(simstadt_folder):
...
@@ -74,7 +79,8 @@ def test_heatdemand_heating_and_cooling(simstadt_folder):
assert
kpis
[
"Year of construction"
].
value
>
1900
assert
kpis
[
"Year of construction"
].
value
>
1900
@
pytest
.
mark
.
live
@
pytest
.
mark
.
integration
@
pytest
.
mark
.
slow
def
test_heatdemand_shadow_increases_heating
(
simstadt_folder
):
def
test_heatdemand_shadow_increases_heating
(
simstadt_folder
):
kpis
=
to_dict
(
heatdemand_simulation
(
MINI
,
METEONORM
,
with_shadows
=
False
,
kpis
=
to_dict
(
heatdemand_simulation
(
MINI
,
METEONORM
,
with_shadows
=
False
,
calculation_mode
=
"HEATING_AND_COOLING"
,
calculation_mode
=
"HEATING_AND_COOLING"
,
...
@@ -86,7 +92,8 @@ def test_heatdemand_shadow_increases_heating(simstadt_folder):
...
@@ -86,7 +92,8 @@ def test_heatdemand_shadow_increases_heating(simstadt_folder):
assert
shadow_kpis
[
"Yearly Cooling demand"
].
value
<
kpis
[
"Yearly Cooling demand"
].
value
*
0.95
assert
shadow_kpis
[
"Yearly Cooling demand"
].
value
<
kpis
[
"Yearly Cooling demand"
].
value
*
0.95
@
pytest
.
mark
.
live
@
pytest
.
mark
.
integration
@
pytest
.
mark
.
slow
def
test_heatdemand_trees_increase_heating
(
simstadt_folder
):
def
test_heatdemand_trees_increase_heating
(
simstadt_folder
):
shadow_kpis
=
to_dict
(
heatdemand_simulation
(
MINI
,
METEONORM
,
with_shadows
=
True
,
shadow_kpis
=
to_dict
(
heatdemand_simulation
(
MINI
,
METEONORM
,
with_shadows
=
True
,
calculation_mode
=
"HEATING_AND_COOLING"
,
calculation_mode
=
"HEATING_AND_COOLING"
,
...
@@ -98,7 +105,8 @@ def test_heatdemand_trees_increase_heating(simstadt_folder):
...
@@ -98,7 +105,8 @@ def test_heatdemand_trees_increase_heating(simstadt_folder):
assert
tree_kpis
[
"Yearly Cooling demand"
].
value
<
shadow_kpis
[
"Yearly Cooling demand"
].
value
*
0.95
assert
tree_kpis
[
"Yearly Cooling demand"
].
value
<
shadow_kpis
[
"Yearly Cooling demand"
].
value
*
0.95
@
pytest
.
mark
.
live
@
pytest
.
mark
.
integration
@
pytest
.
mark
.
slow
def
test_heatdemand_refurbishment_reduces_demand
(
simstadt_folder
):
def
test_heatdemand_refurbishment_reduces_demand
(
simstadt_folder
):
tree_kpis
=
to_dict
(
heatdemand_simulation
(
MINI_TREES
,
METEONORM
,
with_shadows
=
True
,
tree_kpis
=
to_dict
(
heatdemand_simulation
(
MINI_TREES
,
METEONORM
,
with_shadows
=
True
,
calculation_mode
=
"HEATING_AND_COOLING"
,
calculation_mode
=
"HEATING_AND_COOLING"
,
...
@@ -111,7 +119,8 @@ def test_heatdemand_refurbishment_reduces_demand(simstadt_folder):
...
@@ -111,7 +119,8 @@ def test_heatdemand_refurbishment_reduces_demand(simstadt_folder):
assert
refurb_kpis
[
"Mean Uvalue"
].
value
<
tree_kpis
[
"Mean Uvalue"
].
value
*
0.50
assert
refurb_kpis
[
"Mean Uvalue"
].
value
<
tree_kpis
[
"Mean Uvalue"
].
value
*
0.50
@
pytest
.
mark
.
live
@
pytest
.
mark
.
integration
@
pytest
.
mark
.
slow
def
test_greenwater
(
simstadt_folder
):
def
test_greenwater
(
simstadt_folder
):
kpis
=
to_dict
(
greenwater_simulation
(
MINI_TREES
,
METEONORM
,
irrigation_ratio
=
1.0
,
kpis
=
to_dict
(
greenwater_simulation
(
MINI_TREES
,
METEONORM
,
irrigation_ratio
=
1.0
,
project_path
=
PROJECT_PATH
).
kpis
)
project_path
=
PROJECT_PATH
).
kpis
)
...
@@ -121,7 +130,8 @@ def test_greenwater(simstadt_folder):
...
@@ -121,7 +130,8 @@ def test_greenwater(simstadt_folder):
assert
abs
(
kpis
[
"Rain"
].
rounded_value
-
458
)
<
1
assert
abs
(
kpis
[
"Rain"
].
rounded_value
-
458
)
<
1
@
pytest
.
mark
.
live
@
pytest
.
mark
.
integration
@
pytest
.
mark
.
slow
def
test_greenwater_no_irrigation
(
simstadt_folder
):
def
test_greenwater_no_irrigation
(
simstadt_folder
):
kpis
=
to_dict
(
greenwater_simulation
(
MINI_TREES
,
METEONORM
,
irrigation_ratio
=
1.0
,
kpis
=
to_dict
(
greenwater_simulation
(
MINI_TREES
,
METEONORM
,
irrigation_ratio
=
1.0
,
project_path
=
PROJECT_PATH
).
kpis
)
project_path
=
PROJECT_PATH
).
kpis
)
...
...
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