Предположим, у меня есть много тестовых файлов, которые содержат одно и то же константа TEST_NAME, как показано в следующем фиктивном примере:
Код: Выделить всё
# test_01.py file
TEST_NAME = "C4901. Get results using lookup feature"
...
Код: Выделить всё
# test_02.py file
TEST_NAME = "C4902. Verify Lookup Home Screen for test number"
...
Код: Выделить всё
# conftest.py file
@pytest.fixture(scope="class")
def class_setup_teardown(self, request):
# this one I can't realize:
test_name = how_can_I_get_this_data.TEST_NAME
print(f"Attempting to run {test_name} test case")
Спасибо!
Подробнее здесь: https://stackoverflow.com/questions/755 ... -test-file
Мобильная версия