1

In pytest, I need to unittest a function like a()

def a():
    try:
        some_error_line
    except Exception,e:
        logging.debug("----")

How to assert the function a() which does not raises exception ?

  • Possible duplicate of [How to disable a try/except block during testing?](https://stackoverflow.com/questions/44080350/how-to-disable-a-try-except-block-during-testing) – 101 Nov 05 '18 at 06:39
  • Do you want to check that the exception is being caught when `some_error_line` throws it? – hoefling Nov 06 '18 at 22:11
  • @hoefling yeah correct, Since a() is having common Exception block, error goes into debug and not able assert in unittest – Bharani Deepak Nov 09 '18 at 06:34

0 Answers0