Answer the question
In order to leave comments, you need to log in
Pytest, displaying Russian text in a report?
Good afternoon.
I ran into a problem with the output of Russian text, in the results of autotests on pytest, in a parameterized test. Code like this:
@pytest.mark.parametrize('type_document', ['тендер', 'заявка'])
def test_a(type_document):
assert type_document == 'тендер'
test_test.py::test_a[\u0442\u0435\u043d\u0434\u0435\u0440] PASSED
test_test.py::test_a[\u0437\u0430\u044f\u0432\u043a\u0430] FAILED
Answer the question
In order to leave comments, you need to log in
# encoding: utf-8
import pytest
@pytest.mark.parametrize('foo', ['büpf'])
def test_args(foo):
pass
@pytest.mark.parametrize('foo', ['a'], ids=['büpf'])
def test_ids(foo):
pass
If you dig for a long time, you can find a method that deals with this dirty trick, but there is no way to turn it off and bypass it, this happens at the moment when pytest goes through all the files and collects a collection of tests.
It started with pytest 3 and up. You can use version 2.9.0 and everything will be fine
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question