Tools

unittest2

  • Just a backport of the unittest stuff in Python 2.7+ to Python 2.6 and previous.

doctest

  • A way of testing Python code via docstrings and snippets in text files.

https://github.com/zopefoundation/ZODB/blob/master/src/ZODB/tests/testfsIndex.py#L197

nose

  • An alternate test runner for unittest and nose-specific tests.
$ pip install nose
$ nosetests sample

https://nose.readthedocs.org/en/latest/

py.test

  • An alternate test runner for unittest and pytest-specific tests.
$ pip install pytest
$ py.test --pyargs sample

http://pytest.org/latest/getting-started.html

tox

  • A way to test code under multiple versions of Python.

https://testrun.org/tox/latest/

Pyramid’s use of tox: https://github.com/Pylons/pyramid/blob/master/tox.ini

sphinx testing integration

  • Doctest using plugin.

http://sphinx-doc.org/ext/doctest.html

git bisect

  • Track down the commit that caused an issue.

http://www.sitepoint.com/automate-debugging-git-unit-tests/

Condition/Decision coverage

Instrumental: https://pypi.python.org/pypi/instrumental

>>> def foo(a):
...     return a == True or 2
...
>>> print foo(False)
2
>>> print foo(True)
True

Continuous Integration

Travis

Pyramid’s usage.

Jenkins

Pylons Project usage.

Workshop (second half of day)

Bring Your Own Code!