bpo-30693: Fix tarfile test cleanup on MSWindows (#5557)
it was using our mocked listdir to check when the files were gone.
This commit is contained in:
parent
c1e46e94de
commit
4ad703b7ca
@ -1131,16 +1131,16 @@ class WriteTest(WriteTestBase, unittest.TestCase):
|
|||||||
|
|
||||||
# mock the following:
|
# mock the following:
|
||||||
# os.listdir: so we know that files are in the wrong order
|
# os.listdir: so we know that files are in the wrong order
|
||||||
@unittest.mock.patch('os.listdir')
|
def test_ordered_recursion(self):
|
||||||
def test_ordered_recursion(self, mock_listdir):
|
|
||||||
path = os.path.join(TEMPDIR, "directory")
|
path = os.path.join(TEMPDIR, "directory")
|
||||||
os.mkdir(path)
|
os.mkdir(path)
|
||||||
open(os.path.join(path, "1"), "a").close()
|
open(os.path.join(path, "1"), "a").close()
|
||||||
open(os.path.join(path, "2"), "a").close()
|
open(os.path.join(path, "2"), "a").close()
|
||||||
mock_listdir.return_value = ["2", "1"]
|
|
||||||
try:
|
try:
|
||||||
tar = tarfile.open(tmpname, self.mode)
|
tar = tarfile.open(tmpname, self.mode)
|
||||||
try:
|
try:
|
||||||
|
with unittest.mock.patch('os.listdir') as mock_listdir:
|
||||||
|
mock_listdir.return_value = ["2", "1"]
|
||||||
tar.add(path)
|
tar.add(path)
|
||||||
paths = []
|
paths = []
|
||||||
for m in tar.getmembers():
|
for m in tar.getmembers():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user