-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
plugin: capturerelated to the capture builtin pluginrelated to the capture builtin plugintype: bugproblem that needs to be addressedproblem that needs to be addressed
Description
On Python3, when output capturing is enabled, bytes are accepted where normaly only text would we accepted.
I am on Ubuntu 18.04 and using it's Python 3.6 packages with pytest 4.3.0.
Code:
# coding: utf-8
import sys as _sys
def test_output():
_sys.stdout.write(b"foo")
With capturing:
=============================== test session starts ===============================
platform linux -- Python 3.6.6, pytest-4.3.0, py-1.6.0, pluggy-0.7.1
rootdir: /tmp/tmp.t1x157Dqyo, inifile:
plugins: localserver-0.5.0, httpbin-0.3.0, cov-2.6.0
collected 1 item
test.py . [100%]
============================ 1 passed in 0.00 seconds =============================
Without capturing:
=============================== test session starts ===============================
platform linux -- Python 3.6.6, pytest-4.3.0, py-1.6.0, pluggy-0.7.1
rootdir: /tmp/tmp.t1x157Dqyo, inifile:
plugins: localserver-0.5.0, httpbin-0.3.0, cov-2.6.0
collected 1 item
test.py F
==================================== FAILURES =====================================
___________________________________ test_output ___________________________________
def test_output():
> _sys.stdout.write(b"foo")
E TypeError: write() argument must be str, not bytes
test.py:7: TypeError
============================ 1 failed in 0.02 seconds =============================
Metadata
Metadata
Assignees
Labels
plugin: capturerelated to the capture builtin pluginrelated to the capture builtin plugintype: bugproblem that needs to be addressedproblem that needs to be addressed