File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -1131,17 +1131,17 @@ def test_directory_size(self):
11311131
11321132 # mock the following:
11331133 # os.listdir: so we know that files are in the wrong order
1134- @unittest .mock .patch ('os.listdir' )
1135- def test_ordered_recursion (self , mock_listdir ):
1134+ def test_ordered_recursion (self ):
11361135 path = os .path .join (TEMPDIR , "directory" )
11371136 os .mkdir (path )
11381137 open (os .path .join (path , "1" ), "a" ).close ()
11391138 open (os .path .join (path , "2" ), "a" ).close ()
1140- mock_listdir .return_value = ["2" , "1" ]
11411139 try :
11421140 tar = tarfile .open (tmpname , self .mode )
11431141 try :
1144- tar .add (path )
1142+ with unittest .mock .patch ('os.listdir' ) as mock_listdir :
1143+ mock_listdir .return_value = ["2" , "1" ]
1144+ tar .add (path )
11451145 paths = []
11461146 for m in tar .getmembers ():
11471147 paths .append (os .path .split (m .name )[- 1 ])
You can’t perform that action at this time.
0 commit comments