You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m working on a wxPython app in windows, and I’ve given some of my source files the .pyw extension so that they open without a console window.
From the command prompt, when I do ‘coverage run test_mop.py’ it runs without complaint, but when I subsequently try ‘coverage report’ it gives me a NoSource error like this:
C:\Users\twasserm\Desktop\workspace\FDS\test>coverage report
Name Stmts Miss Cover
-------------------------------------------------------------------------
C:\Users\twasserm\Desktop\workspace\FDS\src\fdsutil 49 25 49%
C:\Users\twasserm\Desktop\workspace\FDS\src\mop NoSource: No source for code: 'C:\Users\twasserm\Desktop\workspace\FDS\src\mop.py'
test_mop 44 0 100%
-------------------------------------------------------------------------
TOTAL 93 25 73%
The mop.py source file that coverage report is looking for is actually mop.pyw. fdsutil has a standard .py extension and is correctly processed. When I make a copy of mop.pyw as mop.py, ‘coverage report’ picks it up immediately (without having to do coverage run again):
C:\Users\twasserm\Desktop\workspace\FDS\test>coverage report
Name Stmts Miss Cover
-------------------------------------------------------------------------
C:\Users\twasserm\Desktop\workspace\FDS\src\fdsutil 49 25 49%
C:\Users\twasserm\Desktop\workspace\FDS\src\mop 121 73 40%
test_mop 44 0 100%
-------------------------------------------------------------------------
TOTAL 214 98 54%
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;
#!python
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 test(.pyw) just the same.
[Reported by Timothy Wasserman]
(OS = Win7, Coverage version = 3.6, Python = 2.7.3, wxPython = 2.8.12.1)
I’m working on a wxPython app in windows, and I’ve given some of my source files the .pyw extension so that they open without a console window.
From the command prompt, when I do ‘coverage run test_mop.py’ it runs without complaint, but when I subsequently try ‘coverage report’ it gives me a NoSource error like this:
The mop.py source file that coverage report is looking for is actually mop.pyw. fdsutil has a standard .py extension and is correctly processed. When I make a copy of mop.pyw as mop.py, ‘coverage report’ picks it up immediately (without having to do coverage run again):
The text was updated successfully, but these errors were encountered: