I have updated pytest to 4.3.0 and now I need to rework test code since calling fixtures directly is deprecated.
I have an issue with fixtures used in an unittest.TestCase, how do I get the value returned from the fixture and not a reference to the function itself ?
Example :
@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
How can I get test_value in the test_simple_in_class() method ?