We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 39ed40e + ba4ddcf commit 8e0a2acCopy full SHA for 8e0a2ac
2 files changed
mockito/mockito.py
@@ -360,6 +360,8 @@ def unstub(*objs):
360
361
if objs:
362
for obj in objs:
363
+ if isinstance(obj, str):
364
+ obj = get_obj(obj)
365
mock_registry.unstub(obj)
366
else:
367
mock_registry.unstub_all()
tests/modulefunctions_test.py
@@ -36,6 +36,15 @@ def testUnstubs(self):
36
unstub()
37
self.assertEqual(False, os.path.exists("test"))
38
39
+ def testUnstubsByDottedPath(self):
40
+ when("os.path").exists("test").thenReturn(True)
41
+
42
+ self.assertEqual(True, os.path.exists("test"))
43
44
+ unstub("os.path")
45
46
+ self.assertEqual(False, os.path.exists("test"))
47
48
def testStubs(self):
49
when(os.path).exists("test").thenReturn(True)
50
0 commit comments