diff options
author | Bernhard M. Wiedemann <githubbmw@lsmod.de> | 2018-02-06 18:08:53 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-02-06 18:08:53 (GMT) |
commit | 4ad703b7ca463d1183539277dde90ffb1c808487 (patch) | |
tree | a4cad3e17f0fc7e150da34d222419212f1ef7c6e /Lib/test/test_tarfile.py | |
parent | c1e46e94de38a92f98736af9a42d89c3975a9919 (diff) | |
download | cpython-4ad703b7ca463d1183539277dde90ffb1c808487.zip cpython-4ad703b7ca463d1183539277dde90ffb1c808487.tar.gz cpython-4ad703b7ca463d1183539277dde90ffb1c808487.tar.bz2 |
bpo-30693: Fix tarfile test cleanup on MSWindows (#5557)
it was using our mocked listdir to check when the files were gone.
Diffstat (limited to 'Lib/test/test_tarfile.py')
-rw-r--r-- | Lib/test/test_tarfile.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py index 8ef4294..b868326 100644 --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -1131,17 +1131,17 @@ class WriteTest(WriteTestBase, unittest.TestCase): # mock the following: # os.listdir: so we know that files are in the wrong order - @unittest.mock.patch('os.listdir') - def test_ordered_recursion(self, mock_listdir): + def test_ordered_recursion(self): path = os.path.join(TEMPDIR, "directory") os.mkdir(path) open(os.path.join(path, "1"), "a").close() open(os.path.join(path, "2"), "a").close() - mock_listdir.return_value = ["2", "1"] try: tar = tarfile.open(tmpname, self.mode) try: - tar.add(path) + with unittest.mock.patch('os.listdir') as mock_listdir: + mock_listdir.return_value = ["2", "1"] + tar.add(path) paths = [] for m in tar.getmembers(): paths.append(os.path.split(m.name)[-1]) |