MCPcopy Index your code
hub / github.com/python/cpython / test_rmtree_works_on_junctions

Method test_rmtree_works_on_junctions

Lib/test/test_shutil.py:296–315  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

294
295 @unittest.skipUnless(_winapi, 'only relevant on Windows')
296 def test_rmtree_works_on_junctions(self):
297 tmp = self.mkdtemp()
298 dir1 = os.path.join(tmp, 'dir1')
299 dir2 = os.path.join(dir1, 'dir2')
300 dir3 = os.path.join(tmp, 'dir3')
301 for d in dir1, dir2, dir3:
302 os.mkdir(d)
303 file1 = os.path.join(tmp, 'file1')
304 create_file(file1, 'foo')
305 link1 = os.path.join(dir1, 'link1')
306 _winapi.CreateJunction(dir2, link1)
307 link2 = os.path.join(dir1, 'link2')
308 _winapi.CreateJunction(dir3, link2)
309 link3 = os.path.join(dir1, 'link3')
310 _winapi.CreateJunction(file1, link3)
311 # make sure junctions are removed but not followed
312 shutil.rmtree(dir1)
313 self.assertFalse(os.path.exists(dir1))
314 self.assertTrue(os.path.exists(dir3))
315 self.assertTrue(os.path.exists(file1))
316
317 def test_rmtree_errors(self):
318 # filename is guaranteed not to exist

Callers

nothing calls this directly

Calls 7

mkdtempMethod · 0.80
assertFalseMethod · 0.80
assertTrueMethod · 0.80
create_fileFunction · 0.70
joinMethod · 0.45
mkdirMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected