Tests on Travis fail with `sequence item 1: expected a bytes-like object, str found`
acompa opened this issue · 4 comments
Our Travis tests have started failing after we bumped pifpaf version from 1.11.2 to 1.11.4. Some more information:
- Tests are administered using tox. They pass on local development machines.
- We have not changed our Travis configuration aside from installing the latest libraries.
Two of our jobs fail. The first, a py36 job, fails with this error message on Travis (with some paths edited):
py36 runtests: commands[0] | pifpaf run postgresql -- python -m coverage run -m pytest tests --ignore tests/my_test.py
ERROR [pifpaf] sequence item 1: expected a bytes-like object, str found
ERROR: InvocationError: '/home/travis/build/path/to/.tox/py36/bin/pifpaf run postgresql -- python -m coverage run -m pytest tests --ignore tests/my_test.py'
The second, py27, fails with this error:
py27 runtests: commands[0] | pifpaf run postgresql -- python -m coverage run -m pytest tests --ignore tests/my_test.py
ERROR [pifpaf] Unable to run command `/usr/lib/postgresql/10/bin/pg_ctl -o '-A trust' initdb': [Errno 2] No such file or directory
ERROR: InvocationError: '/home/travis/build/path/to/.tox/py27/bin/pifpaf run postgresql -- python -m coverage run -m pytest tests --ignore tests/my_test.py'
This is unlikely related to 1.11.4, the diff since 1.11.2 does not concern anything else than Swift and Gnocchi drivers.
Can you run it with --debug to see what's going on?
Do you test with Python 2 and do you have the same error?
Yep, also tested with Python 2 (see the second code block in the initial message).
I see this when running Python 3 tests with --debug
:
ERROR [pifpaf] Traceback (most recent call last):
File "/home/travis/build/path/to/.tox/py36/lib/python3.6/site-packages/pifpaf/drivers/__init__.py", line 214, in _exec
preexec_fn=os.setsid,
File "/opt/python/3.6.3/lib/python3.6/subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "/opt/python/3.6.3/lib/python3.6/subprocess.py", line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: b'/usr/lib/postgresql/10/bin/pg_ctl': b'/usr/lib/postgresql/10/bin/pg_ctl'
It looks like pifpaf assumes PostgreSQL 10, which Travis only supports with a lot of work. Am I reading this debug correctly?
I think this is a travis-ci image or pg_ctl
issue. I was able to reproduce with this yaml: https://github.com/sinemetu1/test-pg-travis/blob/master/.travis.yml
And the corresponding travis build: https://travis-ci.org/sinemetu1/test-pg-travis/builds/325130012
I have no idea why pg_ctl --bindir
is reporting /usr/lib/postgresql/10/bin
.
Here's the travis issue: travis-ci/travis-ci#9011