I am new to pytest framework. I need to create a testcase with a parameterized fixture on a class. I have created the testcase as below. But it is throwing an error saying: TypeError: TestClass.test_case_parameterized() missing 1 required positional argument: 'filename' Please someone help on this
import pytest
import unittest
from moto import mock_aws
@pytest.mark.parametrize("filename", ["testFile1.txt", "testFile2.txt"])
@mock_aws
class TestClass(unittest.TestCase):
def test_case_parameterized(self, filename):
print(f"filename = {filename}")
#further aws api call processing`
If you want to use pytest framework, do not derive your TestClass from unittest.
you can change your code as below:
import pytest
from moto import mock_aws
@pytest.mark.parametrize("filename", ["testFile1.txt", "testFile2.txt"])
@mock_aws
class TestClass:
def test_case_parameterized(self, filename):
print(f"filename = {filename}")
# further aws api call processing
# your assertion