Code Monkey home page Code Monkey logo

Comments (2)

jchodera avatar jchodera commented on June 12, 2024

This was added by #4, but how do I add this to travis for testing?

from assaytools.

jhprinz avatar jhprinz commented on June 12, 2024

Ah. It works similar to nosetest. Just put the line

- python ipnbdoctest.py [options] xyz_notebook.ipynb

This will then start a kernel, run all cells and check if they pass. If you put the option --strict then also the output has to match. It takes care of changing memory addresses and UUIDs automatically.
If it passes the tool exits with 0 signaling travis that the test passed. Otherwise it exits with 1 and travis assumes it failed.

It's a standalone script that requires 'ipython-notebook' and

import os,sys
import base64
import re
import argparse

This is the usage syntax:

>>> ipython jan-hendrikprinz$ python ipnbdoctest.py -h
usage: ipnbdoctest.py [-h] [--timeout TIMEOUT] [--strict] [--fail-if-timeout]
                      file.ipynb

Run all cell in an ipython notebook as a test and check whether these
successfully execute and compares their output to the one inside the notebook

positional arguments:
  file.ipynb         the notebook to be checked

optional arguments:
  -h, --help         show this help message and exit
  --timeout TIMEOUT  the default timeout time in seconds for a cell
                     evaluation. Default is 300s.
  --strict           if set to true then the default test is that cell have to
                     match otherwise a diff will not be considered a failed
                     test
  --fail-if-timeout  if set to true then a timeout is considered a failed test

The output looks like this:
exampleoutputipynbtest

from assaytools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.