From 631d5e72c4214d7233498aabc37ba86711d90d1bed4e9008088ec188e50fe38d Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Wed, 29 Nov 2023 12:33:56 +0000 Subject: [PATCH] - Add upstream patch flexmock-0.11.patch to make tests work with latest version of python-flexmock gh#sdispater/cachy#19 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cachy?expand=0&rev=11 --- flexmock-0.11.patch | 148 +++++++++++++++++++++++++++++++++++++++++++ python-cachy.changes | 6 ++ python-cachy.spec | 5 +- 3 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 flexmock-0.11.patch diff --git a/flexmock-0.11.patch b/flexmock-0.11.patch new file mode 100644 index 0000000..e659147 --- /dev/null +++ b/flexmock-0.11.patch @@ -0,0 +1,148 @@ +From d6fd558be00e3818d01bd1f6a5290bd094a87e52 Mon Sep 17 00:00:00 2001 +From: Stefano Rivera +Date: Tue, 9 Nov 2021 23:09:46 -0800 +Subject: [PATCH] No need to teardown flexmock + +flexmock patches unittest to hook tearing down, itself. + +The flexmock_teardown() function is a private API that was moved in +0.11.0. +--- + tests/stores/test_dict_store.py | 5 +---- + tests/stores/test_file_store.py | 4 +--- + tests/stores/test_redis_store.py | 2 -- + tests/test_cache_manager.py | 5 +---- + tests/test_repository.py | 5 +---- + tests/test_tagged_cache.py | 5 +---- + 6 files changed, 5 insertions(+), 21 deletions(-) + +diff --git a/tests/stores/test_dict_store.py b/tests/stores/test_dict_store.py +index b2574a3..8d4171f 100644 +--- a/tests/stores/test_dict_store.py ++++ b/tests/stores/test_dict_store.py +@@ -1,16 +1,13 @@ + # -*- coding: utf-8 -*- + + from unittest import TestCase +-from flexmock import flexmock, flexmock_teardown ++from flexmock import flexmock + + from cachy.stores import DictStore + + + class DictStoreTestCase(TestCase): + +- def tearDown(self): +- flexmock_teardown() +- + def test_items_can_be_set_and_retrieved(self): + store = DictStore() + store.put('foo', 'bar', 10) +diff --git a/tests/stores/test_file_store.py b/tests/stores/test_file_store.py +index 10ab336..704612d 100644 +--- a/tests/stores/test_file_store.py ++++ b/tests/stores/test_file_store.py +@@ -7,7 +7,7 @@ + import shutil + + from unittest import TestCase +-from flexmock import flexmock, flexmock_teardown ++from flexmock import flexmock + + from cachy.serializers import JsonSerializer + from cachy.stores import FileStore +@@ -29,8 +29,6 @@ def tearDown(self): + if os.path.isdir(e): + shutil.rmtree(e) + +- flexmock_teardown() +- + def test_none_is_returned_if_file_doesnt_exist(self): + mock = flexmock(os.path) + mock.should_receive('exists').once().and_return(False) +diff --git a/tests/stores/test_redis_store.py b/tests/stores/test_redis_store.py +index a5009f4..82e1fb4 100644 +--- a/tests/stores/test_redis_store.py ++++ b/tests/stores/test_redis_store.py +@@ -4,7 +4,6 @@ + + import redis + from unittest import TestCase +-from flexmock import flexmock, flexmock_teardown + from fakeredis import FakeServer + from fakeredis import FakeStrictRedis + from cachy.stores import RedisStore +@@ -23,7 +22,6 @@ def setUp(self): + super(RedisStoreTestCase, self).setUp() + + def tearDown(self): +- flexmock_teardown() + self.redis.flushdb() + + def test_get_returns_null_when_not_found(self): +diff --git a/tests/test_cache_manager.py b/tests/test_cache_manager.py +index ae9dda4..b5da411 100644 +--- a/tests/test_cache_manager.py ++++ b/tests/test_cache_manager.py +@@ -3,7 +3,7 @@ + import os + import tempfile + from unittest import TestCase +-from flexmock import flexmock, flexmock_teardown ++from flexmock import flexmock + + from cachy import CacheManager, Repository + from cachy.stores import DictStore, FileStore +@@ -12,9 +12,6 @@ + + class RepositoryTestCase(TestCase): + +- def tearDown(self): +- flexmock_teardown() +- + def test_store_get_the_correct_store(self): + cache = CacheManager({ + 'default': 'dict', +diff --git a/tests/test_repository.py b/tests/test_repository.py +index aeb53b7..f7b3bf5 100644 +--- a/tests/test_repository.py ++++ b/tests/test_repository.py +@@ -2,7 +2,7 @@ + + import datetime + from unittest import TestCase +-from flexmock import flexmock, flexmock_teardown ++from flexmock import flexmock + + from cachy import Repository + from cachy.contracts.store import Store +@@ -10,9 +10,6 @@ + + class RepositoryTestCase(TestCase): + +- def tearDown(self): +- flexmock_teardown() +- + def test_get_returns_value_from_cache(self): + repo = self._get_repository() + repo.get_store().should_receive('get').once().with_args('foo').and_return('bar') +diff --git a/tests/test_tagged_cache.py b/tests/test_tagged_cache.py +index cefdc69..79e986c 100644 +--- a/tests/test_tagged_cache.py ++++ b/tests/test_tagged_cache.py +@@ -7,14 +7,11 @@ + from cachy.tag_set import TagSet + from cachy.redis_tagged_cache import RedisTaggedCache + from datetime import datetime, timedelta +-from flexmock import flexmock, flexmock_teardown ++from flexmock import flexmock + + + class TaggedCacheTestCase(TestCase): + +- def tearDown(self): +- flexmock_teardown() +- + def test_tags_can_be_flushed(self): + store = DictStore() + diff --git a/python-cachy.changes b/python-cachy.changes index 1ed9905..55780c2 100644 --- a/python-cachy.changes +++ b/python-cachy.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Nov 29 12:32:31 UTC 2023 - Daniel Garcia + +- Add upstream patch flexmock-0.11.patch to make tests work with + latest version of python-flexmock gh#sdispater/cachy#19 + ------------------------------------------------------------------- Mon May 8 06:38:22 UTC 2023 - Johannes Kastl diff --git a/python-cachy.spec b/python-cachy.spec index 2025cc4..2176788 100644 --- a/python-cachy.spec +++ b/python-cachy.spec @@ -25,6 +25,8 @@ License: MIT URL: https://github.com/sdispater/cachy Source: https://files.pythonhosted.org/packages/source/c/cachy/cachy-%{version}.tar.gz Patch0: support-pymemcache.patch +# PATCH-FIX-UPSTREAM flexmock-0.11.patch, gh#sdispater/cachy#19 +Patch1: flexmock-0.11.patch BuildRequires: %{python_module fakeredis >= 0.10.2} BuildRequires: %{python_module flexmock >= 0.10.2} BuildRequires: %{python_module msgpack-python >= 0.5} @@ -63,6 +65,7 @@ Cachy provides a caching library. %files %{python_files} %license LICENSE %doc README.rst -%{python_sitelib}/* +%{python_sitelib}/cachy +%{python_sitelib}/cachy-%{version}*-info %changelog