Skip to content

bytes parametrize values aren't properly escaped #4458

@ulope

Description

@ulope

Problem

Parametrize values of type byte don't properly escape non-printable characters leading to inability to select those specific tests with -k.

Minimal example

test_select.py:

import pytest


@pytest.mark.parametrize('p', [b'\x01a', b'b'])
def test_a(p):
    pass
~$ pytest --collect-only --quiet
test_select.py::test_a[a]
test_select.py::test_a[b]

no tests ran in 0.04 seconds
~$ pytest -k 'test_a[a]'
======================================== test session starts ========================================
platform darwin -- Python 3.6.6, pytest-4.0.0, py-1.7.0, pluggy-0.8.0
rootdir: /Users/ulo/Envs/tmp-54dcc18e560d86f8/pytest-select, inifile:
collected 2 items / 2 deselected

=================================== 2 deselected in 0.01 seconds ====================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: collectionrelated to the collection phasetopic: parametrizerelated to @pytest.mark.parametrizetype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions