pytest parametrize I am getting missing required positional arguments

Viewed 3931

I try to add use pytest parametrize for my unit tests. But I see the error of "missing required positional arguments". Can you help where the issue is? Thanks.

 @pytest.mark.parametrize("param", ["a", "b"])
    def test_pytest(self, param):
        print(param)
        assert False

I get the following exception:

class Tests(unittest.TestCase):
@contextlib.contextmanager
def testPartExecutor(self, test_case, isTest=False):
    old_success = self.success
    self.success = True
    try:
>       yield

           with outcome.testPartExecutor(self):
                self.setUp()
            if outcome.success:
                outcome.expecting_failure = expecting_failure
                with outcome.testPartExecutor(self, isTest=True):
>                   testMethod()
E                   TypeError: test_pytest() missing 1 required positional argument: 'param'
0 Answers
Related