aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrbean-bremen <hansemrbean@googlemail.com>2021-08-29 19:35:28 +0200
committermrbean-bremen <hansemrbean@googlemail.com>2021-08-29 19:35:28 +0200
commitc403e3decd7493c00c2c1d92ecfe94dab7aef900 (patch)
tree5c564951e9d4a62393efa3a705b29cfc9bc9a688
parentca9a35686b20a2a43dc5ede526eec185e9e4cd31 (diff)
downloadpyfakefs-c403e3decd7493c00c2c1d92ecfe94dab7aef900.tar.gz
Fix handling of use_known_patches=False
- used to cause an exception
-rw-r--r--CHANGES.md1
-rw-r--r--pyfakefs/fake_filesystem_unittest.py2
2 files changed, 3 insertions, 0 deletions
diff --git a/CHANGES.md b/CHANGES.md
index ea56898..b689173 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -12,6 +12,7 @@ The released versions correspond to PyPi releases.
(see [#627](../../issues/627))
* handle `pathlib.Path.owner()` and `pathlib.Path.group` by returning
the current user/group name (see [#629](../../issues/629))
+* fixed handling of `use_known_patches=False` (could cause an exception)
### Infrastructure
* added test dependency check (see [#608](../../issues/608))
diff --git a/pyfakefs/fake_filesystem_unittest.py b/pyfakefs/fake_filesystem_unittest.py
index 81a948d..ce5e003 100644
--- a/pyfakefs/fake_filesystem_unittest.py
+++ b/pyfakefs/fake_filesystem_unittest.py
@@ -485,6 +485,8 @@ class Patcher:
for name, fake_module in modules_to_patch.items():
self._fake_module_classes[name] = fake_module
patched_module_names = set(modules_to_patch)
+ else:
+ patched_module_names = set()
clear_cache = not use_cache
if use_cache:
if patched_module_names != self.PATCHED_MODULE_NAMES: