diff options
author | Michael Foord <michael@voidspace.org.uk> | 2012-06-10 19:36:32 (GMT) |
---|---|---|
committer | Michael Foord <michael@voidspace.org.uk> | 2012-06-10 19:36:32 (GMT) |
commit | f7c41580578fdae4f8ab6c8eb6135902de5214d1 (patch) | |
tree | 8528e1d98410b12e7f8f0dd7aaad3f9c6f4404c4 /Lib/unittest/test | |
parent | bfcb42936bc53ff094d93db01a4fc9b78735f955 (diff) | |
download | cpython-f7c41580578fdae4f8ab6c8eb6135902de5214d1.zip cpython-f7c41580578fdae4f8ab6c8eb6135902de5214d1.tar.gz cpython-f7c41580578fdae4f8ab6c8eb6135902de5214d1.tar.bz2 |
Adding patch.stopall method to unittest.mock
Diffstat (limited to 'Lib/unittest/test')
-rw-r--r-- | Lib/unittest/test/testmock/testpatch.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/unittest/test/testmock/testpatch.py b/Lib/unittest/test/testmock/testpatch.py index 6256855..c1091b4 100644 --- a/Lib/unittest/test/testmock/testpatch.py +++ b/Lib/unittest/test/testmock/testpatch.py @@ -1762,6 +1762,24 @@ class PatchTest(unittest.TestCase): p.stop() + def test_patch_stopall(self): + unlink = os.unlink + chdir = os.chdir + path = os.path + patch('os.unlink', something).start() + patch('os.chdir', something_else).start() + + @patch('os.path') + def patched(mock_path): + patch.stopall() + self.assertIs(os.path, mock_path) + self.assertIs(os.unlink, unlink) + self.assertIs(os.chdir, chdir) + + patched() + self.assertIs(os.path, path) + + if __name__ == '__main__': unittest.main() |