1

I have the following code that run the 'test_method' function with an input parameter each time (1 or 2) and the teardown method sequentially.

So the flow is like this:

test_method (with 1 as an input) -> teardown_method -> test_method (with 2 as an input) -> teardown_method

How can I change the code that the 'test_method' and the 'teardown_method' will run in parallel with each input (1 and 2).

Thanks!

class TestClass:
   def test_method(self, input_value):
       print("test function")

   def teardown_method(self):  # running at the end of one test
       print("teardown method")

   @pytest.fixture(scope="module", params=[1, 2])
   def input_value(self, request):
       return request.param
talsap
  • 61
  • 2

0 Answers0