Commit eb959ebe authored by Eric Duminil's avatar Eric Duminil
Browse files

Marking tests with integration / slow

parent 78e52892
......@@ -13,7 +13,7 @@ coverage: ## Run tests, and save coverage
gio open coverage/index.html
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
uv run simstadt
......
......@@ -24,7 +24,8 @@ dev = ["pytest>=8.0", "rich", "pytest-cov"]
[tool.pytest.ini_options]
testpaths = ["tests"]
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]
......
......@@ -17,7 +17,7 @@ def to_dict(values: list[KPI]) -> dict[str, KPI]:
return {kpi.name: kpi for kpi in values}
@pytest.mark.live
@pytest.mark.integration
def test_heat_demand():
results = run_workflow_with_citygml(
TEST_TEMPLATES / "01_HeatDemand",
......@@ -34,7 +34,7 @@ def test_heat_demand():
assert kpis["Heated area"].value > 0
@pytest.mark.live
@pytest.mark.integration
def test_pv():
results = run_workflow_with_citygml(
TEST_TEMPLATES / "03_PV",
......@@ -50,7 +50,7 @@ def test_pv():
assert kpis["Roof area for PV"].value > 0
@pytest.mark.live
@pytest.mark.integration
def test_load_profile():
results = run_workflow_with_citygml(
TEST_TEMPLATES / "02_LoadProfile",
......
......@@ -12,7 +12,7 @@ SIMSTADT_MIN_DATE = "20250701"
SIMSTADT_VERSION_FORMAT = re.compile(r"Launching SimStadt (\S+) \((\w+), rev. (\w+), (\d+)\)")
@pytest.mark.live
@pytest.mark.integration
def test_version(simstadt_folder):
output = get_simstadt_output(simstadt_folder)
m = SIMSTADT_VERSION_FORMAT.search(output)
......
......@@ -18,7 +18,8 @@ def to_dict(values: list[KPI]) -> dict[str, KPI]:
return {kpi.name: kpi for kpi in values}
@pytest.mark.live
@pytest.mark.integration
@pytest.mark.slow
def test_pv_no_shadow(simstadt_folder):
results = photovoltaic_simulation(MINI, METEONORM, with_shadows=False, min_roof_insolation=800,
project_path=PROJECT_PATH)
......@@ -28,7 +29,8 @@ def test_pv_no_shadow(simstadt_folder):
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):
base_kpis = to_dict(photovoltaic_simulation(MINI, METEONORM, with_shadows=False, min_roof_insolation=800,
project_path=PROJECT_PATH).kpis)
......@@ -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
@pytest.mark.live
@pytest.mark.integration
@pytest.mark.slow
def test_pv_shadow_reduces_yield(simstadt_folder):
kpis = to_dict(photovoltaic_simulation(MINI, METEONORM, with_shadows=False, min_roof_insolation=800,
project_path=PROJECT_PATH).kpis)
......@@ -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
@pytest.mark.live
@pytest.mark.integration
@pytest.mark.slow
def test_pv_trees_reduce_yield(simstadt_folder):
shadow_kpis = to_dict(photovoltaic_simulation(MINI, METEONORM, with_shadows=True, min_roof_insolation=800,
project_path=PROJECT_PATH).kpis)
......@@ -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
@pytest.mark.live
@pytest.mark.integration
@pytest.mark.slow
def test_heatdemand_heating_and_cooling(simstadt_folder):
kpis = to_dict(heatdemand_simulation(MINI, METEONORM, with_shadows=False,
calculation_mode="HEATING_AND_COOLING",
......@@ -74,7 +79,8 @@ def test_heatdemand_heating_and_cooling(simstadt_folder):
assert kpis["Year of construction"].value > 1900
@pytest.mark.live
@pytest.mark.integration
@pytest.mark.slow
def test_heatdemand_shadow_increases_heating(simstadt_folder):
kpis = to_dict(heatdemand_simulation(MINI, METEONORM, with_shadows=False,
calculation_mode="HEATING_AND_COOLING",
......@@ -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
@pytest.mark.live
@pytest.mark.integration
@pytest.mark.slow
def test_heatdemand_trees_increase_heating(simstadt_folder):
shadow_kpis = to_dict(heatdemand_simulation(MINI, METEONORM, with_shadows=True,
calculation_mode="HEATING_AND_COOLING",
......@@ -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
@pytest.mark.live
@pytest.mark.integration
@pytest.mark.slow
def test_heatdemand_refurbishment_reduces_demand(simstadt_folder):
tree_kpis = to_dict(heatdemand_simulation(MINI_TREES, METEONORM, with_shadows=True,
calculation_mode="HEATING_AND_COOLING",
......@@ -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
@pytest.mark.live
@pytest.mark.integration
@pytest.mark.slow
def test_greenwater(simstadt_folder):
kpis = to_dict(greenwater_simulation(MINI_TREES, METEONORM, irrigation_ratio=1.0,
project_path=PROJECT_PATH).kpis)
......@@ -121,7 +130,8 @@ def test_greenwater(simstadt_folder):
assert abs(kpis["Rain"].rounded_value - 458) < 1
@pytest.mark.live
@pytest.mark.integration
@pytest.mark.slow
def test_greenwater_no_irrigation(simstadt_folder):
kpis = to_dict(greenwater_simulation(MINI_TREES, METEONORM, irrigation_ratio=1.0,
project_path=PROJECT_PATH).kpis)
......
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