.pyw files aren't reported properly · Issue #261 · nedbat/coveragepy (original) (raw)

[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:

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%