File tree 4 files changed +21
-2
lines changed
4 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ Mark Abramowitz
43
43
Martijn Faassen
44
44
Nicolas Delaby
45
45
Piotr Banaszkiewicz
46
+ Punyashloka Biswal
46
47
Ralf Schmitt
47
48
Ronny Pfannschmidt
48
49
Ross Lawley
Original file line number Diff line number Diff line change 1
1
2.8.0.dev (compared to 2.7.X)
2
2
-----------------------------
3
3
4
+ - fix issue713: JUnit XML reports for doctest failures.
5
+ Thanks Punyashloka Biswal.
6
+
4
7
- Include setup and teardown in junitxml test durations.
5
8
Thanks Janne Vanhala.
6
9
Original file line number Diff line number Diff line change @@ -123,10 +123,12 @@ def append_failure(self, report):
123
123
Junit .skipped (message = "xfail-marked test passes unexpectedly" ))
124
124
self .skipped += 1
125
125
else :
126
- if isinstance (report .longrepr , (unicode , str )):
126
+ if hasattr (report .longrepr , "reprcrash" ):
127
+ message = report .longrepr .reprcrash .message
128
+ elif isinstance (report .longrepr , (unicode , str )):
127
129
message = report .longrepr
128
130
else :
129
- message = report .longrepr . reprcrash . message
131
+ message = str ( report .longrepr )
130
132
message = bin_xml_escape (message )
131
133
fail = Junit .failure (message = message )
132
134
fail .append (bin_xml_escape (report .longrepr ))
Original file line number Diff line number Diff line change @@ -352,3 +352,16 @@ def add_one(x):
352
352
reprec = testdir .inline_run (p , "--doctest-modules" ,
353
353
"--doctest-ignore-import-errors" )
354
354
reprec .assertoutcome (skipped = 1 , failed = 1 , passed = 0 )
355
+
356
+ def test_junit_report_for_doctest (self , testdir ):
357
+ p = testdir .makepyfile ("""
358
+ def foo():
359
+ '''
360
+ >>> 1 + 1
361
+ 3
362
+ '''
363
+ pass
364
+ """ )
365
+ reprec = testdir .inline_run (p , "--doctest-modules" ,
366
+ "--junit-xml=junit.xml" )
367
+ reprec .assertoutcome (failed = 1 )
You can’t perform that action at this time.
0 commit comments