Testing is very important for every project in today's world. Python has testing frameworks like unittest, nose, pytest, mamba etc. Web testing with selenium, splinter and fake data using faker, fake2db.


Libraries for testing codebases and generating test data.

Testing Frameworks

  • unittest - (Python standard library) Unit testing framework.
  • contexts - A BDD framework for Python 3.3+. Inspired by C#'s Machine.Specifications.
  • behave - behave is behavior-driven development, Python style.
  • hypothesis - Hypothesis is an advanced Quickcheck style property based testing library.
  • mamba - The definitive testing tool for Python. Born under the banner of BDD.
  • nose - nose extends unittest.
  • pyshould - Should style asserts based on PyHamcrest.
  • pytest - A mature full-featured Python testing tool.
  • pyvows - BDD style testing for Python. Inspired by Vows.js.
  • Robot Framework - A generic test automation framework.
  • Slash - A highly customizable testing framework written in Python
  • Doctest - Test interactive Python examples

Web Testing

  • Selenium - Python bindings for Selenium WebDriver.
  • locust - Scalable user load testing tool written in Python.
  • sixpack - A language-agnostic A/B Testing framework.
  • splinter - Open source tool for testing web applications.


  • doublex - Powerful test doubles framework for Python.
  • freezegun - Travel through time by mocking the datetime module.
  • httmock - A mocking library for requests for Python 2.6+ and 3.2+.
  • httpretty - HTTP request mock tool for Python.
  • mock - A Python Mocking and Patching Library for Testing.
  • responses - A utility library for mocking out the requests Python library.
  • betamax - Testing apps that use requests without using mock

Code Coverage

Fake Data

  • factory_boy - A test fixtures replacement for Python.
  • fake2db - Fake database generator.
  • faker - A Python package that generates fake data.
  • mixer - Another fixtures replacement. Supported Django, Flask, SQLAlchemy, Peewee and etc.
  • model_mommy - Creating random fixtures for testing in Django.
  • radar - Generate random datetime / time.

Error Handler

  • FuckIt.py - FuckIt.py uses state-of-the-art technology to make sure your Python code runs whether it has any right to or not.

Code Analysis and Linter

Libraries and tools for analysing, parsing and manipulation codebases.

Code Analysis

  • code2flow - Turn your Python and JavaScript code into DOT flowcharts.
  • pycallgraph - A library that visualises the flow (call graph) of your Python application.
  • pysonar2 - A type inferencer and indexer for Python.


  • Flake8 - The modular source code checker: pep8, pyflakes and co.
  • pylama - Code audit tool for Python and JavaScript.
  • Pylint - A source code analyzer.

Debugging Tools

Libraries for debugging code.

  • ipdb - IPython-enabled pdb.
  • django-debug-toolbar - Display various debug information about the current request/response.
  • django-devserver - A drop-in replacement for Django's runserver.
  • flask-debugtoolbar - A port of the django-debug-toolbar to flask.
  • line_profiler - Line-by-line profiling.
  • memory_profiler - Monitor Memory usage of Python code.
  • profiling - An interactive Python profiler.
  • pudb – A full-screen, console-based Python debugger.
  • pyelftools - A pure-Python library for parsing and analyzing ELF files and DWARF debugging information.
  • pyringe - Debugger capable of attaching to and injecting code into Python processes.
  • python-statsd - Python Client for the statsd server.
  • wdb - An improbable web debugger through WebSockets.
  • winpdb - A Platform Independent Python Debugger with GUI, capable of remote debugging based on rpdb2.


The following people helped in creating the above content.