[TIP] Can pytest identify python code that has no test

Bruno Oliveira nicoddemus at gmail.com
Fri Jan 4 11:36:31 PST 2019


On Fri, Jan 4, 2019 at 5:34 PM DZIOBEK, JOE <jd5948 at att.com> wrote:

>
> PS: Bruno, your idea with adding the import to the __init__.py file is
> good, but requires someone to update that file, probably the same person
> that forgot to write the test.py;
>

I see, but anyway I completely missed your --source=. parameter, so I defer
to our coverage expert. :)

Cheers,
Bruno


>
>
> Thanks for your help,
>
> Regards - Joe
>
>
>
> *From:* testing-in-python-bounces at lists.idyll.org [mailto:
> testing-in-python-bounces at lists.idyll.org] *On Behalf Of *Ned Batchelder
> *Sent:* Friday, January 04, 2019 11:59 AM
> *To:* testing-in-python at lists.idyll.org
> *Subject:* Re: [TIP] Can pytest identify python code that has no test
>
>
>
> Joe, since you have specified "--source=.", coverage will search your tree
> for importable Python files, and report on them even if they are never
> imported.  So you are already doing the right thing. I'm not sure why it
> wouldn't show you that file.  Are you sure you are running the commands you
> showed?
>
> --Ned.
>
> On 1/4/19 11:42 AM, Bruno Oliveira wrote:
>
> Hi Joe,
>
> On Fri, Dec 21, 2018 at 5:06 PM DZIOBEK, JOE <jd5948 at att.com> wrote:
>
> Is there a way to have this file included in the report?
>
>
>
> You are not seeing coverage information for scriptB.py not because it does
> not have an associated test file, but because it was never imported during
> the run (I'm assuming).
>
>
>
> One way to have it to appear on the report is to import scriptB on your
> __init__.py file, this way its coverage will be tracked.
>
>
>
> Hope this helps,
>
> Bruno
>
>
>
> _______________________________________________
>
> testing-in-python mailing list
>
> testing-in-python at lists.idyll.org
>
> http://lists.idyll.org/listinfo/testing-in-python <https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.idyll.org_listinfo_testing-2Din-2Dpython&d=DwMDaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=HqXpIkByGFw24obqdoDmDw&m=pzoCcDdzPm0JZq_KFlE4flon2ylEw7Wn8WlOaZn3xgc&s=LZn-2waQlWLtBfotLco8eIxWEeII9mXtCXPlJ8rxaos&e=>
>
> _______________________________________________
> testing-in-python mailing list
> 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/20190104/9ec2b659/attachment.htm>


More information about the testing-in-python mailing list