uqfoundation / multiprocess

better multiprocessing and multithreading in Python
http://multiprocess.rtfd.io
Other
637 stars 64 forks source link

Use of code coverage metrics in multiprocess subprocesses? #38

Open merriam opened 7 years ago

merriam commented 7 years ago

Has anyone worked to have pytest coverage statistics follow multiprocess processes?

def multiprocessing_start(_):
    cov = init()
    if cov:
        multiprocessing.util.Finalize(None, cleanup, args=(cov,), exitpriority=1000)

try:
    import multiprocessing.util
except ImportError:
    pass
else:
    multiprocessing.util.register_after_fork(multiprocessing_start, multiprocessing_start)

multiprocessing_finish = cleanup  # in case someone dared to use this internal

Is there any guidance on this? Or any experience?

mmckerns commented 7 years ago

@merriam: I haven't tried pytestor pycharm with multiprocess. I don't recall a ticket where someone has requested this, or contributed code as such. There are tests, which all derive from the multiprocessing test suite, and there are some additional multiprocess tests in pathos.

If you'd like to take this on, feel free to do so and submit a PR.