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

Method test_hardlink_to

Lib/test/test_pathlib/test_pathlib.py:2278–2293  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2276
2277 @os_helper.skip_unless_hardlink
2278 def test_hardlink_to(self):
2279 P = self.cls(self.base)
2280 target = P / 'fileA'
2281 size = target.stat().st_size
2282 # linking to another path.
2283 link = P / 'dirA' / 'fileAA'
2284 link.hardlink_to(target)
2285 self.assertEqual(link.stat().st_size, size)
2286 self.assertTrue(os.path.samefile(target, link))
2287 self.assertTrue(target.exists())
2288 # Linking to a str of a relative path.
2289 link2 = P / 'dirA' / 'fileAAA'
2290 target2 = self.parser.join(TESTFN, 'fileA')
2291 link2.hardlink_to(target2)
2292 self.assertEqual(os.stat(target2).st_size, size)
2293 self.assertTrue(link2.exists())
2294
2295 @unittest.skipIf(hasattr(os, "link"), "os.link() is present")
2296 def test_hardlink_to_unsupported(self):

Callers

nothing calls this directly

Calls 8

hardlink_toMethod · 0.80
assertTrueMethod · 0.80
samefileMethod · 0.80
clsMethod · 0.45
statMethod · 0.45
assertEqualMethod · 0.45
existsMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected