@@ -1157,10 +1157,9 @@ def test_invalid_fast_validate(self):
11571157 os .remove (j (self .tmpdir , "data" , "loc" , "2478433644_2839c5e8b8_o_d.jpg" ))
11581158 testargs = ["bagit.py" , "--validate" , "--completeness-only" , self .tmpdir ]
11591159
1160- with self .assertLogs () as captured :
1161- with self .assertRaises (SystemExit ) as cm :
1162- with mock .patch .object (sys , "argv" , testargs ):
1163- bagit .main ()
1160+ with self .assertLogs () as captured , self .assertRaises (SystemExit ) as cm :
1161+ with mock .patch .object (sys , "argv" , testargs ):
1162+ bagit .main ()
11641163
11651164 self .assertEqual (cm .exception .code , 1 )
11661165 self .assertIn (
@@ -1172,10 +1171,9 @@ def test_valid_fast_validate(self):
11721171 bagit .make_bag (self .tmpdir )
11731172 testargs = ["bagit.py" , "--validate" , "--fast" , self .tmpdir ]
11741173
1175- with self .assertLogs () as captured :
1176- with self .assertRaises (SystemExit ) as cm :
1177- with mock .patch .object (sys , "argv" , testargs ):
1178- bagit .main ()
1174+ with self .assertLogs () as captured , self .assertRaises (SystemExit ) as cm :
1175+ with mock .patch .object (sys , "argv" , testargs ):
1176+ bagit .main ()
11791177
11801178 self .assertEqual (cm .exception .code , 0 )
11811179 self .assertEqual (
@@ -1206,10 +1204,9 @@ def test_invalid_completeness_validate(self):
12061204
12071205 testargs = ["bagit.py" , "--validate" , "--completeness-only" , self .tmpdir ]
12081206
1209- with self .assertLogs () as captured :
1210- with self .assertRaises (SystemExit ) as cm :
1211- with mock .patch .object (sys , "argv" , testargs ):
1212- bagit .main ()
1207+ with self .assertLogs () as captured , self .assertRaises (SystemExit ) as cm :
1208+ with mock .patch .object (sys , "argv" , testargs ):
1209+ bagit .main ()
12131210
12141211 self .assertEqual (cm .exception .code , 1 )
12151212 self .assertIn (
@@ -1221,10 +1218,9 @@ def test_valid_completeness_validate(self):
12211218 bagit .make_bag (self .tmpdir )
12221219 testargs = ["bagit.py" , "--validate" , "--completeness-only" , self .tmpdir ]
12231220
1224- with self .assertLogs () as captured :
1225- with self .assertRaises (SystemExit ) as cm :
1226- with mock .patch .object (sys , "argv" , testargs ):
1227- bagit .main ()
1221+ with self .assertLogs () as captured , self .assertRaises (SystemExit ) as cm :
1222+ with mock .patch .object (sys , "argv" , testargs ):
1223+ bagit .main ()
12281224
12291225 self .assertEqual (cm .exception .code , 0 )
12301226 self .assertEqual (
@@ -1242,10 +1238,9 @@ def test_invalid_full_validate(self):
12421238
12431239 testargs = ["bagit.py" , "--validate" , self .tmpdir ]
12441240
1245- with self .assertLogs () as captured :
1246- with self .assertRaises (SystemExit ) as cm :
1247- with mock .patch .object (sys , "argv" , testargs ):
1248- bagit .main ()
1241+ with self .assertLogs () as captured , self .assertRaises (SystemExit ) as cm :
1242+ with mock .patch .object (sys , "argv" , testargs ):
1243+ bagit .main ()
12491244
12501245 self .assertEqual (cm .exception .code , 1 )
12511246 self .assertIn ("Bag validation failed" , captured .records [- 1 ].getMessage ())
@@ -1254,10 +1249,9 @@ def test_valid_full_validate(self):
12541249 bagit .make_bag (self .tmpdir )
12551250 testargs = ["bagit.py" , "--validate" , self .tmpdir ]
12561251
1257- with self .assertLogs () as captured :
1258- with self .assertRaises (SystemExit ) as cm :
1259- with mock .patch .object (sys , "argv" , testargs ):
1260- bagit .main ()
1252+ with self .assertLogs () as captured , self .assertRaises (SystemExit ) as cm :
1253+ with mock .patch .object (sys , "argv" , testargs ):
1254+ bagit .main ()
12611255
12621256 self .assertEqual (cm .exception .code , 0 )
12631257 self .assertEqual ("%s is valid" % self .tmpdir , captured .records [- 1 ].getMessage ())
@@ -1267,10 +1261,9 @@ def test_failed_create_bag(self):
12671261
12681262 testargs = ["bagit.py" , self .tmpdir ]
12691263
1270- with self .assertLogs () as captured :
1271- with self .assertRaises (SystemExit ) as cm :
1272- with mock .patch .object (sys , "argv" , testargs ):
1273- bagit .main ()
1264+ with self .assertLogs () as captured , self .assertRaises (SystemExit ) as cm :
1265+ with mock .patch .object (sys , "argv" , testargs ):
1266+ bagit .main ()
12741267
12751268 self .assertEqual (cm .exception .code , 1 )
12761269 self .assertIn (
@@ -1281,10 +1274,9 @@ def test_failed_create_bag(self):
12811274 def test_create_bag (self ):
12821275 testargs = ["bagit.py" , self .tmpdir ]
12831276
1284- with self .assertLogs () as captured :
1285- with self .assertRaises (SystemExit ) as cm :
1286- with mock .patch .object (sys , "argv" , testargs ):
1287- bagit .main ()
1277+ with self .assertLogs () as captured , self .assertRaises (SystemExit ) as cm :
1278+ with mock .patch .object (sys , "argv" , testargs ):
1279+ bagit .main ()
12881280
12891281 for rec in captured .records :
12901282 print (rec .getMessage ())
0 commit comments