Skip to content

Commit 44d5441

Browse files
committed
TST: Update for pytest 7
Remove 36 PytestRemovedIn8Warning and PytestReturnNotNoneWarning warnings.
1 parent 27a2d22 commit 44d5441

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

probscale/tests/test_algo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def test__bs_fit(plot_data, fitlogs, known_lo, known_hi):
121121

122122

123123
class Test__estimate_from_fit(object):
124-
def setup(self):
124+
def setup_method(self):
125125
self.x = numpy.arange(1, 11, 0.5)
126126
self.slope = 2
127127
self.intercept = 3.5

probscale/tests/test_probscale.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import warnings
23

34
import numpy
45
import matplotlib.pyplot as plt
@@ -120,16 +121,16 @@ def test_minimal_norm_cdf(mn, mn_input):
120121

121122

122123
def test_sign_with_nan_no_warning(mn):
123-
with pytest.warns(None) as record:
124+
with warnings.catch_warnings():
125+
warnings.simplefilter("error")
124126
res = mn._approx_erf(numpy.nan)
125-
assert not record
126127
assert numpy.isnan(res)
127128

128129

129130
def test_sign_with_nan_no_warning_inv(mn):
130-
with pytest.warns(None) as record:
131+
with warnings.catch_warnings():
132+
warnings.simplefilter("error")
131133
res = mn._approx_inv_erf(numpy.nan)
132-
assert not record
133134
assert numpy.isnan(res)
134135

135136

probscale/tests/test_viz.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def plot_data():
7272

7373

7474
class Test_fit_line(object):
75-
def setup(self):
75+
def setup_method(self):
7676
self.data = numpy.array(
7777
[
7878
2.00,
@@ -454,7 +454,7 @@ def test_custom_xhat(self):
454454

455455

456456
class Test_plot_pos(object):
457-
def setup(self):
457+
def setup_method(self):
458458
self.data = numpy.arange(16)
459459

460460
self.known_type4 = numpy.array(
@@ -740,7 +740,6 @@ def test_probplot_prob(plot_data):
740740
fig, ax = plt.subplots()
741741
fig = viz.probplot(plot_data, ax=ax, problabel="Test xlabel", datascale="log")
742742
assert isinstance(fig, plt.Figure)
743-
return fig
744743

745744

746745
@pytest.mark.mpl_image_compare(baseline_dir=BASELINE_DIR, tolerance=TIGHT_TOLERANCE)
@@ -1026,7 +1025,6 @@ def test_probplot_test_results(plot_data):
10261025
assert isinstance(results, dict)
10271026
known_keys = sorted(["q", "x", "y", "xhat", "yhat", "res"])
10281027
assert sorted(list(results.keys())) == known_keys
1029-
return fig
10301028

10311029

10321030
@pytest.mark.parametrize("probax", ["x", "y"])

0 commit comments

Comments
 (0)