Tests succeed, still get traceback

后端 未结 5 1213
悲哀的现实
悲哀的现实 2021-01-04 01:53

I\'m using Python\'s unittest library and all the tests succeed, but I still get a traceback and I can\'t understand how I can fix the problem.

         


        
5条回答
  •  离开以前
    2021-01-04 02:29

    Whatever you're using to run these tests, it's catching the SystemExit exception and printing the traceback. When you write code that catches exceptions, you should take care to not catch exceptions that you don't actually want to catch, like SystemExit (raised by sys.exit() to end the program) and usually KeyboardInterrupt (raised by control-C.)

提交回复
热议问题