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

Method test_attributes

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

Source from the content-addressed store, hash-verified

5132
5133 @unittest.skipIf(sys.platform == "linux", "TODO: RUSTPYTHON; flaky test")
5134 def test_attributes(self):
5135 link = os_helper.can_hardlink()
5136 symlink = os_helper.can_symlink()
5137
5138 dirname = os.path.join(self.path, "dir")
5139 os.mkdir(dirname)
5140 filename = self.create_file("file.txt")
5141 if link:
5142 try:
5143 os.link(filename, os.path.join(self.path, "link_file.txt"))
5144 except PermissionError as e:
5145 self.skipTest('os.link(): %s' % e)
5146 if symlink:
5147 os.symlink(dirname, os.path.join(self.path, "symlink_dir"),
5148 target_is_directory=True)
5149 os.symlink(filename, os.path.join(self.path, "symlink_file.txt"))
5150
5151 names = ['dir', 'file.txt']
5152 if link:
5153 names.append('link_file.txt')
5154 if symlink:
5155 names.extend(('symlink_dir', 'symlink_file.txt'))
5156 entries = self.get_entries(names)
5157
5158 entry = entries['dir']
5159 self.check_entry(entry, 'dir', True, False, False)
5160
5161 entry = entries['file.txt']
5162 self.check_entry(entry, 'file.txt', False, True, False)
5163
5164 if link:
5165 entry = entries['link_file.txt']
5166 self.check_entry(entry, 'link_file.txt', False, True, False)
5167
5168 if symlink:
5169 entry = entries['symlink_dir']
5170 self.check_entry(entry, 'symlink_dir', True, False, True)
5171
5172 entry = entries['symlink_file.txt']
5173 self.check_entry(entry, 'symlink_file.txt', False, True, True)
5174
5175 @unittest.skipIf(sys.platform != 'win32', "Can only test junctions with creation on win32.")
5176 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