@@ -1580,52 +1580,35 @@ class DummyPathWalkTest(unittest.TestCase):
15801580    can_symlink  =  False 
15811581
15821582    def  setUp (self ):
1583-         # Build: 
1584-         #     TESTFN/ 
1585-         #       TEST1/              a file kid and two directory kids 
1586-         #         tmp1 
1587-         #         SUB1/             a file kid and a directory kid 
1588-         #           tmp2 
1589-         #           SUB11/          no kids 
1590-         #         SUB2/             a file kid and a dirsymlink kid 
1591-         #           tmp3 
1592-         #           link/           a symlink to TEST2 
1593-         #           broken_link 
1594-         #           broken_link2 
1595-         #       TEST2/ 
1596-         #         tmp4              a lone file 
15971583        self .walk_path  =  self .cls (self .base , "TEST1" )
15981584        self .sub1_path  =  self .walk_path  /  "SUB1" 
15991585        self .sub11_path  =  self .sub1_path  /  "SUB11" 
16001586        self .sub2_path  =  self .walk_path  /  "SUB2" 
1601-         tmp1_path  =  self .walk_path  /  "tmp1" 
1602-         tmp2_path  =  self .sub1_path  /  "tmp2" 
1603-         tmp3_path  =  self .sub2_path  /  "tmp3" 
16041587        self .link_path  =  self .sub2_path  /  "link" 
1605-         t2_path  =  self .cls (self .base , "TEST2" )
1606-         tmp4_path  =  self .cls (self .base , "TEST2" , "tmp4" )
1607-         broken_link_path  =  self .sub2_path  /  "broken_link" 
1608-         broken_link2_path  =  self .sub2_path  /  "broken_link2" 
1609- 
1610-         self .sub11_path .mkdir (parents = True )
1611-         self .sub2_path .mkdir (parents = True )
1612-         t2_path .mkdir (parents = True )
1613- 
1614-         for  path  in  tmp1_path , tmp2_path , tmp3_path , tmp4_path :
1615-             with  path .open ("w" , encoding = 'utf-8' ) as  f :
1616-                 f .write (f"I'm { path } \n " )
1588+         self .sub2_tree  =  (self .sub2_path , [], ["tmp3" ])
1589+         self .createTestHierarchy ()
16171590
1618-         if  self .can_symlink :
1619-             self .link_path .symlink_to (t2_path , target_is_directory = True )
1620-             broken_link_path .symlink_to ('broken' )
1621-             broken_link2_path .symlink_to (self .cls ('tmp3' , 'broken' ))
1622-             self .sub2_tree  =  (self .sub2_path , [], ["broken_link" , "broken_link2" , "link" , "tmp3" ])
1623-         else :
1624-             self .sub2_tree  =  (self .sub2_path , [], ["tmp3" ])
1591+     def  createTestHierarchy (self ):
1592+         cls  =  self .cls 
1593+         cls ._files  =  {
1594+             f'{ self .base }  : b'this is tmp1\n ' ,
1595+             f'{ self .base }  : b'this is tmp2\n ' ,
1596+             f'{ self .base }  : b'this is tmp3\n ' ,
1597+             f'{ self .base }  : b'this is tmp4\n ' ,
1598+         }
1599+         cls ._directories  =  {
1600+             f'{ self .base }  : {'TEST1' , 'TEST2' },
1601+             f'{ self .base }  : {'SUB1' , 'SUB2' , 'tmp1' },
1602+             f'{ self .base }  : {'SUB11' , 'tmp2' },
1603+             f'{ self .base }  : set (),
1604+             f'{ self .base }  : {'tmp3' },
1605+             f'{ self .base }  : {'tmp4' },
1606+         }
16251607
16261608    def  tearDown (self ):
1627-         base  =  self .cls (self .base )
1628-         base ._delete ()
1609+         cls  =  self .cls 
1610+         cls ._files .clear ()
1611+         cls ._directories .clear ()
16291612
16301613    def  test_walk_topdown (self ):
16311614        walker  =  self .walk_path .walk ()
0 commit comments