From 3313a74519b1da5546493c163191aca9f77cdbd1 Mon Sep 17 00:00:00 2001 From: Nels Chantarotwong <43188172+nchantarotwong@users.noreply.github.com> Date: Tue, 31 Jan 2023 16:30:32 -0800 Subject: [PATCH 1/2] avoid error when modules like python-subunit try to write to sys.stdout.buffer with no buffer --- xmlrunner/result.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xmlrunner/result.py b/xmlrunner/result.py index 96fc675..30a947d 100644 --- a/xmlrunner/result.py +++ b/xmlrunner/result.py @@ -291,6 +291,10 @@ def _setupStdout(self): sys.stdout = _DuplicateWriter(sys.stdout, self._stdout_capture) self.__stderr_saved = sys.stderr sys.stderr = _DuplicateWriter(sys.stderr, self._stderr_capture) + # avoid issues where modules like python-subunit try to write directly to sys.stdout.buffer + # when there is no buffer + if not hasattr(sys.stdout, 'buffer'): + sys.stdout.buffer = _DuplicateWriter(sys.stdout, self._stdout_capture) def _restoreStdout(self): """ From 275446a60b3fadcaad48dfa417d50608b620564c Mon Sep 17 00:00:00 2001 From: Nels Chantarotwong <43188172+nchantarotwong@users.noreply.github.com> Date: Thu, 2 Feb 2023 14:44:49 -0800 Subject: [PATCH 2/2] fix passenv for tox 4 --- tox.ini | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index c290205..0ae7030 100644 --- a/tox.ini +++ b/tox.ini @@ -28,7 +28,24 @@ commands = python -m xmlrunner discover -p test_xmlrunner_output codecov -e TOXENV -coveralls -passenv = CI TRAVIS_BUILD_ID TRAVIS TRAVIS_BRANCH TRAVIS_JOB_NUMBER TRAVIS_PULL_REQUEST TRAVIS_JOB_ID TRAVIS_REPO_SLUG TRAVIS_COMMIT CODECOV_TOKEN COVERALLS_REPO_TOKEN GITHUB_ACTION GITHUB_HEAD_REF GITHUB_REF GITHUB_REPOSITORY GITHUB_RUN_ID GITHUB_SHA +passenv = + CI + TRAVIS_BUILD_ID + TRAVIS + TRAVIS_BRANCH + TRAVIS_JOB_NUMBER + TRAVIS_PULL_REQUEST + TRAVIS_JOB_ID + TRAVIS_REPO_SLUG + TRAVIS_COMMIT + CODECOV_TOKEN + COVERALLS_REPO_TOKEN + GITHUB_ACTION + GITHUB_HEAD_REF + GITHUB_REF + GITHUB_REPOSITORY + GITHUB_RUN_ID + GITHUB_SHA [testenv:pytest]