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

Tests that CSVs are exported, only when desired

parent e031586d
...@@ -41,9 +41,8 @@ def test_heat_demand(): ...@@ -41,9 +41,8 @@ def test_heat_demand():
assert kpis["Year of construction"].unit == None assert kpis["Year of construction"].unit == None
for step in ["Geometric", "Physics", "Usage"]: for step in ["Geometric", "Physics", "Usage"]:
for csv in results.get_all_by_extension(".csv"): with pytest.raises(ValueError, match="Workflow didn't seem to have returned any .csv file!"):
if step in csv.name: results.get_unique_by_extension('.csv', step)
pytest.fail(f"{csv.name} should not have been exported")
@pytest.mark.integration @pytest.mark.integration
...@@ -56,14 +55,14 @@ def test_heat_demand_with_csv(): ...@@ -56,14 +55,14 @@ def test_heat_demand_with_csv():
csv_export=True, csv_export=True,
) )
output_csvs = [csv.name for csv in results.get_all_by_extension(".csv")]
for step, suffixes in [ for step, suffixes in [
("Geometric", ["buildings", "surfaces"]), ("Geometric", ["buildings", "surfaces"]),
("Physics", ["buildings", "surfaces"]), ("Physics", ["buildings", "surfaces"]),
("Usage", ["buildings"]), ("Usage", ["buildings"]),
]: ]:
for suffix in suffixes: for suffix in suffixes:
assert f"{step}_{TEST_GML.stem}_{suffix}.csv" in output_csvs found_csv = results.get_unique_by_extension('.csv', step, suffix)
assert found_csv.stat().st_size > 0
@pytest.mark.integration @pytest.mark.integration
......
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