-3

I have a scenario where I want the pytest not to test the function and resume the test excution.

def test(self):
    self.test1()
    self.test2()
    self.test3()

Here I want to ignore/skip self.test2() method to be executed. How can I proceed by simply ignoring self.test2()?

Tamir Abutbul
  • 7,301
  • 7
  • 25
  • 53
Flask Diploy
  • 29
  • 1
  • 8
  • 1
    Does this answer your question? [How do I disable a test using pytest?](https://stackoverflow.com/questions/38442897/how-do-i-disable-a-test-using-pytest) – baduker Sep 17 '20 at 07:49
  • No. I am not looking for skipping a test for test execution. Here I am looking a way by the help of which I can skip a part of function under test. self.test2() is a function in a flow of test(self). I want to skip that like if we comment self.test2() then it wont get executed . – Flask Diploy Sep 17 '20 at 10:08
  • Under what condition do you want to skip the call to `self.test2()` ? If always why don't you just remove the line ? – Fabich Sep 18 '20 at 15:54

1 Answers1

0

Got the solution. You just have to mock the function. Here in this case

obj = test()
obj.test2 = Mock()
Flask Diploy
  • 29
  • 1
  • 8