[TIP] [tox] Stale pyc files causing false positive test successes

Laurens Van Houtven _ at lvh.cc
Wed Oct 17 04:57:41 PDT 2012


On Tue, Oct 16, 2012 at 8:49 AM, holger krekel <holger at merlinux.eu> wrote:

> Hey Laurens,
>
> On Sun, Oct 14, 2012 at 17:39 +0200, Laurens Van Houtven wrote:
> > Hi guys,
> >
> >
> > I'm generally a pretty happy tox user, but recently I ran into something
> > that appears to have generated a false positive. Apparently I
> misunderstand
> > how tox works, because I figured this wouldn't be possible...
> >
> > Anyway, I removed a package (both the directory, the __init__.py and the
> > module inside of it), re-ran the tests,
>
> Did you re-run tox or tests directly in your own venv?
> Tox would actually sdist-package your project and i assume this
> should usually fail if a package is missing.  Or did you also remove
> it from setup.py?
>

Right, so, the issue was that it was a package, and it was still mentioned
in setup.py. Clearly an issue of PEBKAC, but I was expecting it to bomb out
more loudly?


> > and it worked fine. Later, when
> > actually trying to run the code in the venv, it broke --
>
> you invoked some .tox/*/bin/... i assume.
>

Yep.

    coverage run \
        {envdir}/bin/trial --temp-directory={envdir}/_trial
{posargs:myprojname}


> > there was still
> > something relying on importing that package but the tests didn't catch
> it.
>
> If you used tox above then that is indeed strange.
>
> > I honestly have no idea whatsoever how this happened. It's the first time
> > I've seen this behavior, despite it not being the first package I pruned.
> >
> > I guess the way to fix this is by recreating the environment? That seems
> to
> > have fixed the issue. I guess maybe in doing so I've also nuked any
> > possibility of further diagnosing the problem; hopefully the above
> > recollection is enough to ring a bell somewhere.
>
> --recreate is a good idea for a "does it really work" check
> when deleting files / dirs i think because without it we rely on
> distribute/distutils mechanics to do the proper thing when
> re-installing a package including pyc file handling.  For my quick
> experiment it worked fine, however.
>
> best,
> holger
>


-- 
cheers
lvh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20121017/d142215b/attachment.html>


More information about the testing-in-python mailing list