File flexmock-0.11.patch of Package python-cachy

From d6fd558be00e3818d01bd1f6a5290bd094a87e52 Mon Sep 17 00:00:00 2001
From: Stefano Rivera <stefano@rivera.za.net>
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()
 
openSUSE Build Service is sponsored by