Skip to content

Is there anyway to not escape id in parametrization? #2482

Closed
@youknowone

Description

@youknowone

Thanks for submitting an issue!

Here's a quick checklist in what to include:

  • Include a detailed description of the bug or suggestion
  • pip list of the virtual environment you are using
  • pytest and operating system versions
  • Minimal example if possible

I want to print original unicode text without escaping, but I can't find anyway to do that.

code:

import pytest

@pytest.mark.parametrize('text,result', [
    ['테스트1', False],
    ['테스트2', False],
])
def test_func(text):
    assert False

result of pytest run

$ pytest t.py
======= test session starts =========
platform darwin -- Python 3.6.1, pytest-3.0.7, py-1.4.33, pluggy-0.4.0 -- ~/.pyenv/versions/3.6.1/bin/python
cachedir: .cache
plugins: asyncio-0.5.0
collected 2 items

t.py::test_func[\ud14c\uc2a4\ud2b81-False] FAILED
t.py::test_func[\ud14c\uc2a4\ud2b82-False] FAILED

Expected result:

t.py::test_func[테스트1-False] FAILED
t.py::test_func[테스트2-False] FAILED

Unfortunately, I found you are regarding this as a feature in: #1470

So, for now, I am doing that by adding:

import _pytest
_pytest.python._escape_strings = lambda x: x

I really need to see the original unicode text, because escaped characters are not human readable. At least, it is a lot better to be displayed in both escaped and unescaped way, not just in escaped way.

Is there any better way?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions