MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_ordered_recursion

Method test_ordered_recursion

Lib/test/test_tarfile.py:1485–1505  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1483 # mock the following:
1484 # os.listdir: so we know that files are in the wrong order
1485 def test_ordered_recursion(self):
1486 path = os.path.join(TEMPDIR, "directory")
1487 os.mkdir(path)
1488 open(os.path.join(path, "1"), "a").close()
1489 open(os.path.join(path, "2"), "a").close()
1490 try:
1491 tar = tarfile.open(tmpname, self.mode)
1492 try:
1493 with unittest.mock.patch('os.listdir') as mock_listdir:
1494 mock_listdir.return_value = ["2", "1"]
1495 tar.add(path)
1496 paths = []
1497 for m in tar.getmembers():
1498 paths.append(os.path.split(m.name)[-1])
1499 self.assertEqual(paths, ["directory", "1", "2"]);
1500 finally:
1501 tar.close()
1502 finally:
1503 os_helper.unlink(os.path.join(path, "1"))
1504 os_helper.unlink(os.path.join(path, "2"))
1505 os_helper.rmdir(path)
1506
1507 def test_gettarinfo_pathlike_name(self):
1508 with tarfile.open(tmpname, self.mode) as tar:

Callers

nothing calls this directly

Calls 12

getmembersMethod · 0.80
rmdirMethod · 0.80
openFunction · 0.50
joinMethod · 0.45
mkdirMethod · 0.45
closeMethod · 0.45
openMethod · 0.45
addMethod · 0.45
appendMethod · 0.45
splitMethod · 0.45
assertEqualMethod · 0.45
unlinkMethod · 0.45

Tested by

no test coverage detected