@@ -164,7 +164,7 @@ def test_1():
164164 child .expect (r"collecting 2 items" )
165165 child .expect (r"collected 2 items" )
166166 rest = child .read ().decode ("utf8" )
167- assert "2 passed in" in rest
167+ assert "= \x1b [32m \x1b [1m2 passed\x1b [0m \x1b [32m in" in rest
168168
169169 def test_itemreport_subclasses_show_subclassed_file (self , testdir ):
170170 testdir .makepyfile (
@@ -1252,42 +1252,123 @@ def test_failure():
12521252 # dict value, not the actual contents, so tuples of anything
12531253 # suffice
12541254 # Important statuses -- the highest priority of these always wins
1255- ("red" , "1 failed" , {"failed" : (1 ,)}),
1256- ("red" , "1 failed, 1 passed" , {"failed" : (1 ,), "passed" : (1 ,)}),
1257- ("red" , "1 error" , {"error" : (1 ,)}),
1258- ("red" , "1 passed, 1 error" , {"error" : (1 ,), "passed" : (1 ,)}),
1255+ ("red" , [("1 failed" , {"bold" : True , "red" : True })], {"failed" : (1 ,)}),
1256+ (
1257+ "red" ,
1258+ [
1259+ ("1 failed" , {"bold" : True , "red" : True }),
1260+ ("1 passed" , {"bold" : False , "green" : True }),
1261+ ],
1262+ {"failed" : (1 ,), "passed" : (1 ,)},
1263+ ),
1264+ ("red" , [("1 error" , {"bold" : True , "red" : True })], {"error" : (1 ,)}),
1265+ (
1266+ "red" ,
1267+ [
1268+ ("1 passed" , {"bold" : False , "green" : True }),
1269+ ("1 error" , {"bold" : True , "red" : True }),
1270+ ],
1271+ {"error" : (1 ,), "passed" : (1 ,)},
1272+ ),
12591273 # (a status that's not known to the code)
1260- ("yellow" , "1 weird" , {"weird" : (1 ,)}),
1261- ("yellow" , "1 passed, 1 weird" , {"weird" : (1 ,), "passed" : (1 ,)}),
1262- ("yellow" , "1 warnings" , {"warnings" : (1 ,)}),
1263- ("yellow" , "1 passed, 1 warnings" , {"warnings" : (1 ,), "passed" : (1 ,)}),
1264- ("green" , "5 passed" , {"passed" : (1 , 2 , 3 , 4 , 5 )}),
1274+ ("yellow" , [("1 weird" , {"bold" : True , "yellow" : True })], {"weird" : (1 ,)}),
1275+ (
1276+ "yellow" ,
1277+ [
1278+ ("1 passed" , {"bold" : False , "green" : True }),
1279+ ("1 weird" , {"bold" : True , "yellow" : True }),
1280+ ],
1281+ {"weird" : (1 ,), "passed" : (1 ,)},
1282+ ),
1283+ (
1284+ "yellow" ,
1285+ [("1 warnings" , {"bold" : True , "yellow" : True })],
1286+ {"warnings" : (1 ,)},
1287+ ),
1288+ (
1289+ "yellow" ,
1290+ [
1291+ ("1 passed" , {"bold" : False , "green" : True }),
1292+ ("1 warnings" , {"bold" : True , "yellow" : True }),
1293+ ],
1294+ {"warnings" : (1 ,), "passed" : (1 ,)},
1295+ ),
1296+ (
1297+ "green" ,
1298+ [("5 passed" , {"bold" : True , "green" : True })],
1299+ {"passed" : (1 , 2 , 3 , 4 , 5 )},
1300+ ),
12651301 # "Boring" statuses. These have no effect on the color of the summary
12661302 # line. Thus, if *every* test has a boring status, the summary line stays
12671303 # at its default color, i.e. yellow, to warn the user that the test run
12681304 # produced no useful information
1269- ("yellow" , "1 skipped" , {"skipped" : (1 ,)}),
1270- ("green" , "1 passed, 1 skipped" , {"skipped" : (1 ,), "passed" : (1 ,)}),
1271- ("yellow" , "1 deselected" , {"deselected" : (1 ,)}),
1272- ("green" , "1 passed, 1 deselected" , {"deselected" : (1 ,), "passed" : (1 ,)}),
1273- ("yellow" , "1 xfailed" , {"xfailed" : (1 ,)}),
1274- ("green" , "1 passed, 1 xfailed" , {"xfailed" : (1 ,), "passed" : (1 ,)}),
1275- ("yellow" , "1 xpassed" , {"xpassed" : (1 ,)}),
1276- ("green" , "1 passed, 1 xpassed" , {"xpassed" : (1 ,), "passed" : (1 ,)}),
1305+ ("yellow" , [("1 skipped" , {"bold" : True , "yellow" : True })], {"skipped" : (1 ,)}),
1306+ (
1307+ "green" ,
1308+ [
1309+ ("1 passed" , {"bold" : True , "green" : True }),
1310+ ("1 skipped" , {"bold" : False , "yellow" : True }),
1311+ ],
1312+ {"skipped" : (1 ,), "passed" : (1 ,)},
1313+ ),
1314+ (
1315+ "yellow" ,
1316+ [("1 deselected" , {"bold" : True , "yellow" : True })],
1317+ {"deselected" : (1 ,)},
1318+ ),
1319+ (
1320+ "green" ,
1321+ [
1322+ ("1 passed" , {"bold" : True , "green" : True }),
1323+ ("1 deselected" , {"bold" : False , "yellow" : True }),
1324+ ],
1325+ {"deselected" : (1 ,), "passed" : (1 ,)},
1326+ ),
1327+ ("yellow" , [("1 xfailed" , {"bold" : True , "yellow" : True })], {"xfailed" : (1 ,)}),
1328+ (
1329+ "green" ,
1330+ [
1331+ ("1 passed" , {"bold" : True , "green" : True }),
1332+ ("1 xfailed" , {"bold" : False , "yellow" : True }),
1333+ ],
1334+ {"xfailed" : (1 ,), "passed" : (1 ,)},
1335+ ),
1336+ ("yellow" , [("1 xpassed" , {"bold" : True , "yellow" : True })], {"xpassed" : (1 ,)}),
1337+ (
1338+ "green" ,
1339+ [
1340+ ("1 passed" , {"bold" : True , "green" : True }),
1341+ ("1 xpassed" , {"bold" : False , "yellow" : True }),
1342+ ],
1343+ {"xpassed" : (1 ,), "passed" : (1 ,)},
1344+ ),
12771345 # Likewise if no tests were found at all
1278- ("yellow" , "no tests ran" , {}),
1346+ ("yellow" , [( "no tests ran" , { "yellow" : True })] , {}),
12791347 # Test the empty-key special case
1280- ("yellow" , "no tests ran" , {"" : (1 ,)}),
1281- ("green" , "1 passed" , {"" : (1 ,), "passed" : (1 ,)}),
1348+ ("yellow" , [("no tests ran" , {"yellow" : True })], {"" : (1 ,)}),
1349+ (
1350+ "green" ,
1351+ [("1 passed" , {"bold" : True , "green" : True })],
1352+ {"" : (1 ,), "passed" : (1 ,)},
1353+ ),
12821354 # A couple more complex combinations
12831355 (
12841356 "red" ,
1285- "1 failed, 2 passed, 3 xfailed" ,
1357+ [
1358+ ("1 failed" , {"bold" : True , "red" : True }),
1359+ ("2 passed" , {"bold" : False , "green" : True }),
1360+ ("3 xfailed" , {"bold" : False , "yellow" : True }),
1361+ ],
12861362 {"passed" : (1 , 2 ), "failed" : (1 ,), "xfailed" : (1 , 2 , 3 )},
12871363 ),
12881364 (
12891365 "green" ,
1290- "1 passed, 2 skipped, 3 deselected, 2 xfailed" ,
1366+ [
1367+ ("1 passed" , {"bold" : True , "green" : True }),
1368+ ("2 skipped" , {"bold" : False , "yellow" : True }),
1369+ ("3 deselected" , {"bold" : False , "yellow" : True }),
1370+ ("2 xfailed" , {"bold" : False , "yellow" : True }),
1371+ ],
12911372 {
12921373 "passed" : (1 ,),
12931374 "skipped" : (1 , 2 ),
@@ -1313,11 +1394,11 @@ class DummyReport(BaseReport):
13131394 r1 = DummyReport ()
13141395 r2 = DummyReport ()
13151396 res = build_summary_stats_line ({"failed" : (r1 , r2 )})
1316- assert res == ("2 failed" , "red" )
1397+ assert res == ([( "2 failed" , { "bold" : True , "red" : True })] , "red" )
13171398
13181399 r1 .count_towards_summary = False
13191400 res = build_summary_stats_line ({"failed" : (r1 , r2 )})
1320- assert res == ("1 failed" , "red" )
1401+ assert res == ([( "1 failed" , { "bold" : True , "red" : True })] , "red" )
13211402
13221403
13231404class TestClassicOutputStyle :
0 commit comments