Skip to content
Permalink
Browse files

bpo-30693: Fix tarfile test cleanup on MSWindows (#5557)

it was using our mocked listdir to check when the files were gone.
  • Loading branch information...
bmwiedemann authored and serhiy-storchaka committed Feb 6, 2018
1 parent c1e46e9 commit 4ad703b7ca463d1183539277dde90ffb1c808487
Showing with 4 additions and 4 deletions.
  1. +4 −4 Lib/test/test_tarfile.py
@@ -1131,17 +1131,17 @@ def test_directory_size(self):

# 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])

0 comments on commit 4ad703b

Please sign in to comment.
You can’t perform that action at this time.