From 627c20c92f6814594f8e64e97e5ff85d8d15e2ee Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Thu, 1 Feb 2024 11:29:30 -0300 Subject: [PATCH] increase test coverage --- .github/workflows/tests.yml | 2 +- requirements-dev.txt | 1 + tests/test_fetchers.py | 16 +++++++++++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 02e1091..506a33d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,4 +36,4 @@ jobs: - name: Full Tests shell: bash -l {0} run: | - python -m pytest -rxs --cov=gliderpy tests + python -m pytest -rxs --cov=gliderpy --vcr-record=none tests diff --git a/requirements-dev.txt b/requirements-dev.txt index c4c6685..b477d3f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -13,6 +13,7 @@ pytest pytest-cov pytest-flake8 pytest-sugar +pytest-vcr pytest-xdist setuptools_scm sphinx diff --git a/tests/test_fetchers.py b/tests/test_fetchers.py index c64a3a4..c14e341 100644 --- a/tests/test_fetchers.py +++ b/tests/test_fetchers.py @@ -12,6 +12,14 @@ def glider_grab(): yield 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() + + def test_variables(glider_grab): expected = [ "latitude", @@ -25,10 +33,8 @@ def test_variables(glider_grab): assert sorted(glider_grab.fetcher.variables) == sorted(expected) -def test_standardise_variables_ioos(): - glider_grab = GliderDataFetcher() - glider_grab.fetcher.dataset_id = "whoi_406-20160902T1700" - df = glider_grab.to_pandas() - variables = df.columns +@pytest.mark.vcr(pandas_dataset) +def test_standardise_variables(): + variables = pandas_dataset.columns for var in variables: assert var in server_parameter_rename.values()