Only skip null bytes before setting the environment variable

As discussed, node ids have already been "ascii" sanitized by the
parametrization process
This commit is contained in:
Bruno Oliveira 2017-08-02 10:27:45 -03:00
parent 1deac2e210
commit 7703dc921c
1 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@ import sys
from time import time
import py
from _pytest.compat import _ascii_escaped, _PY2
from _pytest.compat import _PY2
from _pytest._code.code import TerminalRepr, ExceptionInfo
from _pytest.outcomes import skip, Skipped, TEST_OUTCOME
@ -135,7 +135,7 @@ def _update_current_test_var(item, when):
"""
var_name = 'PYTEST_CURRENT_TEST'
if when:
value = _ascii_escaped('{0} ({1})'.format(item.nodeid, when))
value = '{0} ({1})'.format(item.nodeid, when)
if _PY2:
# python 2 doesn't like null bytes on environment variables (see #2644)
value = value.replace('\x00', '(null)')