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 <[email protected]>
Reviewed-By: Alexander Bokovoy <[email protected]>
  • Loading branch information
tiran committed Nov 28, 2017
1 parent cd80036 commit 4069c12
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ipatests/test_ipapython/test_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@
(u'vanitas %s' % b64, ValueError),
(u'@opt %s' % openssh, ValueError),
(u'opt=val %s' % openssh, ValueError),
(u'opt, %s' % openssh, ValueError),
])
(u'opt, %s' % openssh, ValueError)],
# ids=repr is workaround for pytest issue with NULL bytes,
# see 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 4069c12

Please sign in to comment.