Я обновил pytest до 4.3.0, и теперь мне нужно переделать тестовый код, так как прямой вызов осветительных приборов устарел.
У меня проблема с приборами, используемыми в unittest.TestCase, как получить значение, возвращаемое из осветителя, а не ссылку на саму функцию?
Пример:
@pytest.fixture
def test_value():
return 1
@pytest.mark.usefixtures("test_value")
class test_class(unittest.TestCase):
def test_simple_in_class(self):
print(test_value) # prints the function reference and not the value
print(test_value()) # fails with Fixtures are not meant to be called directly
def test_simple(test_value):
print(test_value) # prints 1
Как получить test_value в методе test_simple_in_class ()?