cachetools 7.0.2__tar.gz → 7.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. {cachetools-7.0.2 → cachetools-7.0.3}/CHANGELOG.rst +7 -0
  2. {cachetools-7.0.2/src/cachetools.egg-info → cachetools-7.0.3}/PKG-INFO +1 -1
  3. {cachetools-7.0.2 → cachetools-7.0.3}/src/cachetools/__init__.py +1 -1
  4. {cachetools-7.0.2 → cachetools-7.0.3}/src/cachetools/_cachedmethod.py +6 -1
  5. {cachetools-7.0.2 → cachetools-7.0.3/src/cachetools.egg-info}/PKG-INFO +1 -1
  6. {cachetools-7.0.2 → cachetools-7.0.3}/tests/test_cachedmethod.py +10 -0
  7. {cachetools-7.0.2 → cachetools-7.0.3}/LICENSE +0 -0
  8. {cachetools-7.0.2 → cachetools-7.0.3}/MANIFEST.in +0 -0
  9. {cachetools-7.0.2 → cachetools-7.0.3}/README.rst +0 -0
  10. {cachetools-7.0.2 → cachetools-7.0.3}/docs/conf.py +0 -0
  11. {cachetools-7.0.2 → cachetools-7.0.3}/docs/index.rst +0 -0
  12. {cachetools-7.0.2 → cachetools-7.0.3}/pyproject.toml +0 -0
  13. {cachetools-7.0.2 → cachetools-7.0.3}/setup.cfg +0 -0
  14. {cachetools-7.0.2 → cachetools-7.0.3}/src/cachetools/_cached.py +0 -0
  15. {cachetools-7.0.2 → cachetools-7.0.3}/src/cachetools/func.py +0 -0
  16. {cachetools-7.0.2 → cachetools-7.0.3}/src/cachetools/keys.py +0 -0
  17. {cachetools-7.0.2 → cachetools-7.0.3}/src/cachetools.egg-info/SOURCES.txt +0 -0
  18. {cachetools-7.0.2 → cachetools-7.0.3}/src/cachetools.egg-info/dependency_links.txt +0 -0
  19. {cachetools-7.0.2 → cachetools-7.0.3}/src/cachetools.egg-info/top_level.txt +0 -0
  20. {cachetools-7.0.2 → cachetools-7.0.3}/tests/__init__.py +0 -0
  21. {cachetools-7.0.2 → cachetools-7.0.3}/tests/test_cache.py +0 -0
  22. {cachetools-7.0.2 → cachetools-7.0.3}/tests/test_cached.py +0 -0
  23. {cachetools-7.0.2 → cachetools-7.0.3}/tests/test_classmethod.py +0 -0
  24. {cachetools-7.0.2 → cachetools-7.0.3}/tests/test_fifo.py +0 -0
  25. {cachetools-7.0.2 → cachetools-7.0.3}/tests/test_func.py +0 -0
  26. {cachetools-7.0.2 → cachetools-7.0.3}/tests/test_keys.py +0 -0
  27. {cachetools-7.0.2 → cachetools-7.0.3}/tests/test_lfu.py +0 -0
  28. {cachetools-7.0.2 → cachetools-7.0.3}/tests/test_lru.py +0 -0
  29. {cachetools-7.0.2 → cachetools-7.0.3}/tests/test_rr.py +0 -0
  30. {cachetools-7.0.2 → cachetools-7.0.3}/tests/test_threading.py +0 -0
  31. {cachetools-7.0.2 → cachetools-7.0.3}/tests/test_tlru.py +0 -0
  32. {cachetools-7.0.2 → cachetools-7.0.3}/tests/test_ttl.py +0 -0
  33. {cachetools-7.0.2 → cachetools-7.0.3}/tox.ini +0 -0
@@ -1,3 +1,10 @@
1
+ v7.0.3 (2026-03-05)
2
+ ===================
3
+
4
+ - Fix ``DeprecationWarning`` when creating an autospec mock with
5
+ ``@cachedmethod`` decorations.
6
+
7
+
1
8
  v7.0.2 (2026-03-02)
2
9
  ===================
3
10
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cachetools
3
- Version: 7.0.2
3
+ Version: 7.0.3
4
4
  Summary: Extensible memoizing collections and decorators
5
5
  Author-email: Thomas Kemmer <tkemmer@computer.org>
6
6
  Maintainer-email: Thomas Kemmer <tkemmer@computer.org>
@@ -12,7 +12,7 @@ __all__ = (
12
12
  "cachedmethod",
13
13
  )
14
14
 
15
- __version__ = "7.0.2"
15
+ __version__ = "7.0.3"
16
16
 
17
17
  import collections
18
18
  import collections.abc
@@ -77,7 +77,12 @@ class _DescriptorBase:
77
77
 
78
78
  def __get__(self, obj, objtype=None):
79
79
  wrapper = self.Wrapper(obj)
80
- if self.__attrname is not None:
80
+ if obj is None:
81
+ # Return the wrapper itself without modification when accessed
82
+ # through the class to support class-level introspection, such
83
+ # as for mocking with autospec=True in unittest.mock.
84
+ pass
85
+ elif self.__attrname is not None:
81
86
  # replace descriptor instance with wrapper in instance dict
82
87
  try:
83
88
  # In case of a race condition where another thread already replaced
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cachetools
3
- Version: 7.0.2
3
+ Version: 7.0.3
4
4
  Summary: Extensible memoizing collections and decorators
5
5
  Author-email: Thomas Kemmer <tkemmer@computer.org>
6
6
  Maintainer-email: Thomas Kemmer <tkemmer@computer.org>
@@ -1,4 +1,5 @@
1
1
  import unittest
2
+ import unittest.mock
2
3
  import warnings
3
4
 
4
5
 
@@ -673,3 +674,12 @@ class NoneMethodTest(unittest.TestCase):
673
674
 
674
675
  with self.assertRaises(TypeError):
675
676
  wrapper.cache_info()
677
+
678
+
679
+ class AutospecTest(unittest.TestCase):
680
+ def test_autospec_no_warnings(self):
681
+
682
+ with warnings.catch_warnings(record=True) as w:
683
+ warnings.simplefilter("always")
684
+ unittest.mock.create_autospec(Cached, instance=True)
685
+ self.assertEqual(len(w), 0)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes