From c2d3af65928fec580f23309356178b26e909760b Mon Sep 17 00:00:00 2001 From: Mike Boyle Date: Tue, 6 Aug 2024 09:07:15 -0400 Subject: [PATCH] Don't use DeprecationWarning, since it doesn't warn --- sxs/catalog/catalog.py | 2 +- sxs/simulations/simulation.py | 4 ++-- tests/test_simulation.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sxs/catalog/catalog.py b/sxs/catalog/catalog.py index 67305f9..af577ee 100644 --- a/sxs/catalog/catalog.py +++ b/sxs/catalog/catalog.py @@ -61,7 +61,7 @@ def load(cls, download=None): favor of the `Simulations` interface. See the documentation for more information. """ - warn(deprecation_notice, DeprecationWarning) + warn(deprecation_notice) progress = read_config("download_progress", True) diff --git a/sxs/simulations/simulation.py b/sxs/simulations/simulation.py index 20dff94..150ec87 100644 --- a/sxs/simulations/simulation.py +++ b/sxs/simulations/simulation.py @@ -129,7 +129,7 @@ def Simulation(location, *args, **kwargs): + "Normally, this simulation should no longer be used, but you\n" + f"explicitly requested version '{input_version}', so it is being used.\n" ) - warn(message, DeprecationWarning) + warn(message) else: if "superseded_by" in metadata: superseded_by = metadata["superseded_by"] @@ -144,7 +144,7 @@ def Simulation(location, *args, **kwargs): ) elif auto_supersede and isinstance(superseded_by, str): message = f"Simulation '{sxs_id}' is being automatically superseded by '{superseded_by}'." - warn(message, DeprecationWarning) + warn(message) new_location = f"{superseded_by}{input_version}" if input_lev_number: new_location += f"/Lev{input_lev_number}" diff --git a/tests/test_simulation.py b/tests/test_simulation.py index 5e05677..f434797 100644 --- a/tests/test_simulation.py +++ b/tests/test_simulation.py @@ -11,17 +11,17 @@ def test_superseded_by_single(loader): # use a simulation that still has just one. with pytest.raises(ValueError): loader(f"{simulation}") - with pytest.deprecated_call(): + with pytest.warns(UserWarning): s = loader(f"{simulation}v2.0") assert s.sxs_id_stem == simulation s = loader(f"{simulation}", ignore_deprecation=True) assert s.sxs_id_stem == simulation s = loader(f"{simulation}v2.0", ignore_deprecation=True) assert s.sxs_id_stem == simulation - with pytest.deprecated_call(): + with pytest.warns(UserWarning): s = loader(f"{simulation}", auto_supersede=True) assert s.sxs_id_stem != simulation - with pytest.deprecated_call(): + with pytest.warns(UserWarning): s = loader(f"{simulation}v2.0", auto_supersede=True) assert s.sxs_id_stem != simulation s = loader(f"{simulation}", ignore_deprecation=True, auto_supersede=True) @@ -39,7 +39,7 @@ def test_superseded_by_multiple(loader): # simulation that still has multiple simulations. with pytest.raises(ValueError): loader(f"{simulation}") - with pytest.deprecated_call(): + with pytest.warns(UserWarning): s = loader(f"{simulation}v2.0") assert s.sxs_id_stem == simulation s = loader(f"{simulation}", ignore_deprecation=True)