{ "metadata": { "name": "", "signature": "sha256:ea75bfbf27b157a11c24a124c5f860dad378bfe8ebf22be5de39b606d604f7d2" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Testing Python Programs" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[back to main page](../index.ipynb)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Due to the dynamic character of the Python language, many potential programming\n", "errors are only detected at runtime.\n", "To find some of them at an earlier stage, you should use *unit tests*,\n", "*syntax checkers* and probably more ...\n", "\n", "https://wiki.python.org/moin/PythonTestingToolsTaxonomy" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Built-In Unit Testing" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[unittest](https://docs.python.org/3.4/library/unittest.html) (standard library)" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Testing Frameworks" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[nose](https://nose.readthedocs.org/en/latest/)\n", "\n", "[py.test](http://pytest.org/latest/)\n", "\n", "[tox](http://testrun.org/tox/latest/)" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Code Coverage" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "https://pypi.python.org/pypi/coverage\n", "\n", "But don't try to blindly increase coverage, read this first:\n", "[How to Misuse Code Coverage](http://www.exampler.com/testing-com/writings/coverage.pdf)" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Static Code Analysis" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[Syntax Checkers](syntax-checkers.ipynb)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

\n", " \n", " \"CC0\"\n", " \n", "
\n", " To the extent possible under law,\n", " \n", " Matthias Geier\n", " has waived all copyright and related or neighboring rights to\n", " this work.\n", "

" ] } ], "metadata": {} } ] }