try to fix error where modules writing directly to sys.stdout.buffer blow up#276
try to fix error where modules writing directly to sys.stdout.buffer blow up#276nchantarotwong wants to merge 2 commits intoxmlrunner:masterfrom
Conversation
…ut.buffer with no buffer
|
tests seem to have some sort of basic failure blocking the run, not having to do with my changes... tests/builder_test.py ........................ [ 26%] =================================== FAILURES =================================== self = <tests.testsuite.XMLTestRunnerTestCase testMethod=test_basic_unittest_constructs>
tests/testsuite.py:255: tests/testsuite.py:240: in _test_xmlrunner self = <tests.testsuite.XMLTestRunnerTestCase testMethod=test_unexpected_success>
tests/testsuite.py:300: tests/testsuite.py:240: in _test_xmlrunner .tox/pytest/lib/python3.11/site-packages/django/utils/encoding.py:266 -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html |
|
Wondering if this is due to being on python 3.11. Tox test run seems to use this system version even if I setup my PyCharm virtual env to use a lower version. |
Handle error case (due to using python-subunit + unittest-xml-reporting) where sys.stdout has no buffer attribute, causing a failure and hang in subunit:
protocol = TestProtocolServer(result, self._passthrough, self._forward)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/subunit/init.py", line 510, in init
stream = sys.stdout.buffer
^^^^^^^^^^^^^^^^^
AttributeError: '_DuplicateWriter' object has no attribute 'buffer'
This is due to python-subunit setting "stream = sys.stdout.buffer", but _DuplicateWriter() has no buffer attriibute. I tried handling this in a PR in python-subunit module, but they weren't really having it: testing-cabal/subunit#56
This works from what I can tell and doesn't seem to have negative side effects...
I also fixed tox.ini to work properly with Tox4, as it was not as-is.
test-results.zip