Skip to content

Commit

Permalink
Add workaround for pytest 3.3.0 bug
Browse files Browse the repository at this point in the history
pytest is setting an env var PYTEST_CURRENT_TEST to the test name + test
parameters. If parameters happen to contain NULL bytes, the putenv()
call fails with "ValueError: embedded null byte". The workaround uses
repr() of test parameters as parameter id.

See pytest-dev/pytest#2957
Signed-off-by: Christian Heimes <cheimes@redhat.com>
  • Loading branch information
tiran committed Nov 28, 2017
1 parent cd80036 commit cf10ed0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ipatests/test_ipapython/test_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
(u'@opt %s' % openssh, ValueError),
(u'opt=val %s' % openssh, ValueError),
(u'opt, %s' % openssh, ValueError),
])
# ids=repr is workaround for https://github.com/pytest-dev/pytest/issues/2644
], ids=repr)
def test_public_key_parsing(pk, out):
if isinstance(out, type) and issubclass(out, Exception):
pytest.raises(out, ssh.SSHPublicKey, pk)
Expand Down

0 comments on commit cf10ed0

Please sign in to comment.