I've spent a day on python-pytest-multihost, fixing several issues that piled up in the meanwhile. They're all subtly connected.
Set a policy regarding bytes, text, strings and encodings when dealing with file contents -- see the change in README.rst. Update Host and Transport to match.
Currently, when stdin was given to a command, no EOF was sent. We assumed the program would only read as much stdout as it needed. This is an issue, especially with background tasks. To fix this, stdin is now piped to the command through echo.
Also, stdin_text passed to commands is now binary-safe, if given as a bytestring.
Command (i.e. what host.run_command returns) is now a context manager, which is useful for background tasks:
with host.run_command(['cat', pipe_filename], bg=True) as cat:
host.run_command('cat > ' + pipe_filename, stdin_text='foo')
Clarify that wait() should be called for all background tasks (either explicitly, or by with with).
Remove the buggy test test_background, instead add tests for the above.
I've spent a day on python-pytest-multihost, fixing several issues that piled up in the meanwhile. They're all subtly connected.
Set a policy regarding bytes, text, strings and encodings when dealing with file contents -- see the change in README.rst. Update Host and Transport to match.
Currently, when stdin was given to a command, no EOF was sent. We assumed the program would only read as much stdout as it needed. This is an issue, especially with background tasks. To fix this, stdin is now piped to the command through echo.
Also,
stdin_textpassed to commands is now binary-safe, if given as a bytestring.Command (i.e. what
host.run_commandreturns) is now a context manager, which is useful for background tasks:Clarify that
wait()should be called for all background tasks (either explicitly, or by withwith).Remove the buggy test
test_background, instead add tests for the above.Add a Tox configuration file.
Fixes: https://pagure.io/python-pytest-multihost/issue/6
Fixes: https://pagure.io/python-pytest-multihost/issue/7
Fixes: https://pagure.io/python-pytest-multihost/pull-request/9