From c71ee427456dabfa46fb355ba70e824fbb06b7cb Mon Sep 17 00:00:00 2001 From: Austin Raney Date: Tue, 8 Oct 2024 09:30:59 -0400 Subject: [PATCH 1/3] refactor(test): use pytest asyncio's event_loop fixture directly `pytest-aiohttp` re-exports `pytest-asyncio`'s `event_loop` fixture as `loop`. `pytest-aiohttp` will remove the `loop` fixture in the future. use the `pytest-asyncio`'s `event_loop` directly. https://github.com/aio-libs/pytest-aiohttp/pull/19 --- python/nwis_client/tests/test_nwis.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/nwis_client/tests/test_nwis.py b/python/nwis_client/tests/test_nwis.py index 7f80d956..fb3d82e0 100644 --- a/python/nwis_client/tests/test_nwis.py +++ b/python/nwis_client/tests/test_nwis.py @@ -77,7 +77,7 @@ def text(self): ##### FIXTURES ##### @pytest.fixture(name="IVDataServiceWithTempCache") -def wrap_iv_cache_location_to_temp(loop): +def wrap_iv_cache_location_to_temp(event_loop): from tempfile import TemporaryDirectory from pathlib import Path from functools import partial @@ -540,7 +540,7 @@ def test_nwis_client_get_throws_warning_for_kwargs(mocked_iv): mocked_iv.get(sites=["01189000"], startDt="2022-01-01") @pytest.mark.slow -def test_nwis_client_cache_path(loop): +def test_nwis_client_cache_path(event_loop): """verify that cache directory has configurable location""" from tempfile import TemporaryDirectory from pathlib import Path @@ -558,7 +558,7 @@ def test_nwis_client_cache_path(loop): @pytest.mark.slow -def test_nwis_client_context_manager(loop): +def test_nwis_client_context_manager(event_loop): """verify that context manager closes resources""" with iv.IVDataService() as service: service.get(sites=["01189000"], startDT="2022-01-01") @@ -567,7 +567,7 @@ def test_nwis_client_context_manager(loop): # assert service._restclient._loop.is_closed() -def test_fixes_209(loop, monkeypatch): +def test_fixes_209(event_loop, monkeypatch): """ verify that pandas FutureWarning is not raised by `IVDataService.get`. This FutureWarning was introduced in 1.5.1. see pandas changelog From bc6915df5d4d9ce867d5ed147fcb77506c2e0386 Mon Sep 17 00:00:00 2001 From: Austin Raney Date: Tue, 8 Oct 2024 11:38:29 -0400 Subject: [PATCH 2/3] chore(test): set default asyncio test fixture scope to function this is annoying... a warning is issued without this present. the change to `pytest-asyncio` was added here: https://github.com/pytest-dev/pytest-asyncio/commit/c74d1c3fba1afac0b8316763257c915bfba5f5e3#diff-b6eecb9684dfb3a8e0ad8e43510999af4dc5dc5d03edaafd7fe6f872b22fe857R211 --- python/nwis_client/pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/nwis_client/pytest.ini b/python/nwis_client/pytest.ini index 81cf57a0..ff0c5628 100644 --- a/python/nwis_client/pytest.ini +++ b/python/nwis_client/pytest.ini @@ -1,4 +1,4 @@ [pytest] markers = slow: marks tests as slow (deselect with '-m "not slow"') - \ No newline at end of file +asyncio_default_fixture_loop_scope = function From e5d66b323cf42294992dc88727610e34447cbbf4 Mon Sep 17 00:00:00 2001 From: Austin Raney Date: Tue, 8 Oct 2024 11:41:24 -0400 Subject: [PATCH 3/3] bump hydrotools.nwis_client 3.3.1 -> 3.4.0 --- python/nwis_client/src/hydrotools/nwis_client/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/nwis_client/src/hydrotools/nwis_client/_version.py b/python/nwis_client/src/hydrotools/nwis_client/_version.py index ff041687..903a158a 100644 --- a/python/nwis_client/src/hydrotools/nwis_client/_version.py +++ b/python/nwis_client/src/hydrotools/nwis_client/_version.py @@ -1 +1 @@ -__version__ = "3.3.1" +__version__ = "3.4.0"