L
L
leksoQA2018-03-02 11:59:05
Python
leksoQA, 2018-03-02 11:59:05

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 == 'тендер'

The following is written to the console and to the allure report:
test_test.py::test_a[\u0442\u0435\u043d\u0434\u0435\u0440] PASSED
test_test.py::test_a[\u0437\u0430\u044f\u0432\u043a\u0430] FAILED

How to make Russian text display correctly?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir, 2018-03-02
@vintello

# 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

V
Vlad Grigoriev, 2018-03-02
@Vaindante

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 question

Ask a Question

731 491 924 answers to any question