diff options
author | mrbean-bremen <hansemrbean@googlemail.com> | 2021-08-29 19:35:28 +0200 |
---|---|---|
committer | mrbean-bremen <hansemrbean@googlemail.com> | 2021-08-29 19:35:28 +0200 |
commit | c403e3decd7493c00c2c1d92ecfe94dab7aef900 (patch) | |
tree | 5c564951e9d4a62393efa3a705b29cfc9bc9a688 | |
parent | ca9a35686b20a2a43dc5ede526eec185e9e4cd31 (diff) | |
download | pyfakefs-c403e3decd7493c00c2c1d92ecfe94dab7aef900.tar.gz |
Fix handling of use_known_patches=False
- used to cause an exception
-rw-r--r-- | CHANGES.md | 1 | ||||
-rw-r--r-- | pyfakefs/fake_filesystem_unittest.py | 2 |
2 files changed, 3 insertions, 0 deletions
@@ -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: |