Skip to content

Commit

Permalink
Don't use DeprecationWarning, since it doesn't warn
Browse files Browse the repository at this point in the history
  • Loading branch information
moble committed Aug 6, 2024
1 parent 0699833 commit c2d3af6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion sxs/catalog/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions sxs/simulations/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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}"
Expand Down
8 changes: 4 additions & 4 deletions tests/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit c2d3af6

Please sign in to comment.