[TIP] coverage.py against a server

Ned Batchelder ned at nedbatchelder.com
Wed Sep 18 03:20:24 PDT 2013

On 9/18/13 3:42 AM, Lucian Ciufudean wrote:
> Here is how I ran coverage:
>     coverage run --source=../src main.py
> main.py imports a pyc file that resides in the same folder. The source 
> of this pyc file is available in ../src.
> (I created main.py just to go around the bug that you submitted above)
You don't mention the exact errors you saw (details matter), but in your 
previous message you mentioned the problem being while reporting.  
You'll also have to specify the source directory during the "coverage 
html" command (or coverage.html() call).  A good way to do this is with 
a .coveragerc file.


> Lucian
> On Wed, Sep 18, 2013 at 5:05 AM, Ned Batchelder <ned at nedbatchelder.com 
> <mailto:ned at nedbatchelder.com>> wrote:
>     On 9/17/13 7:42 AM, Lucian Ciufudean wrote:
>>     Hi guys,
>>     I embarked on the road of obtaining a coverage report for
>>     functional tests against a server process. The server is deployed
>>     as .pyc files, and the source files can be made available in a
>>     separate subversion working folder. I wouldn't want to edit any
>>     existing .py files.
>>     Can coverage work with .pyc files - I am getting errors when
>>     using coverage run main.pyc from the command line, so maybe with
>>     the API?
>     Hmm, you're right: "coverage run foo.pyc" does not work. I've
>     created a ticket for this:
>     https://bitbucket.org/ned/coveragepy/issue/264/coverage-wont-run-pyc-files
>>     I tired this also, my custom code is run but it can not find the
>>     source files at the time of coverage.html_report() although I
>>     passed the directory of source files to coverage.coverage.
>     You'll have to show details of how you tried to run coverage.  If
>     the .py files are in the places reported by your program, then it
>     should work.  You can also use the [paths] section of a
>     .coveragerc to instruct coverage where the files are.
>     --Ned.
>>     Thanks a lot,
>>     Lucian
>>     _______________________________________________
>>     testing-in-python mailing list
>>     testing-in-python at lists.idyll.org  <mailto:testing-in-python at lists.idyll.org>
>>     http://lists.idyll.org/listinfo/testing-in-python

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20130918/9d864b2f/attachment.html>

More information about the testing-in-python mailing list