Skip to content

Commit add56dd

Browse files
authored
Update Deprecating Warning with version number. (#560)
* Update Deprecating Warning with version number. Adding the versing number make it slightly easier on consumers to update to the new naming as they will get a sens of compatibility. Also update pytest to fail is any deprecation warning are not marked in the test suite, and catch them in more places. In particular we realise that many more places trigger the warnings in create_store so we catch the warning there, but also that `pickle.load()` can trigger it. * Try to limit Deprecationwarnigs to zarr
1 parent 670b9fb commit add56dd

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
[pytest]
22
doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS IGNORE_EXCEPTION_DETAIL
33
addopts = --durations=10
4+
filterwarnings =
5+
error::DeprecationWarning:zarr.*
46

zarr/storage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,8 +660,8 @@ def clear(self):
660660
class DictStore(MemoryStore):
661661

662662
def __init__(self, *args, **kwargs):
663-
warnings.warn("DictStore has been renamed to MemoryStore and will be "
664-
"removed in the future. Please use MemoryStore.",
663+
warnings.warn("DictStore has been renamed to MemoryStore in 2.4.0 and "
664+
"will be removed in the future. Please use MemoryStore.",
665665
DeprecationWarning,
666666
stacklevel=2)
667667
super(DictStore, self).__init__(*args, **kwargs)

zarr/tests/test_storage.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -764,13 +764,18 @@ def test_setdel(self):
764764
class TestDictStore(StoreTests, unittest.TestCase):
765765

766766
def create_store(self):
767-
return DictStore()
767+
with pytest.warns(DeprecationWarning):
768+
return DictStore()
768769

769770
def test_deprecated(self):
770-
with pytest.warns(DeprecationWarning):
771-
store = self.create_store()
771+
store = self.create_store()
772772
assert isinstance(store, MemoryStore)
773773

774+
def test_pickle(self):
775+
with pytest.warns(DeprecationWarning):
776+
# pickle.load() will also trigger deprecation warning
777+
super().test_pickle()
778+
774779

775780
class TestDirectoryStore(StoreTests, unittest.TestCase):
776781

0 commit comments

Comments
 (0)