Let's say I create this simple module and call it MyModule.py:
print 'thread working...'
print 'thread complete'
print 'process working...'
print 'process complete'
workerThread = threading.Thread(target=workerThreaded)
workerProcess = multiprocessing.Process(target=workerProcessed)
if __name__ == '__main__':
And then I throw this together to unit test it:
(I know this isn't a good unit test because it doesn't actually TEST it, it just runs it, but that's not relevant to my question)
If I run this unit test in PyCharm with code coverage, then it only shows the code inside the workerThreaded() and main() functions as being covered, even though it clearly covers the workerProcessed() function as well.
How do I get PyCharm to include code that was started in a new process process in its code coverage? Also, how can I get it to include the if __name__ == '__main__': block as well?
I'm running PyCharm 2.7.3, as well as Python 2.7.3.