You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FakeProcess always returns stdout.getvalue() and stderr.getvalue() as they are. This is a problem when you're testing code that sometimes passe universal_newlines to the subprocess calls.
In Python 2.7, universal_newlines doesn't make much of a difference, but in Python 3, if you pass universal_newlines=True, you will get strings instead of bytes for stdout and stderr in the subprocess calls.kaasjrzrrzr
The text was updated successfully, but these errors were encountered:
Yeah, I think that makes sense. Note that this should be done for Python 3 only. For Python 2 str is always returned, universal_newlines doesn't make a difference there.
Popen is tricky to fake. In another project I faked Popen I did so by creating temp scripts that wrote to stdout and stderr. That way I could use the real Popen to fake the output part by executing those scripts, so all subtle behaviors were taken care of the way the should.
@bjornt yes, I think both approaches (fake popen vs fake executables) make sense in different situations. You might have noticed already, but for there's support in systemfixtures for faking executables:
Depending on your situation you might prefer one or the other or a combination of both. Happy to help improving any rough edges you might find (either in FakePopen or FakeExecutable).
FakeProcess always returns stdout.getvalue() and stderr.getvalue() as they are. This is a problem when you're testing code that sometimes passe universal_newlines to the subprocess calls.
In Python 2.7, universal_newlines doesn't make much of a difference, but in Python 3, if you pass universal_newlines=True, you will get strings instead of bytes for stdout and stderr in the subprocess calls.kaasjrzrrzr
The text was updated successfully, but these errors were encountered: