@@ -515,63 +515,5 @@ def fn(pat):
515
515
self .assertEqual (fn ('**/*' ), r'(?s:(?:.+[/\\])?[^/\\]+)\Z' )
516
516
517
517
518
- @skip_unless_symlink
519
- class SymlinkLoopGlobTests (unittest .TestCase ):
520
-
521
- # gh-109959: On Linux, glob._isdir() and glob._lexists() can return False
522
- # randomly when checking the "link/" symbolic link.
523
- # https://github.com/python/cpython/issues/109959#issuecomment-2577550700
524
- @unittest .skip ("flaky test" )
525
- def test_selflink (self ):
526
- tempdir = TESTFN + "_dir"
527
- os .makedirs (tempdir )
528
- self .addCleanup (shutil .rmtree , tempdir )
529
- with change_cwd (tempdir ):
530
- if support .verbose :
531
- cwd = os .getcwd ()
532
- print (f"cwd: { cwd } ({ len (cwd )} chars)" )
533
- cwdb = os .getcwdb ()
534
- print (f"cwdb: { cwdb !r} ({ len (cwdb )} bytes)" )
535
-
536
- os .makedirs ('dir' )
537
- create_empty_file (os .path .join ('dir' , 'file' ))
538
- os .symlink (os .curdir , os .path .join ('dir' , 'link' ))
539
-
540
- results = glob .glob ('**' , recursive = True )
541
- self .assertEqual (len (results ), len (set (results )))
542
- results = set (results )
543
- depth = 0
544
- while results :
545
- path = os .path .join (* (['dir' ] + ['link' ] * depth ))
546
- self .assertIn (path , results )
547
- results .remove (path )
548
- if not results :
549
- break
550
- path = os .path .join (path , 'file' )
551
- self .assertIn (path , results )
552
- results .remove (path )
553
- depth += 1
554
-
555
- results = glob .glob (os .path .join ('**' , 'file' ), recursive = True )
556
- self .assertEqual (len (results ), len (set (results )))
557
- results = set (results )
558
- depth = 0
559
- while results :
560
- path = os .path .join (* (['dir' ] + ['link' ] * depth + ['file' ]))
561
- self .assertIn (path , results )
562
- results .remove (path )
563
- depth += 1
564
-
565
- results = glob .glob (os .path .join ('**' , '' ), recursive = True )
566
- self .assertEqual (len (results ), len (set (results )))
567
- results = set (results )
568
- depth = 0
569
- while results :
570
- path = os .path .join (* (['dir' ] + ['link' ] * depth + ['' ]))
571
- self .assertIn (path , results )
572
- results .remove (path )
573
- depth += 1
574
-
575
-
576
518
if __name__ == "__main__" :
577
519
unittest .main ()
0 commit comments