From 22d5c176fcf671bb0bded282b3019a2b3e67b7df Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Mon, 1 Sep 2025 09:21:42 +0200 Subject: [PATCH] Overwrite `encoding` property in `_DuplicateWriter` `_DuplicateWriter` wraps `sys.stdout` and applications might expect the encoding being set to a "real" value to determine the encoding to use. However `_DuplicateWriter` never sets it so the property defaults to `None`. As that class is basically a wrapper around its `first` stream it should forward the encoding --- xmlrunner/result.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xmlrunner/result.py b/xmlrunner/result.py index 96fc675..ad444cc 100644 --- a/xmlrunner/result.py +++ b/xmlrunner/result.py @@ -91,6 +91,10 @@ def __init__(self, first, second): self._first = first self._second = second + @property + def encoding(self): + return self._first.encoding + def flush(self): self._first.flush() self._second.flush()