@@ -490,7 +490,6 @@ def test_frozenzet(self):
490
490
assert len (expl ) > 1
491
491
492
492
def test_Sequence (self ):
493
-
494
493
if not hasattr (collections_abc , "MutableSequence" ):
495
494
pytest .skip ("cannot import MutableSequence" )
496
495
MutableSequence = collections_abc .MutableSequence
@@ -806,9 +805,6 @@ def test_fmt_multi_newline_before_where(self):
806
805
807
806
808
807
class TestTruncateExplanation :
809
-
810
- """ Confirm assertion output is truncated as expected """
811
-
812
808
# The number of lines in the truncation explanation message. Used
813
809
# to calculate that results have the expected length.
814
810
LINES_IN_TRUNCATION_MSG = 2
@@ -969,7 +965,13 @@ def test_hello():
969
965
)
970
966
result = testdir .runpytest ()
971
967
result .stdout .fnmatch_lines (
972
- ["*def test_hello():*" , "*assert x == y*" , "*E*Extra items*left*" , "*E*50*" ]
968
+ [
969
+ "*def test_hello():*" ,
970
+ "*assert x == y*" ,
971
+ "*E*Extra items*left*" ,
972
+ "*E*50*" ,
973
+ "*= 1 failed in*" ,
974
+ ]
973
975
)
974
976
975
977
@@ -1302,3 +1304,23 @@ def raise_exit(obj):
1302
1304
1303
1305
with pytest .raises (outcomes .Exit , match = "Quitting debugger" ):
1304
1306
callequal (1 , 1 )
1307
+
1308
+
1309
+ def test_assertion_location_with_coverage (testdir ):
1310
+ """This used to report the wrong location when run with coverage (#5754)."""
1311
+ p = testdir .makepyfile (
1312
+ """
1313
+ def test():
1314
+ assert False, 1
1315
+ assert False, 2
1316
+ """
1317
+ )
1318
+ result = testdir .runpytest (str (p ))
1319
+ result .stdout .fnmatch_lines (
1320
+ [
1321
+ "> assert False, 1" ,
1322
+ "E AssertionError: 1" ,
1323
+ "E assert False" ,
1324
+ "*= 1 failed in*" ,
1325
+ ]
1326
+ )
0 commit comments