[python-committers] Codecov and PR

Brett Cannon brett at python.org
Fri Apr 28 12:45:45 EDT 2017


On Fri, 28 Apr 2017 at 02:19 Michael Foord <michael at voidspace.org.uk> wrote:

>
>
> On 28/04/17 01:49, Terry Reedy wrote:
> > On 4/27/2017 3:44 PM, Brett Cannon wrote:
> >>
> >>
> >> On Wed, 26 Apr 2017 at 22:36 Terry Reedy <tjreedy at udel.edu
> >> <mailto:tjreedy at udel.edu>> wrote:
> >>
> >>     On 4/26/2017 1:45 PM, Brett Cannon wrote:
> >
> >>      > E.g. I don't expect
> >>      > test_importlib to be directly responsible for exercising all
> >> code in
> >>      > importlib, just that Python's entire test suite exercise
> >> importlib as
> >>      > much as possible as a whole.
> >>
> >>     The advantage for importlib in this respect is that import
> >> statements
> >>     cannot be mocked; only the objects imported, after importlib is
> >>     finished.
> >>
> >>
> >> Oh, you can mock import statements. :)
> >
> > Other than by pre-loading a mock module into sys.modules?
> > If so, please give a hint, as this could be useful to me.
>
>
> https://docs.python.org/3/library/unittest.mock-examples.html#mocking-imports-with-patch-dict


The other option is to stub out __import__() itself.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-committers/attachments/20170428/5f0138ff/attachment.html>


More information about the python-committers mailing list