File tree Expand file tree Collapse file tree 4 files changed +34
-0
lines changed Expand file tree Collapse file tree 4 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ Erik M. Bray
35
35
Florian Bruhin
36
36
Floris Bruynooghe
37
37
Gabriel Reis
38
+ Georgy Dyuldin
38
39
Graham Horler
39
40
Grig Gheorghiu
40
41
Guido Wesdorp
Original file line number Diff line number Diff line change 26
26
- fix #628: fixed internal UnicodeDecodeError when doctests contain unicode.
27
27
Thanks Jason R. Coombs for the report and Bruno Oliveira for the PR.
28
28
29
+ - fix #1334: Add captured stdout to jUnit XML report on setup error.
30
+ Thanks Georgy Dyuldin for the PR.
31
+
29
32
30
33
2.8.5
31
34
-----
Original file line number Diff line number Diff line change @@ -163,6 +163,7 @@ def append_collect_skipped(self, report):
163
163
def append_error (self , report ):
164
164
self ._add_simple (
165
165
Junit .error , "test setup failure" , report .longrepr )
166
+ self ._write_captured_output (report )
166
167
167
168
def append_skipped (self , report ):
168
169
if hasattr (report , "wasxfail" ):
Original file line number Diff line number Diff line change @@ -419,6 +419,35 @@ def test_pass():
419
419
systemout = pnode .find_first_by_tag ("system-err" )
420
420
assert "hello-stderr" in systemout .toxml ()
421
421
422
+ def test_setup_error_captures_stdout (self , testdir ):
423
+ testdir .makepyfile ("""
424
+ def pytest_funcarg__arg(request):
425
+ print('hello-stdout')
426
+ raise ValueError()
427
+ def test_function(arg):
428
+ pass
429
+ """ )
430
+ result , dom = runandparse (testdir )
431
+ node = dom .find_first_by_tag ("testsuite" )
432
+ pnode = node .find_first_by_tag ("testcase" )
433
+ systemout = pnode .find_first_by_tag ("system-out" )
434
+ assert "hello-stdout" in systemout .toxml ()
435
+
436
+ def test_setup_error_captures_stderr (self , testdir ):
437
+ testdir .makepyfile ("""
438
+ import sys
439
+ def pytest_funcarg__arg(request):
440
+ sys.stderr.write('hello-stderr')
441
+ raise ValueError()
442
+ def test_function(arg):
443
+ pass
444
+ """ )
445
+ result , dom = runandparse (testdir )
446
+ node = dom .find_first_by_tag ("testsuite" )
447
+ pnode = node .find_first_by_tag ("testcase" )
448
+ systemout = pnode .find_first_by_tag ("system-err" )
449
+ assert "hello-stderr" in systemout .toxml ()
450
+
422
451
423
452
def test_mangle_testnames ():
424
453
from _pytest .junitxml import mangle_testnames
You can’t perform that action at this time.
0 commit comments