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):
1131
1131
1132
1132
# mock the following:
1133
1133
# 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 ):
1136
1135
path = os .path .join (TEMPDIR , "directory" )
1137
1136
os .mkdir (path )
1138
1137
open (os .path .join (path , "1" ), "a" ).close ()
1139
1138
open (os .path .join (path , "2" ), "a" ).close ()
1140
- mock_listdir .return_value = ["2" , "1" ]
1141
1139
try :
1142
1140
tar = tarfile .open (tmpname , self .mode )
1143
1141
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 )
1145
1145
paths = []
1146
1146
for m in tar .getmembers ():
1147
1147
paths .append (os .path .split (m .name )[- 1 ])
You can’t perform that action at this time.
0 commit comments