From d1e0637654dcd0c9e54d5c2ae242a0395a368e58 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Wed, 12 Jun 2024 17:58:26 +0200 Subject: [PATCH] refactor fixtures --- tests/test_fetchers.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/tests/test_fetchers.py b/tests/test_fetchers.py index 7b981a7..55e88d9 100644 --- a/tests/test_fetchers.py +++ b/tests/test_fetchers.py @@ -11,16 +11,8 @@ def glider_grab(): """Create the basic query object for testing.""" g = GliderDataFetcher() - g.dataset_id = "whoi_406-20160902T1700" - return g - - -@pytest.fixture -@pytest.mark.web -def pandas_dataset(): - glider_grab = GliderDataFetcher() - glider_grab.fetcher.dataset_id = "whoi_406-20160902T1700" - yield glider_grab.to_pandas() + g.fetcher.dataset_id = "whoi_406-20160902T1700" + return g, g.to_pandas() def test_variables(glider_grab): @@ -34,12 +26,13 @@ def test_variables(glider_grab): "temperature", "time", ] - assert sorted(glider_grab.fetcher.variables) == sorted(expected) + g, df = glider_grab + assert sorted(g.fetcher.variables) == sorted(expected) -@pytest.mark.vcr() -def test_standardise_variables(pandas_dataset): +def test_standardise_variables(glider_grab): """Check if IOOS variables are properly renamed.""" - variables = pandas_dataset.columns + g, df = glider_grab + variables = df.columns for var in variables: assert var in server_parameter_rename.values()