Can Python's unittest test in parallel, like nose can?

后端 未结 7 1141
小蘑菇
小蘑菇 2020-12-01 01:53

Python\'s NOSE testing framework has the concept of running multiple tests in parallel.

The purpose of this is not to test concurrency in the code, but to make test

7条回答
  •  情歌与酒
    2020-12-01 02:35

    If this is what you did initially

    runner = unittest.TextTestRunner()
    runner.run(suite)
    

    -----------------------------------------

    replace it with

    from concurrencytest import ConcurrentTestSuite, fork_for_tests
    
    concurrent_suite = ConcurrentTestSuite(suite, fork_for_tests(4))
    runner.run(concurrent_suite)
    

提交回复
热议问题