diff --git a/setup.py b/setup.py index 4f570f74..b77dba80 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ def read(fname): requirements = [ "contextily", "dash < 2.9.0", - "demandlib", + "demandlib < 0.2.0", "descartes", "egoio >= 0.4.7", "geoalchemy2 < 0.7.0", diff --git a/tests/conftest.py b/tests/conftest.py index 6809eb81..998adaeb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -57,6 +57,9 @@ def pytest_addoption(parser): default=False, help="run tests that only work locally", ) + parser.addoption( + "--runoedbtest", action="store_true", default=False, help="Run OEDB tests" + ) def pytest_collection_modifyitems(config, items): @@ -75,3 +78,8 @@ def pytest_collection_modifyitems(config, items): for item in items: if "runonlinux" in item.keywords: item.add_marker(skip_windows) + if not config.getoption("--runoedbtest"): + skip_oedbtest = pytest.mark.skip(reason="need --runoedbtest option to run") + for item in items: + if "oedbtest" in item.keywords: + item.add_marker(skip_oedbtest) diff --git a/tests/io/test_generators_import.py b/tests/io/test_generators_import.py index 9adfdde1..51ee4b5e 100644 --- a/tests/io/test_generators_import.py +++ b/tests/io/test_generators_import.py @@ -484,6 +484,7 @@ class TestGeneratorsImportOEDB: """ @pytest.mark.slow + @pytest.mark.oedbtest def test_oedb_legacy_without_timeseries(self): edisgo = EDisGo( ding0_grid=pytest.ding0_test_network_2_path, @@ -497,6 +498,7 @@ def test_oedb_legacy_without_timeseries(self): assert np.isclose(edisgo.topology.generators_df.p_nom.sum(), 20.18783) @pytest.mark.slow + @pytest.mark.oedbtest def test_oedb_legacy_with_worst_case_timeseries(self): edisgo = EDisGo(ding0_grid=pytest.ding0_test_network_2_path) edisgo.set_time_series_worst_case_analysis() @@ -568,6 +570,7 @@ def test_oedb_legacy_with_worst_case_timeseries(self): # :, new_solar_gen.name] / new_solar_gen.p_nom).all() @pytest.mark.slow + @pytest.mark.oedbtest def test_oedb_legacy_with_timeseries_by_technology(self): timeindex = pd.date_range("1/1/2012", periods=3, freq="H") ts_gen_dispatchable = pd.DataFrame( @@ -647,6 +650,7 @@ def test_oedb_legacy_with_timeseries_by_technology(self): # :, new_solar_gen.name] / new_solar_gen.p_nom).all() @pytest.mark.slow + @pytest.mark.oedbtest def test_target_capacity(self): edisgo = EDisGo( ding0_grid=pytest.ding0_test_network_2_path, diff --git a/tests/io/test_timeseries_import.py b/tests/io/test_timeseries_import.py index 93825e9a..17340163 100644 --- a/tests/io/test_timeseries_import.py +++ b/tests/io/test_timeseries_import.py @@ -59,6 +59,7 @@ def test__timeindex_helper_func(self): assert_index_equal(ind, given_index) assert_index_equal(ind_full, timeindex) + @pytest.mark.oedbtest def test_feedin_oedb_legacy(self): edisgo = EDisGo(ding0_grid=pytest.ding0_test_network_path) timeindex = pd.date_range("1/1/2010", periods=3000, freq="H") diff --git a/tests/network/test_timeseries.py b/tests/network/test_timeseries.py index 2c05eda4..3818aaf3 100644 --- a/tests/network/test_timeseries.py +++ b/tests/network/test_timeseries.py @@ -1235,6 +1235,7 @@ def test_worst_case_storage_units(self): ) @pytest.mark.slow + @pytest.mark.oedbtest def test_predefined_fluctuating_generators_by_technology(self): timeindex = pd.date_range("1/1/2011 12:00", periods=2, freq="H") self.edisgo.timeseries.timeindex = timeindex diff --git a/tests/test_edisgo.py b/tests/test_edisgo.py index e0379bd5..dbfa03a3 100755 --- a/tests/test_edisgo.py +++ b/tests/test_edisgo.py @@ -382,6 +382,7 @@ def test_to_graph(self): ) @pytest.mark.slow + @pytest.mark.oedbtest def test_generator_import(self): edisgo = EDisGo(ding0_grid=pytest.ding0_test_network_2_path) edisgo.import_generators("nep2035") diff --git a/tests/test_examples.py b/tests/test_examples.py index 8e31d88d..9f0a862e 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -26,6 +26,7 @@ def test_plot_example_ipynb(self): assert result.exec_error is None @pytest.mark.slow + @pytest.mark.oedbtest def test_electromobility_example_ipynb(self): path = os.path.join(self.examples_dir_path, "electromobility_example.ipynb") notebook = pytest_notebook.notebook.load_notebook(path=path) @@ -39,6 +40,7 @@ def test_electromobility_example_ipynb(self): assert result.exec_error is None @pytest.mark.slow + @pytest.mark.oedbtest def test_edisgo_simple_example_ipynb(self): path = os.path.join(self.examples_dir_path, "edisgo_simple_example.ipynb") notebook = pytest_notebook.notebook.load_notebook(path=path) diff --git a/tests/tools/test_tools.py b/tests/tools/test_tools.py index 606c60d8..40c34a63 100644 --- a/tests/tools/test_tools.py +++ b/tests/tools/test_tools.py @@ -168,6 +168,7 @@ def test_determine_bus_voltage_level(self): assert tools.determine_bus_voltage_level(self.edisgo, bus_voltage_level_6) == 6 assert tools.determine_bus_voltage_level(self.edisgo, bus_voltage_level_7) == 7 + @pytest.mark.oedbtest def test_get_weather_cells_intersecting_with_grid_district(self): weather_cells = tools.get_weather_cells_intersecting_with_grid_district( self.edisgo