Tests succeed, still get traceback

后端 未结 5 1242
悲哀的现实
悲哀的现实 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:30

    end your unittest file with:

    if __name__=='__main__':
        try:
            unittest.main()
        except SystemExit as inst:
            if inst.args[0] is True: # raised by sys.exit(True) when tests failed
                raise
    

提交回复
热议问题