Skip to content

pytest 3.2 breaks pytest.mark.parametrize with null bytes #2644

Closed
@alex

Description

@alex
(tempenv-543d64822ecc) ~/.v/tempenv-543d64822ecc ❯❯❯ pip install "pytest<3.2"
Collecting pytest<3.2
  Using cached pytest-3.1.3-py2.py3-none-any.whl
Requirement already satisfied: py>=1.4.33 in ./lib/python2.7/site-packages (from pytest<3.2)
Requirement already satisfied: setuptools in ./lib/python2.7/site-packages (from pytest<3.2)
Installing collected packages: pytest
  Found existing installation: pytest 3.2.0
    Uninstalling pytest-3.2.0:
      Successfully uninstalled pytest-3.2.0
Successfully installed pytest-3.1.3
(tempenv-543d64822ecc) ~/.v/tempenv-543d64822ecc ❯❯❯ cat test.py
import pytest


@pytest.mark.parametrize("data", ["\x00"])
def test_foo(data):
    assert data
(tempenv-543d64822ecc) ~/.v/tempenv-543d64822ecc ❯❯❯ py.test  test.py
====================================================== test session starts =======================================================
platform darwin -- Python 2.7.13, pytest-3.1.3, py-1.4.34, pluggy-0.4.0
rootdir: /Users/alex_gaynor/.virtualenvs/tempenv-543d64822ecc, inifile:
collected 1 item s

test.py .

==================================================== 1 passed in 0.01 seconds ====================================================
(tempenv-543d64822ecc) ~/.v/tempenv-543d64822ecc ❯❯❯ pip install -U pytest
Collecting pytest
  Using cached pytest-3.2.0-py2.py3-none-any.whl
Requirement already up-to-date: py>=1.4.33 in ./lib/python2.7/site-packages (from pytest)
Requirement already up-to-date: setuptools in ./lib/python2.7/site-packages (from pytest)
Installing collected packages: pytest
  Found existing installation: pytest 3.1.3
    Uninstalling pytest-3.1.3:
      Successfully uninstalled pytest-3.1.3
Successfully installed pytest-3.2.0
(tempenv-543d64822ecc) ~/.v/tempenv-543d64822ecc ❯❯❯ py.test  test.py
====================================================== test session starts =======================================================
platform darwin -- Python 2.7.13, pytest-3.2.0, py-1.4.34, pluggy-0.4.0
rootdir: /Users/alex_gaynor/.virtualenvs/tempenv-543d64822ecc, inifile:
collected 1 item s

test.py EE

============================================================= ERRORS =============================================================
_________________________________________________ ERROR at setup of test_foo[] __________________________________________________

self = {'TERM_PROGRAM_VERSION': '3.0.15', 'LOGNAME': 'alex_gaynor', 'USER': 'alex_gaynor', 'HOME': '/Users/alex_gaynor', 'PAT..._ENCODING': '0x1F5:0x0:0x0', 'PWD': '/Users/alex_gaynor/.virtualenvs/tempenv-543d64822ecc', 'COMMAND_MODE': 'unix2003'}
key = 'PYTEST_CURRENT_TEST', item = 'test.py::test_foo[\x00] (setup)'

    def __setitem__(self, key, item):
>       putenv(key, item)
E       TypeError: putenv() argument 2 must be string without null bytes, not str

lib/python2.7/os.py:473: TypeError
________________________________________________ ERROR at teardown of test_foo[] ________________________________________________

self = {'TERM_PROGRAM_VERSION': '3.0.15', 'LOGNAME': 'alex_gaynor', 'USER': 'alex_gaynor', 'HOME': '/Users/alex_gaynor', 'PAT..._ENCODING': '0x1F5:0x0:0x0', 'PWD': '/Users/alex_gaynor/.virtualenvs/tempenv-543d64822ecc', 'COMMAND_MODE': 'unix2003'}
key = 'PYTEST_CURRENT_TEST', item = 'test.py::test_foo[\x00] (teardown)'

    def __setitem__(self, key, item):
>       putenv(key, item)
E       TypeError: putenv() argument 2 must be string without null bytes, not str

lib/python2.7/os.py:473: TypeError
==================================================== 2 error in 0.07 seconds =====================================================
(tempenv-543d64822ecc) ~/.v/tempenv-543d64822ecc ❯❯❯

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugproblem that needs to be addressedtype: regressionindicates a problem that was introduced in a release which was working previously

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions