Мне удалось изменить отображаемое имя, но только с помощью личных переменных pytest.
Создайте файл conftest.py
и сделайте эту функцию:
def pytest_itemcollected(item):
""" change test name, using fixture names """
item._nodeid = ', '.join(item._fixtureinfo.argnames)
Когда я запускаю этот файл test_fileс pytest:
import pytest
@pytest.fixture()
def fixture_1():
pass
@pytest.fixture()
def fixture_2():
pass
def test1(fixture_1):
assert 1 == 1
def test_a(fixture_1, fixture_2):
assert 1 == 2
Результат:
pytest
============================= test session starts =============================
platform win32 -- Python 3.6.1, pytest-3.6.1, py-1.5.3, pluggy-0.6.0
rootdir: C:\Users\gelineau\Desktop\kaggle_flavien, inifile:
collected 2 items
fixture_1 . [ 50%]
fixture_1, fixture_2 F [100%]
================================== FAILURES ===================================
___________________________________ test_a ____________________________________
fixture_1 = None, fixture_2 = None
def test_a(fixture_1, fixture_2):
> assert 1 == 2
E assert 1 == 2
test\test_so.py:15: AssertionError
===================== 1 failed, 1 passed in 0.86 seconds ======================
Новые имена тестов также печатаются в pycharm