One thing that concerned me in this whole process is that the vast majority
of PyTest code appears to be behind a private API named `_pytest`. I was
unable to implement this plugin without accessing these APIs. I could find
no way around it. I minimized the imports as much as I could, even copying
smaller sections of code instead of importing, but I still had to make
these imports:

from _pytest.unittest import (
    TestCaseFunction,
    UnitTestCase,
)
from _pytest._code.code import TracebackEntry
from _pytest._code.source import Source
from _pytest.mark import MARK_GEN


How much are we going to be able to rely on these staying fairly stable?
I'd feel much better if these were public APIs. :-/

Thanks,

Nick


On Fri, Apr 27, 2018 at 3:06 PM, Floris Bruynooghe <f...@devork.be> wrote:

> Hi Nick,
>
> On Tue 24 Apr 2018 at 07:03 -0500, Nicholas Williams wrote:
>
> > Wow. After carefully reading the pytest-cov plugin (only) code and the
> > PyTest code that powers loading plugins, I figured it out. The plugin was
> > getting loaded before pytest-cov started the Coverage analyzer. Since the
> > plugin had module-level imports from other parts of our project, that
> meant
> > that most of the project was imported (and, so, module-level imports and
> > code and class definitions had already executed) before Coverage
> > started.
>
> Nice you figured this annoying issue out while I was ignoring my mail
> for a while... :)  This is a bit brittle but unavoidable unfortunately.
>
> > Thanks again for your help!
>
> Glad my vague pointers proved useful!
>
> Cheers,
> Floris
>
_______________________________________________
pytest-dev mailing list
pytest-dev@python.org
https://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to