Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions spyder_unittest/backend/runnerbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def start(self, config: Config, cov_path: Optional[str],
"""
self.process = self._prepare_process(config, pythonpath)
p_args = self.create_argument_list(config, cov_path, single_test)
p_args = ['-X', 'utf8'] + p_args # Ensure output is UTF-8
try:
os.remove(self.resultfilename)
except OSError:
Expand All @@ -231,8 +232,7 @@ def read_all_process_output(self) -> str:
"""Read and return all output from `self.process` as unicode."""
assert self.process is not None
qbytearray = self.process.readAllStandardOutput()
locale_codec = QTextCodec.codecForLocale()
return locale_codec.toUnicode(qbytearray.data())
return str(qbytearray.data(), encoding='utf-8')

def stop_if_running(self) -> None:
"""Stop testing process if it is running."""
Expand Down
4 changes: 3 additions & 1 deletion spyder_unittest/backend/tests/test_runnerbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,7 @@ def test_runnerbase_start(monkeypatch):
with pytest.raises(RuntimeError):
runner.start(config, cov_path, 'python_exec', ['pythondir'], None)

mock_process.start.assert_called_once_with('python_exec', ['arg1', 'arg2'])
mock_process.start.assert_called_once_with(
'python_exec', ['-X', 'utf8', 'arg1', 'arg2']
)
mock_remove.assert_called_once_with('results')
Loading