Skip to content

Commit

Permalink
Merge pull request #404 from openego/oedb-connection-issue-disable-test
Browse files Browse the repository at this point in the history
Oedb connection issue disable test
  • Loading branch information
birgits authored Jul 10, 2024
2 parents cb9307e + 47abe91 commit 0a6bf5b
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 8 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
4 changes: 4 additions & 0 deletions tests/io/test_generators_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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()
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions tests/io/test_timeseries_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions tests/network/test_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/test_edisgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 2 additions & 0 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions tests/tools/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0a6bf5b

Please sign in to comment.