mirror of
https://github.com/python/cpython.git
synced 2026-01-06 23:42:34 +00:00
gh-109959: Remove test_glob.test_selflink() (#130551)
The test is not reliable, it fails randomly on Linux: https://github.com/python/cpython/issues/109959#issuecomment-2577550700
This commit is contained in:
parent
2a18e80695
commit
a083633fa0
1 changed files with 0 additions and 58 deletions
|
|
@ -515,63 +515,5 @@ def fn(pat):
|
|||
self.assertEqual(fn('**/*'), r'(?s:(?:.+[/\\])?[^/\\]+)\Z')
|
||||
|
||||
|
||||
@skip_unless_symlink
|
||||
class SymlinkLoopGlobTests(unittest.TestCase):
|
||||
|
||||
# gh-109959: On Linux, glob._isdir() and glob._lexists() can return False
|
||||
# randomly when checking the "link/" symbolic link.
|
||||
# https://github.com/python/cpython/issues/109959#issuecomment-2577550700
|
||||
@unittest.skip("flaky test")
|
||||
def test_selflink(self):
|
||||
tempdir = TESTFN + "_dir"
|
||||
os.makedirs(tempdir)
|
||||
self.addCleanup(shutil.rmtree, tempdir)
|
||||
with change_cwd(tempdir):
|
||||
if support.verbose:
|
||||
cwd = os.getcwd()
|
||||
print(f"cwd: {cwd} ({len(cwd)} chars)")
|
||||
cwdb = os.getcwdb()
|
||||
print(f"cwdb: {cwdb!r} ({len(cwdb)} bytes)")
|
||||
|
||||
os.makedirs('dir')
|
||||
create_empty_file(os.path.join('dir', 'file'))
|
||||
os.symlink(os.curdir, os.path.join('dir', 'link'))
|
||||
|
||||
results = glob.glob('**', recursive=True)
|
||||
self.assertEqual(len(results), len(set(results)))
|
||||
results = set(results)
|
||||
depth = 0
|
||||
while results:
|
||||
path = os.path.join(*(['dir'] + ['link'] * depth))
|
||||
self.assertIn(path, results)
|
||||
results.remove(path)
|
||||
if not results:
|
||||
break
|
||||
path = os.path.join(path, 'file')
|
||||
self.assertIn(path, results)
|
||||
results.remove(path)
|
||||
depth += 1
|
||||
|
||||
results = glob.glob(os.path.join('**', 'file'), recursive=True)
|
||||
self.assertEqual(len(results), len(set(results)))
|
||||
results = set(results)
|
||||
depth = 0
|
||||
while results:
|
||||
path = os.path.join(*(['dir'] + ['link'] * depth + ['file']))
|
||||
self.assertIn(path, results)
|
||||
results.remove(path)
|
||||
depth += 1
|
||||
|
||||
results = glob.glob(os.path.join('**', ''), recursive=True)
|
||||
self.assertEqual(len(results), len(set(results)))
|
||||
results = set(results)
|
||||
depth = 0
|
||||
while results:
|
||||
path = os.path.join(*(['dir'] + ['link'] * depth + ['']))
|
||||
self.assertIn(path, results)
|
||||
results.remove(path)
|
||||
depth += 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue