diff options
Diffstat (limited to 'mock/tests/support.py')
-rw-r--r-- | mock/tests/support.py | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/mock/tests/support.py b/mock/tests/support.py index d57a372..85fd0a3 100644 --- a/mock/tests/support.py +++ b/mock/tests/support.py @@ -1,7 +1,6 @@ import contextlib import sys - target = {'foo': 'FOO'} @@ -29,9 +28,7 @@ def uncache(*names): """ for name in names: - if name in ('sys', 'marshal', 'imp'): - raise ValueError( - "cannot uncache {0}".format(name)) + assert name not in ('sys', 'marshal', 'imp') try: del sys.modules[name] except KeyError: @@ -40,7 +37,16 @@ def uncache(*names): yield finally: for name in names: - try: - del sys.modules[name] - except KeyError: - pass + del sys.modules[name] + + +class _ALWAYS_EQ: + """ + Object that is equal to anything. + """ + def __eq__(self, other): + return True + def __ne__(self, other): + return False + +ALWAYS_EQ = _ALWAYS_EQ() |