-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
If you use from multiprocess import Popen the library is not able to swap the implementation, I don't know if it's an intended behavior, maybe should be explicitly indicated in the documentation.
Minimal reproducible example: imagine you have the module benchmarking.py with the following function:
from subprocess import Popen as imported_Popen
def meow(cmdline):
return imported_Popen(cmdline, stdout=subprocess.PIPE)and then you have a separate file with your test
from benchmarking import meow
def test_echo_null_byte(fp):
fp.register(["echo", "-ne", "\x00"], stdout=bytes.fromhex("00"))
process = meow(["echo", "-ne", "\x00"])
out, _ = process.communicate()
assert process.returncode == 0
assert out == b"\x00"then the test it's gonna fail because (probably) at the moment the test is run it's too late to swap the implementation.
Metadata
Metadata
Assignees
Labels
No labels