Skip to content

Commit 54dc125

Browse files
committed
assertWarns is more involved
1 parent b42a2e6 commit 54dc125

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

xarray/tests/test_extensions.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import xarray as xr
1010

1111
from . import TestCase, raises_regex
12-
import pytest
1312

1413

1514
@xr.register_dataset_accessor('example_accessor')
@@ -53,7 +52,7 @@ def foo(self):
5352
del xr.Dataset.demo
5453
assert not hasattr(xr.Dataset, 'demo')
5554

56-
with pytest.warns('overriding a preexisting attribute'):
55+
with self.assertWarns('overriding a preexisting attribute'):
5756
@xr.register_dataarray_accessor('demo')
5857
class Foo(object):
5958
pass

xarray/tests/test_utils.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
13
from __future__ import absolute_import
24
from __future__ import division
35
from __future__ import print_function
@@ -18,7 +20,7 @@ def new_method():
1820
pass
1921
old_method = utils.alias(new_method, 'old_method')
2022
assert 'deprecated' in old_method.__doc__
21-
with pytest.warns('deprecated'):
23+
with self.assertWarns('deprecated'):
2224
old_method()
2325

2426

xarray/tests/test_variable.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1697,7 +1697,7 @@ def test_concat_multiindex(self):
16971697
assert isinstance(actual.to_index(), pd.MultiIndex)
16981698

16991699
def test_coordinate_alias(self):
1700-
with pytest.warns('deprecated'):
1700+
with self.assertWarns('deprecated'):
17011701
x = Coordinate('x', [1, 2, 3])
17021702
assert isinstance(x, IndexVariable)
17031703

0 commit comments

Comments
 (0)