When trying to run tests with coverage under Django + django-nose in PyCharm, I can't seem to get the coverage report to work. I've tried with the bundled coverage.py and without. Without the bundled coverage.py I see:
Traceback (most recent call last): File "/Applications/PyCharm.app/Contents/helpers/coverage_runner/run_coverage.py", line 44, in <module> main() File "/Users/dane/.virtualenvs/dhp/lib/python3.5/site-packages/coverage/cmdline.py", line 741, in main status = CoverageScript().command_line(argv) File "/Users/dane/.virtualenvs/dhp/lib/python3.5/site-packages/coverage/cmdline.py", line 481, in command_line return self.do_run(options, args) File "/Users/dane/.virtualenvs/dhp/lib/python3.5/site-packages/coverage/cmdline.py", line 625, in do_run self.coverage.stop() File "/Users/dane/.virtualenvs/dhp/lib/python3.5/site-packages/coverage/control.py", line 692, in stop self.collector.stop() File "/Users/dane/.virtualenvs/dhp/lib/python3.5/site-packages/coverage/collector.py", line 277, in stop "Expected current collector to be %r, but it's %r" % (self, self._collectors[-1]) AssertionError: Expected current collector to be <Collector at 0x10e0cfbe0: CTracer>, but it's <Collector at 0x10fa368d0: CTracer> While with it I see:
Traceback (most recent call last): File "/Applications/PyCharm.app/Contents/helpers/coverage_runner/run_coverage.py", line 44, in <module> main() File "/Applications/PyCharm.app/Contents/helpers/coveragepy/coverage/cmdline.py", line 721, in main status = CoverageScript().command_line(argv) File "/Applications/PyCharm.app/Contents/helpers/coveragepy/coverage/cmdline.py", line 438, in command_line self.do_execute(options, args) File "/Applications/PyCharm.app/Contents/helpers/coveragepy/coverage/cmdline.py", line 580, in do_execute self.coverage.stop() File "/Applications/PyCharm.app/Contents/helpers/coveragepy/coverage/control.py", line 410, in stop self.collector.stop() File "/Applications/PyCharm.app/Contents/helpers/coveragepy/coverage/collector.py", line 294, in stop assert self._collectors[-1] is self AssertionError My tests and coverage reporting work correctly via the command line, i.e.:
$ python manage.py test I've set up a Run Configuration using the Django tests template and I'm not doing anything special or out of the ordinary, as far as I'm aware. Has anyone run into this and solved it? Coverage integration would be very useful!
Update
This issue has been opened with JetBrains here.