I have two files;
import coverage cov = coverage.coverage(source = ['target']) cov.start() import target cov.stop() print cov.html_report()
def foo(): pass
When I run test.py with target.py it outputs, as expected; 50.0 But when I rename target.py in to target.pyw, test.py outputs;
Coverage.py warning: Module target has no Python source. Coverage.py warning: No data was collected. Traceback (most recent call last): File "test.py", line 6, in <module> print cov.html_report() File "c:\Python27\lib\site-packages\coverage\control.py", line 662, in html_report return reporter.report(morfs) File "c:\Python27\lib\site-packages\coverage\html.py", line 113, in report self.report_files(self.html_file, morfs, self.config.html_dir) File "c:\Python27\lib\site-packages\coverage\report.py", line 76, in report_files raise CoverageException("No data to report.") coverage.misc.CoverageException: No data to report.
How do I run coverage programmatically with .pyw files?
Note that Python imports both target.py and with .pyw just the same.