[IPython-dev] status of ipnbdoctest.py

Matthias Bussonnier bussonniermatthias at gmail.com
Tue Dec 23 06:46:52 EST 2014


Le 23 déc. 2014 à 12:06, Alistair Miles <alimanfoo at googlemail.com> a écrit :

> Just to say I'd also find this very useful. Dealing with random numbers can be worked around by setting the seed at the top of any notebooks you know you want to use as doc tests. Matplotlib plots would need some special handling as I believe the figure object ID ends up in the notebook output and this obviously changes each run. I've seen people work around this by stripping out object IDs before comparison, don't know what the best general solution would be but would be very useful for testing libraries for making plots. 



You can use that :

https://github.com/ipython/ipython/blob/master/IPython/nbconvert/preprocessors/tests/test_execute.py#L26-L45

and in general, if you yes ipynb, then you probably have IPython and nbconvert install, so you can use our infrastructure to 
test that re-executing notebook does not change the content. 
-- 
M

> 
> Cheers,
> Alistair
> 
> On Friday, 19 December 2014, Zoltán Vörös <zvoros at gmail.com> wrote:
> 
> On 12/19/2014 10:21 AM, Nathan Goldbaum wrote:
> > You can use runipy to script notebook evaluation:
> >
> > https://github.com/paulgb/runipy
> >
> > I don't think you can verify that the output isn't changing, but you
> > can at least check that cells aren't raising exceptions and view a
> > converted version of the evaluated notebook.  I think adding
> > functionality to verify that cell output isn't changing would be a
> > neat addition to runipy.
> >
> But there are cases, when the output changes, even if you run the same
> piece of code. Two examples that come to my mind are cells that involve
> the time/date in some way, and cells that operate on random numbers. It
> might also happen that some underlying data file that is plotted is
> modified between two executions. It might be really tricky to check for
> these cases.
> 
> Cheers,
> Zoltán
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
> 
> 
> -- 
> Alistair Miles
> Head of Epidemiological Informatics
> Centre for Genomics and Global Health <http://cggh.org>
> The Wellcome Trust Centre for Human Genetics
> Roosevelt Drive
> Oxford
> OX3 7BN
> United Kingdom
> Web: http://purl.org/net/aliman
> Email: alimanfoo at gmail.com
> Tel: +44 (0)1865 287721
> 
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20141223/250a7259/attachment.html>


More information about the IPython-dev mailing list