When printing something inside a test that contains a subtest that fails, no output is captured.
Expected behaviour: stdout is captured and printed somewhere relevant to the test, perhaps with the results for all subtests lumped together in a block for the test.
Current behaviour: stdout is printed correctly if all subtests pass, but not if one fails no output is shown. An example to reproduce this is shown below.
which produces, when run with green (all options left as default):
FF.
Captured stdout for test_test.SubTest.test_subtest
Passing subtest: before
Passing subtest: within
Passing subtest: after
Failure in test_test.SubTest.test_failing_subtest [A sub-testing]
File "/usr/lib/python3.8/unittest/case.py", line 60, in testPartExecutor
yield
File "/usr/lib/python3.8/unittest/case.py", line 582, in subTest
yield
File "/home/jake/green_test/test_test.py", line 16, in test_failing_subtest
self.assertTrue(False)
File "/usr/lib/python3.8/unittest/case.py", line 765, in assertTrue
raise self.failureException(msg)
AssertionError: False is not true
Failure in test_test.SubTest.test_no_subtest
File "/usr/lib/python3.8/unittest/case.py", line 60, in testPartExecutor
yield
File "/usr/lib/python3.8/unittest/case.py", line 676, in run
self._callTestMethod(testMethod)
File "/usr/lib/python3.8/unittest/case.py", line 633, in _callTestMethod
method()
File "/home/jake/green_test/test_test.py", line 24, in test_no_subtest
self.assertTrue(False)
File "/usr/lib/python3.8/unittest/case.py", line 765, in assertTrue
raise self.failureException(msg)
AssertionError: False is not true
Captured stdout for test_test.SubTest.test_no_subtest
No subtest: before
No subtest: within
Ran 3 tests in 0.030s using 8 processes
FAILED (failures=2, passes=1)
green --version: Green 3.2.0, Coverage 5.1, Python 3.8.6
When printing something inside a test that contains a subtest that fails, no output is captured.
Expected behaviour: stdout is captured and printed somewhere relevant to the test, perhaps with the results for all subtests lumped together in a block for the test.
Current behaviour: stdout is printed correctly if all subtests pass, but not if one fails no output is shown. An example to reproduce this is shown below.
test_test.py
:which produces, when run with
green
(all options left as default):green --version
:Green 3.2.0, Coverage 5.1, Python 3.8.6
Possible reference to this issue: https://github.com/CleanCut/green/issues/111#issuecomment-321700463