You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some of our tests for warnings currently fail when run using an old version of pytest. The problem appears to be that we rely on pytest.warns() accepting subclasses rather exact matches.
This was fixed upstream in pytest (pytest-dev/pytest#2166), but we still should specify the more specific warning types in xarray.
=================================== FAILURES ===================================
_________________ TestEncodeCFVariable.test_missing_fillvalue __________________
self = <xarray.tests.test_conventions.TestEncodeCFVariable testMethod=test_missing_fillvalue>
def test_missing_fillvalue(self):
v = Variable(['x'], np.array([np.nan, 1, 2, 3]))
v.encoding = {'dtype': 'int16'}
with pytest.warns(Warning, match='floating point data as an integer'):
> conventions.encode_cf_variable(v)
E Failed: DID NOT WARN
tests/test_conventions.py:89: Failed
________________________________ TestAlias.test ________________________________
self = <xarray.tests.test_utils.TestAlias testMethod=test>
def test(self):
def new_method():
pass
old_method = utils.alias(new_method, 'old_method')
assert 'deprecated' in old_method.__doc__
with pytest.warns(Warning, match='deprecated'):
> old_method()
E Failed: DID NOT WARN
tests/test_utils.py:28: Failed
___________________ TestIndexVariable.test_coordinate_alias ____________________
self = <xarray.tests.test_variable.TestIndexVariable testMethod=test_coordinate_alias>
def test_coordinate_alias(self):
with pytest.warns(Warning, match='deprecated'):
> x = Coordinate('x', [1, 2, 3])
E Failed: DID NOT WARN
tests/test_variable.py:1752: Failed
__________________________ TestAccessor.test_register __________________________
self = <xarray.tests.test_extensions.TestAccessor testMethod=test_register>
def test_register(self):
@xr.register_dataset_accessor('demo')
@xr.register_dataarray_accessor('demo')
class DemoAccessor(object):
"""Demo accessor."""
def __init__(self, xarray_obj):
self._obj = xarray_obj
@property
def foo(self):
return 'bar'
ds = xr.Dataset()
assert ds.demo.foo == 'bar'
da = xr.DataArray(0)
assert da.demo.foo == 'bar'
# accessor is cached
assert ds.demo is ds.demo
# check descriptor
assert ds.demo.__doc__ == "Demo accessor."
assert xr.Dataset.demo.__doc__ == "Demo accessor."
assert isinstance(ds.demo, DemoAccessor)
assert xr.Dataset.demo is DemoAccessor
# ensure we can remove it
del xr.Dataset.demo
assert not hasattr(xr.Dataset, 'demo')
with pytest.warns(Warning, match='overriding a preexisting attribute'):
@xr.register_dataarray_accessor('demo')
> class Foo(object):
E Failed: DID NOT WARN
tests/test_extensions.py:60: Failed
The text was updated successfully, but these errors were encountered:
Some of our tests for warnings currently fail when run using an old version of pytest. The problem appears to be that we rely on pytest.warns() accepting subclasses rather exact matches.
This was fixed upstream in pytest (pytest-dev/pytest#2166), but we still should specify the more specific warning types in xarray.
The text was updated successfully, but these errors were encountered: