I have written my test classes in a file and I am trying to use pytest fixtures so that I don't have to create the same input data in each test functions. Below is the minimal working example.
import unittest
import pytest
@pytest.fixture
def base_value():
return 5
class Test(unittest.TestCase):
def test_add_two(self, base_value):
result = base_value + 2
self.assertEqual(result, 7, "Result doesn't match")
However, when I test this using pytest-3, I get the following error:
TypeError: test_add_two() missing 1 required positional argument: 'base_value'
This is confusing for me since the base_value is clearly given as one of the arguments to test_add_two
. Any help is highly appreciated.