MCPcopy Create free account
hub / github.com/catboost/catboost / test_hardlink_or_copy

Function test_hardlink_or_copy

library/python/fs/test/test_fs.py:967–985  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

965
966@pytest.mark.skipif(not library.python.windows.on_win(), reason='Test hardlinks on windows')
967def test_hardlink_or_copy():
968 max_allowed_hard_links = 1023
969
970 def run(hardlink_function, dir):
971 src = r"test.txt"
972 with open(src, "w") as f:
973 f.write("test")
974 for i in range(max_allowed_hard_links + 1):
975 hardlink_function(src, os.path.join(dir, "{}.txt".format(i)))
976
977 dir1 = library.python.fs.create_dirs("one")
978 with pytest.raises(WindowsError) as e:
979 run(library.python.fs.hardlink, dir1)
980 assert e.value.winerror == 1142
981 assert len(os.listdir(dir1)) == max_allowed_hard_links
982
983 dir2 = library.python.fs.create_dirs("two")
984 run(library.python.fs.hardlink_or_copy, dir2)
985 assert len(os.listdir(dir2)) == max_allowed_hard_links + 1
986
987
988def test_remove_tree_unicode():

Callers

nothing calls this directly

Calls 2

lenFunction · 0.85
runFunction · 0.70

Tested by

no test coverage detected