Python unittest: cancel all tests if a specific test fails

前端 未结 4 888
刺人心
刺人心 2020-12-31 12:42

I am using unittest to test my Flask application, and nose to actually run the tests.

My first set of tests is to ensure the testing enviro

4条回答
  •  天命终不由人
    2020-12-31 13:12

    For your use case there's setUpModule() function:

    If an exception is raised in a setUpModule then none of the tests in the module will be run and the tearDownModule will not be run. If the exception is a SkipTest exception then the module will be reported as having been skipped instead of as an error.

    Test your environment inside this function.

提交回复
热议问题