URL: https://github.com/freeipa/freeipa/pull/1340
Author: tiran
 Title: #1340: Add workaround for pytest 3.3.0 bug
Action: opened

PR body:
"""
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 https://github.com/pytest-dev/pytest/issues/2957
Signed-off-by: Christian Heimes <chei...@redhat.com>

Needs backport to 4.6.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1340/head:pr1340
git checkout pr1340
From cf10ed0ad3fbb6fc762f67796065d13f5ee6fab2 Mon Sep 17 00:00:00 2001
From: Christian Heimes <chei...@redhat.com>
Date: Tue, 28 Nov 2017 13:16:36 +0100
Subject: [PATCH] Add workaround for pytest 3.3.0 bug

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 https://github.com/pytest-dev/pytest/issues/2957
Signed-off-by: Christian Heimes <chei...@redhat.com>
---
 ipatests/test_ipapython/test_ssh.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ipatests/test_ipapython/test_ssh.py b/ipatests/test_ipapython/test_ssh.py
index 848c14cadf..4202767804 100644
--- a/ipatests/test_ipapython/test_ssh.py
+++ b/ipatests/test_ipapython/test_ssh.py
@@ -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)
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to