nedbat / django_coverage_plugin

A plugin for coverage.py to measure Django template execution
Apache License 2.0
197 stars 35 forks source link

Cannot generate XML coverage report #9

Closed jessamynsmith closed 9 years ago

jessamynsmith commented 9 years ago

I noticed this in PyCharm, because it uses the XML report, but it occurs from the command line as well.

$ coverage xml
Coverage.py warning: Setting timid=True to support plugins.
Traceback (most recent call last):
  File "/Users/jessamyn/.virtualenvs/eggtimer3/bin/coverage", line 9, in <module>
    load_entry_point('coverage==4.0a4', 'console_scripts', 'coverage')()
  File "/Users/jessamyn/.virtualenvs/eggtimer3/lib/python3.4/site-packages/coverage/cmdline.py", line 669, in main
    status = CoverageScript().command_line(argv)
  File "/Users/jessamyn/.virtualenvs/eggtimer3/lib/python3.4/site-packages/coverage/cmdline.py", line 452, in command_line
    total = self.coverage.xml_report(outfile=outfile, **report_args)
  File "/Users/jessamyn/.virtualenvs/eggtimer3/lib/python3.4/site-packages/coverage/control.py", line 955, in xml_report
    return reporter.report(morfs, outfile=outfile)
  File "/Users/jessamyn/.virtualenvs/eggtimer3/lib/python3.4/site-packages/coverage/xmlreport.py", line 59, in report
    self.report_files(self.xml_file, morfs)
  File "/Users/jessamyn/.virtualenvs/eggtimer3/lib/python3.4/site-packages/coverage/report.py", line 80, in report_files
    report_fn(cu, self.coverage._analyze(cu))
  File "/Users/jessamyn/.virtualenvs/eggtimer3/lib/python3.4/site-packages/coverage/xmlreport.py", line 124, in xml_file
    filename = cu.file_locator.relative_filename(cu.filename)
AttributeError: 'FileReporter' object has no attribute 'file_locator'
nedbat commented 9 years ago

This is fixed by a change in coverage.py: https://bitbucket.org/ned/coveragepy/commits/7fd1c40f2001cbaddada0a62c4e445d55182d45f