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

Method test_12084

Lib/test/test_os/test_windows.py:311–344  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

309 self.assertNotEqual(os.lstat(bytes_link), os.stat(bytes_link))
310
311 def test_12084(self):
312 level1 = os.path.abspath(os_helper.TESTFN)
313 level2 = os.path.join(level1, "level2")
314 level3 = os.path.join(level2, "level3")
315 self.addCleanup(os_helper.rmtree, level1)
316
317 os.mkdir(level1)
318 os.mkdir(level2)
319 os.mkdir(level3)
320
321 file1 = os.path.abspath(os.path.join(level1, "file1"))
322 create_file(file1)
323
324 orig_dir = os.getcwd()
325 try:
326 os.chdir(level2)
327 link = os.path.join(level2, "link")
328 os.symlink(os.path.relpath(file1), "link")
329 self.assertIn("link", os.listdir(os.getcwd()))
330
331 # Check os.stat calls from the same dir as the link
332 self.assertEqual(os.stat(file1), os.stat("link"))
333
334 # Check os.stat calls from a dir below the link
335 os.chdir(level1)
336 self.assertEqual(os.stat(file1),
337 os.stat(os.path.relpath(link)))
338
339 # Check os.stat calls from a dir above the link
340 os.chdir(level3)
341 self.assertEqual(os.stat(file1),
342 os.stat(os.path.relpath(link)))
343 finally:
344 os.chdir(orig_dir)
345
346 @unittest.skipUnless(os.path.lexists(r'C:\Users\All Users')
347 and os.path.exists(r'C:\ProgramData'),

Callers

nothing calls this directly

Calls 9

addCleanupMethod · 0.80
assertInMethod · 0.80
listdirMethod · 0.80
create_fileFunction · 0.70
abspathMethod · 0.45
joinMethod · 0.45
mkdirMethod · 0.45
assertEqualMethod · 0.45
statMethod · 0.45

Tested by

no test coverage detected