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

Method test_attributes

Lib/test/test_os/test_os.py:4858–4897  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4856 os.name == 'nt')
4857
4858 def test_attributes(self):
4859 link = os_helper.can_hardlink()
4860 symlink = os_helper.can_symlink()
4861
4862 dirname = os.path.join(self.path, "dir")
4863 os.mkdir(dirname)
4864 filename = self.create_file("file.txt")
4865 if link:
4866 try:
4867 os.link(filename, os.path.join(self.path, "link_file.txt"))
4868 except PermissionError as e:
4869 self.skipTest('os.link(): %s' % e)
4870 if symlink:
4871 os.symlink(dirname, os.path.join(self.path, "symlink_dir"),
4872 target_is_directory=True)
4873 os.symlink(filename, os.path.join(self.path, "symlink_file.txt"))
4874
4875 names = ['dir', 'file.txt']
4876 if link:
4877 names.append('link_file.txt')
4878 if symlink:
4879 names.extend(('symlink_dir', 'symlink_file.txt'))
4880 entries = self.get_entries(names)
4881
4882 entry = entries['dir']
4883 self.check_entry(entry, 'dir', True, False, False)
4884
4885 entry = entries['file.txt']
4886 self.check_entry(entry, 'file.txt', False, True, False)
4887
4888 if link:
4889 entry = entries['link_file.txt']
4890 self.check_entry(entry, 'link_file.txt', False, True, False)
4891
4892 if symlink:
4893 entry = entries['symlink_dir']
4894 self.check_entry(entry, 'symlink_dir', True, False, True)
4895
4896 entry = entries['symlink_file.txt']
4897 self.check_entry(entry, 'symlink_file.txt', False, True, True)
4898
4899 @unittest.skipIf(sys.platform != 'win32', "Can only test junctions with creation on win32.")
4900 def test_attributes_junctions(self):

Callers

nothing calls this directly

Calls 8

create_fileMethod · 0.95
get_entriesMethod · 0.95
check_entryMethod · 0.95
skipTestMethod · 0.80
joinMethod · 0.45
mkdirMethod · 0.45
appendMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected