how do I run parallel mode via API?

Issue #312 duplicate
Former user created an issue

My flow goes like this:

  cov = coverage.coverage(data_suffix=True)
  cov.start()
  suite = unittest.defaultTestLoader.discover(...)
  suite = ConcurrentTestSuite(suite, fork_for_tests(4))  # os.fork 4 subprocesses
  unittest.TextTestRunner().run(suite)
  cov.stop()
  cov.combine()
  cov.save()

My suite does a lot of forks (via http://coreygoldberg.blogspot.com/2013/06/python-concurrencytest-running.html).

I thought setting data_suffix=True would force the parallel runs, yet I get different coverage results depending if I os.fork the runs or not.

Comments (7)

  1. Ned Batchelder repo owner

    Can you provide a small sample project that demonstrates the problem? (Even a large project that demonstrates the problem would be good.)

  2. Ned Batchelder repo owner

    Thanks, I've reproduced it, and will dig in soon to understand what's going wrong.

  3. Log in to comment