Skip to content

Commit

Permalink
fix the pytest.warns(None) deprecation.
Browse files Browse the repository at this point in the history
  • Loading branch information
KathleenLabrie authored and Olesja Smirnova committed Feb 5, 2024
1 parent 30ec0d9 commit 8f2f902
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion astrodata/tests/test_nddata.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import warnings

import numpy as np
import pytest
from numpy.testing import assert_array_almost_equal, assert_array_equal
Expand Down Expand Up @@ -93,7 +95,7 @@ def test_uncertainty_negative_numbers():
arr = np.zeros(5)

# No warning if all 0
with pytest.warns(None) as w:
with warnings.catch_warnings(record=True) as w:
ADVarianceUncertainty(arr)
assert len(w) == 0

Expand Down
4 changes: 3 additions & 1 deletion astrodata/tests/test_object_construction.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import warnings

import astrodata
import astropy.units as u
import numpy as np
Expand Down Expand Up @@ -294,7 +296,7 @@ def test_table_with_units(tmp_path):
ad[0].TABLE1 = Table([[1]])
ad[0].TABLE1['col0'].unit = 'mag(cm2 electron / erg)'

with pytest.warns(None) as w:
with warnings.catch_warnings(record=True) as w:
ad.write(testfile)

assert len(w) == 0
Expand Down

0 comments on commit 8f2f902

Please sign in to comment.