-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
plugin: capturerelated to the capture builtin pluginrelated to the capture builtin plugintype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branch
Description
I'd like something like this to work:
def test_thing(capfd_bytes):
subprocess.check_call(('echo', '-e', '\\x98\\xfe'))
out, err = capfd_bytes.readouterr()
assert out == b'\x98\xfe'
My actual usecase is running tar
as stdout and then inspecting the output
I'm hacking around with this (which works, but is undeniably fragile):
def test(capfd):
...
capfd._capture.out.tmpfile.encoding = None
capfd._capture.err.tmpfile.encoding = None
out, err = capfd.readouterr()
capfd._capture.out.tmpfile.encoding = 'UTF-8'
capfd._capture.err.tmpfile.encoding = 'UTF-8'
# ...
would pytest be amenable to a PR which enables something like this without hax?
Metadata
Metadata
Assignees
Labels
plugin: capturerelated to the capture builtin pluginrelated to the capture builtin plugintype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branch