All Projects → ReviewNB → Treon

ReviewNB / Treon

Licence: mit
Easy to use test framework for Jupyter Notebooks

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Treon

flake8-assertive
Flake8 unittest assert method checker
Stars: ✭ 30 (-88.46%)
Mutual labels:  unittest
JUnitPerf
API performance testing framework built using JUnit
Stars: ✭ 48 (-81.54%)
Mutual labels:  unittest
utx
对Python unittest的功能进行了扩展(用例排序,分组,数据驱动,可视化报告等)
Stars: ✭ 132 (-49.23%)
Mutual labels:  unittest
aiounittest
Test python asyncio-based code with ease.
Stars: ✭ 53 (-79.62%)
Mutual labels:  unittest
emock
🐞 下一代C/C++跨平台mock库 (Next generation cross-platform mock library for C/C++)
Stars: ✭ 73 (-71.92%)
Mutual labels:  unittest
AtOffer
剑指offer Java代码 部分Go
Stars: ✭ 29 (-88.85%)
Mutual labels:  unittest
curso-javascript-testes
Código-fonte do curso "Aprenda a testar Aplicações Javascript"
Stars: ✭ 60 (-76.92%)
Mutual labels:  unittest
Helm Unittest
BDD styled unit test framework for Kubernetes Helm charts as a Helm plugin.
Stars: ✭ 256 (-1.54%)
Mutual labels:  unittest
specdris
A test framework for Idris
Stars: ✭ 55 (-78.85%)
Mutual labels:  unittest
MockDataGenerator
Generate mock data for POCO
Stars: ✭ 12 (-95.38%)
Mutual labels:  unittest
NYTimes-iOS
🗽 NY Times is an Minimal News 🗞 iOS app 📱 built to describe the use of SwiftSoup and CoreData with SwiftUI🔥
Stars: ✭ 152 (-41.54%)
Mutual labels:  unittest
helm-unittest
BDD styled unit test framework for Kubernetes Helm charts as a Helm plugin.
Stars: ✭ 276 (+6.15%)
Mutual labels:  unittest
road-to-orleans
This repository illustrates the road to orleans with practical, real-life examples. From most basic, to more advanced techniques.
Stars: ✭ 55 (-78.85%)
Mutual labels:  unittest
unigen
A unit test generator for PHP
Stars: ✭ 22 (-91.54%)
Mutual labels:  unittest
fake-sftp-server-rule
A JUnit rule that runs an in-memory SFTP server.
Stars: ✭ 34 (-86.92%)
Mutual labels:  unittest
Wasmite
Now WebAssembly has proper testing, unit-testing and debugging 🤗
Stars: ✭ 20 (-92.31%)
Mutual labels:  unittest
Interface TestPlatform
python3+django+requests+ddt+unittest接口自动化测试平台
Stars: ✭ 52 (-80%)
Mutual labels:  unittest
Unittest Xml Reporting
unittest-based test runner with Ant/JUnit like XML reporting.
Stars: ✭ 255 (-1.92%)
Mutual labels:  unittest
flask-rest-api
This program shows how to set up a flaskrestapi with postgre db, blueprint, sqlalchemy, marshmallow, wsgi, unittests
Stars: ✭ 28 (-89.23%)
Mutual labels:  unittest
StatePrinter
Automating unit testing and ToString() coding
Stars: ✭ 89 (-65.77%)
Mutual labels:  unittest

treon

PyPI version Build Status

Easy to use test framework for Jupyter Notebooks.

  • Runs notebook top to bottom and flags execution errors if any
  • Runs unittest present in your notebook code cells
  • Runs doctest present in your notebook code cells

Why should you use it?

  • Start testing notebooks without writing a single line of test code
  • Multithreaded execution for quickly testing a set of notebooks
  • Executes every Notebook in a fresh kernel to avoid hidden state problems
  • Primarily a command line tool that can be used easily in any Continuous Integration (CI) system

Installation

pip install treon

Usage

$ treon
Executing treon version 0.1.0
Recursively scanning /workspace/treon/tmp/docs/site/ru/guide for Notebooks...

-----------------------------------------------------------------------
Collected following Notebooks for testing
-----------------------------------------------------------------------
/workspace/treon/tmp/docs/site/ru/guide/keras.ipynb
/workspace/treon/tmp/docs/site/ru/guide/eager.ipynb
-----------------------------------------------------------------------

Triggered test for /workspace/treon/tmp/docs/site/ru/guide/keras.ipynb
Triggered test for /workspace/treon/tmp/docs/site/ru/guide/eager.ipynb

test_sum (__main__.TestNotebook) ...
ok
test_sum (__main__.TestNotebook2) ...
ok
test_sum (__main__.TestNotebook3) ...
ok

----------------------------------------------------------------------
Ran 3 tests in 0.004s

OK

-----------------------------------------------------------------------
TEST RESULT
-----------------------------------------------------------------------
/workspace/treon/tmp/docs/site/ru/guide/keras.ipynb       -- PASSED
/workspace/treon/tmp/docs/site/ru/guide/eager.ipynb       -- PASSED
-----------------------------------------------------------------------
2 succeeded, 0 failed, out of 2 notebooks tested.
-----------------------------------------------------------------------

Command line arguments

Usage:
  treon
  treon [PATH] [--threads=<number>] [-v] [--exclude=<string>]...

Arguments:
  PATH                File or directory path to find notebooks to test. Searches recursively for directory paths. [default: current working directory]

Options:
  --threads=<number>  Number of parallel threads. Each thread processes one notebook file at a time. [default: 10]
  -e=<string> --exclude=<string>  Option for excluding files or entire directories from testing. All files whose
                      absolute path starts with the specified string are excluded from testing. This option can be
                      specified more than once to exclude multiple files or directories. If the exclude path is
                      a valid directory name, only this directory is excluded.
  -v --verbose        Print detailed output for debugging.
  -h --help           Show this screen.
  --version           Show version.

unittest example

You just need to add tests as shown below & treon would execute them and report the result on the console. See this for more details on how to write unittest.

doctest example

You just need to add tests as shown below & treon would execute them and report the result on the console. See this for more details on how to write doctest.

Note about dependencies

  • You need to run treon from environment (virtualenv/pipenv etc.) that has all the dependencies required for Notebooks under test
  • treon only works with python3+ environments and uses python3 kernel for executing notebooks

Development

For development, you may use below to create a Python interpreter that resides in venv in the current working directory, and to install all of treon's dependencies:

$ virtualenv venv
$ source venv/bin/activate
$ pip install -e .
$ pip install -r requirements-dev.txt
$ treon --help # should work

Because the script installs the package as editable, you can make changes in the source tree and use the treon command to immediately validate them. If this does not appear to work, check that you are using a the proper virtual environment, and that the package is indeed installed in editable mode:

$ which treon # should point into your virtualenv
/path/to/my/venv/bin/treon
$ pip list --local | grep treon # should point to the source tree
treon                0.1.3                /workspace/treon

Please refer to the Makefile for supplementary development tasks. In particular, the following targets may be relevant when validating changes before committing:

$ make lint # check treon's source for code style errors
$ make test # run all tests

Motivation

Our aim at ReviewNB is to make notebooks a first class entity in the production workflow. We've built a code review system for Notebooks. The next step is to build a CI pipeline & treon is the core tool in that effort. It is licensed liberally (MIT) & I foresee it being used as an independent tool as well. You can use it locally and/or integrate with CI system of your choice.

For motivation, checkout Netflix's blog to see how notebooks are graduating from scratchpad to a part of production workflow.

Contribute

If you see any problem, open an issue or send a pull request. You can write to [email protected] for any questions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].