Changes between Initial Version and Version 1 of Ticket #36491, comment 3


Ignore:
Timestamp:
Jul 4, 2025, 10:56:22 AM (2 months ago)
Author:
Simon Charette

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #36491, comment 3

    initial v1  
    2222}}}
    2323
    24 the problem seems due to the fact that the normal `unittest` [https://github.com/python/cpython/blob/ade19880943509945da193202ca89e0b2b6fbd75/Lib/unittest/suite.py#L162-L186 suite setup makes sure to] call `TestResutl._setupStdout` [https://github.com/python/cpython/blob/ade19880943509945da193202ca89e0b2b6fbd75/Lib/unittest/result.py#L65-L71 method] prior to calling `setUpClass` which allows its `addError` [https://github.com/python/cpython/blob/ade19880943509945da193202ca89e0b2b6fbd75/Lib/unittest/suite.py#L238-L253 handler] to not crash when it takes its `if self.buffer` [https://github.com/python/cpython/blob/ade19880943509945da193202ca89e0b2b6fbd75/Lib/unittest/result.py#L197-L207 branch] in `_exc_info_to_string.
     24the problem seems due to the fact that the normal `unittest` [https://github.com/python/cpython/blob/ade19880943509945da193202ca89e0b2b6fbd75/Lib/unittest/suite.py#L162-L186 suite setup makes sure to] call `TestResutl._setupStdout` [https://github.com/python/cpython/blob/ade19880943509945da193202ca89e0b2b6fbd75/Lib/unittest/result.py#L65-L71 method] prior to calling `setUpClass` which allows its `addError` [https://github.com/python/cpython/blob/ade19880943509945da193202ca89e0b2b6fbd75/Lib/unittest/suite.py#L238-L253 handler] to not crash when it takes its `if self.buffer` [https://github.com/python/cpython/blob/ade19880943509945da193202ca89e0b2b6fbd75/Lib/unittest/result.py#L197-L207 branch] in `_exc_info_to_string`.
    2525
    2626Given the buffering should happened in spawned worker process and we basically only use the `TestResult` provided to `ParallelTestSuite.run` for replicating the events sent from the pool in the main process and there's no test output to capture on the main process (no tests are run in the main process) a potential solution could be to simply disable `buffer` on the accumulator test result.
Back to Top