Open mgorny opened 2 months ago
When running the test suite with Python 3.13.0b2, I'm getting the following failures (all tests pass with 3.12):
$ python -m pytest --ignore tests/performance/ ========================================================= test session starts ========================================================= platform linux -- Python 3.13.0b2, pytest-8.2.2, pluggy-1.5.0 rootdir: /tmp/aiocache configfile: setup.cfg testpaths: tests/ plugins: mock-3.14.0, asyncio-0.23.7, cov-5.0.0 asyncio: mode=Mode.AUTO collected 801 items tests/acceptance/test_base.py .......................................................................................... [ 11%] tests/acceptance/test_decorators.py ............................................. [ 16%] tests/acceptance/test_factory.py ....... [ 17%] tests/acceptance/test_lock.py ................................................F...... [ 24%] tests/acceptance/test_plugins.py ............. [ 26%] tests/acceptance/test_serializers.py .......................................................................................... [ 37%] ..................................................................................................................... [ 52%] tests/ut/backends/test_memcached.py ............................................ [ 57%] tests/ut/backends/test_memory.py ................................ [ 61%] tests/ut/backends/test_redis.py ................................... [ 65%] tests/ut/test_base.py .................................................................................... [ 76%] tests/ut/test_decorators.py .................F..............................F.............. [ 84%] tests/ut/test_exceptions.py . [ 84%] tests/ut/test_factory.py ........................................... [ 89%] tests/ut/test_lock.py .............. [ 91%] tests/ut/test_plugins.py ....... [ 92%] tests/ut/test_serializers.py ............................................................. [100%] ============================================================== FAILURES =============================================================== ___________________________________ TestOptimisticLock.test_check_and_set_with_int_ttl[redis_cache] ___________________________________ self = <tests.acceptance.test_lock.TestOptimisticLock object at 0x7fc3fbc26ed0>, cache = RedisCache (127.0.0.1:6379) lock = <aiocache.lock.OptimisticLock object at 0x7fc3fb44ed50> async def test_check_and_set_with_int_ttl(self, cache, lock): await cache.set(Keys.KEY, "previous_value") async with lock as locked: await locked.cas("value", ttl=1) await asyncio.sleep(1) > assert await cache.get(Keys.KEY) is None E AssertionError: assert 'value' is None tests/acceptance/test_lock.py:237: AssertionError _________________________________________ TestCached.test_cache_write_doesnt_wait_for_future __________________________________________ self = <AsyncMock name='set_in_cache' spec='method' id='140479709116608'>, args = ("stub()[('value', 'value')]", 'value'), kwargs = {} msg = "Expected 'set_in_cache' to be called once. Called 0 times." def assert_called_once_with(self, /, *args, **kwargs): """assert that the mock was called exactly once and that that call was with the specified arguments.""" if not self.call_count == 1: msg = ("Expected '%s' to be called once. Called %s times.%s" % (self._mock_name or 'mock', self.call_count, self._calls_repr())) > raise AssertionError(msg) E AssertionError: Expected 'set_in_cache' to be called once. Called 0 times. /usr/lib/python3.13/unittest/mock.py:985: AssertionError During handling of the above exception, another exception occurred: self = <tests.ut.test_decorators.TestCached object at 0x7fc3fb732200> mocker = <pytest_mock.plugin.MockerFixture object at 0x7fc3fb1ba680>, decorator = <aiocache.decorators.cached object at 0x7fc3fb318680> decorator_call = <function stub at 0x7fc3fa619120> async def test_cache_write_doesnt_wait_for_future(self, mocker, decorator, decorator_call): mocker.spy(decorator, "set_in_cache") with patch.object(decorator, "get_from_cache", autospec=True, return_value=None): with patch("aiocache.decorators.asyncio.ensure_future", autospec=True): await decorator_call(aiocache_wait_for_write=False, value="value") decorator.set_in_cache.assert_not_awaited() > decorator.set_in_cache.assert_called_once_with("stub()[('value', 'value')]", "value") tests/ut/test_decorators.py:172: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = ("stub()[('value', 'value')]", 'value'), kwargs = {} def assert_called_once_with(*args, **kwargs): > return mock.assert_called_once_with(*args, **kwargs) E AssertionError: Expected 'set_in_cache' to be called once. Called 0 times. /usr/lib/python3.13/unittest/mock.py:244: AssertionError _______________________________________ TestMultiCached.test_cache_write_doesnt_wait_for_future _______________________________________ self = <AsyncMock name='set_in_cache' spec='method' id='140479685000032'> args = ({'a': <ANY>, 'b': <ANY>}, <function stub_dict at 0x7fc3faa8ce00>, <ANY>, <ANY>), kwargs = {} msg = "Expected 'set_in_cache' to be called once. Called 0 times." def assert_called_once_with(self, /, *args, **kwargs): """assert that the mock was called exactly once and that that call was with the specified arguments.""" if not self.call_count == 1: msg = ("Expected '%s' to be called once. Called %s times.%s" % (self._mock_name or 'mock', self.call_count, self._calls_repr())) > raise AssertionError(msg) E AssertionError: Expected 'set_in_cache' to be called once. Called 0 times. /usr/lib/python3.13/unittest/mock.py:985: AssertionError During handling of the above exception, another exception occurred: self = <tests.ut.test_decorators.TestMultiCached object at 0x7fc3fb732360> mocker = <pytest_mock.plugin.MockerFixture object at 0x7fc3fb1c2d00> decorator = <aiocache.decorators.multi_cached object at 0x7fc3fa378c00>, decorator_call = <function stub_dict at 0x7fc3fa46b6a0> async def test_cache_write_doesnt_wait_for_future(self, mocker, decorator, decorator_call): mocker.spy(decorator, "set_in_cache") with patch.object(decorator, "get_from_cache", autospec=True, return_value=[None, None]): with patch("aiocache.decorators.asyncio.ensure_future", autospec=True): await decorator_call(1, keys=["a", "b"], value="value", aiocache_wait_for_write=False) decorator.set_in_cache.assert_not_awaited() > decorator.set_in_cache.assert_called_once_with({"a": ANY, "b": ANY}, stub_dict, ANY, ANY) tests/ut/test_decorators.py:483: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = ({'a': <ANY>, 'b': <ANY>}, <function stub_dict at 0x7fc3faa8ce00>, <ANY>, <ANY>), kwargs = {} def assert_called_once_with(*args, **kwargs): > return mock.assert_called_once_with(*args, **kwargs) E AssertionError: Expected 'set_in_cache' to be called once. Called 0 times. /usr/lib/python3.13/unittest/mock.py:244: AssertionError ----------- coverage: platform linux, python 3.13.0-beta-2 ----------- Name Stmts Miss Cover ----------------------------------------------------------- aiocache/__init__.py 24 4 83% aiocache/backends/__init__.py 0 0 100% aiocache/backends/memcached.py 99 0 100% aiocache/backends/memory.py 86 0 100% aiocache/backends/redis.py 107 0 100% aiocache/base.py 275 2 99% aiocache/decorators.py 164 0 100% aiocache/exceptions.py 2 0 100% aiocache/factory.py 101 0 100% aiocache/lock.py 52 0 100% aiocache/plugins.py 47 0 100% aiocache/serializers/__init__.py 10 2 80% aiocache/serializers/serializers.py 66 3 95% tests/__init__.py 0 0 100% tests/acceptance/__init__.py 0 0 100% tests/acceptance/conftest.py 26 0 100% tests/acceptance/test_base.py 180 0 100% tests/acceptance/test_decorators.py 148 0 100% tests/acceptance/test_factory.py 35 0 100% tests/acceptance/test_lock.py 209 0 100% tests/acceptance/test_plugins.py 43 0 100% tests/acceptance/test_serializers.py 112 0 100% tests/conftest.py 12 0 100% tests/performance/__init__.py 0 0 100% tests/performance/conftest.py 11 11 0% tests/performance/server.py 37 37 0% tests/performance/test_concurrency.py 27 27 0% tests/performance/test_footprint.py 107 107 0% tests/ut/__init__.py 0 0 100% tests/ut/backends/__init__.py 0 0 100% tests/ut/backends/test_memcached.py 192 0 100% tests/ut/backends/test_memory.py 158 0 100% tests/ut/backends/test_redis.py 138 0 100% tests/ut/conftest.py 40 0 100% tests/ut/test_base.py 414 0 100% tests/ut/test_decorators.py 399 1 99% tests/ut/test_exceptions.py 3 0 100% tests/ut/test_factory.py 163 4 98% tests/ut/test_lock.py 87 0 100% tests/ut/test_plugins.py 58 0 100% tests/ut/test_serializers.py 118 0 100% tests/utils.py 47 2 96% ----------------------------------------------------------- TOTAL 3797 200 95% ======================================================= short test summary info ======================================================= FAILED tests/acceptance/test_lock.py::TestOptimisticLock::test_check_and_set_with_int_ttl[redis_cache] - AssertionError: assert 'value' is None FAILED tests/ut/test_decorators.py::TestCached::test_cache_write_doesnt_wait_for_future - AssertionError: Expected 'set_in_cache' to be called once. Called 0 times. FAILED tests/ut/test_decorators.py::TestMultiCached::test_cache_write_doesnt_wait_for_future - AssertionError: Expected 'set_in_cache' to be called once. Called 0 times. ============================================== 3 failed, 798 passed in 116.84s (0:01:56) ==============================================
I think it's fixed in #864, if you can figure out how to ignore the warning.
Unless I'm doing something wrong, I seem to be still getting the same result on top of Dreamsorcerer-patch-3 branch.
Dreamsorcerer-patch-3
When running the test suite with Python 3.13.0b2, I'm getting the following failures (all tests pass with 3.12):