The pytest framework makes it easy to write small tests, yet scales to support complex functional testing
Latest commit b76104e Dec 14, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Use full link to changelog's README in PR template Oct 15, 2018
bench Apply reorder-python-imports to all files Oct 25, 2018
changelog Preparing release version 4.0.2 Dec 13, 2018
doc/en Preparing release version 4.0.2 Dec 13, 2018
extra Fix formatting of print() calls Nov 22, 2018
scripts [skip travis] Use retry script on AppVeyor Nov 26, 2018
src Raise `TypeError` for `with raises(..., match=<non-None falsey value>)`. Dec 12, 2018
testing Raise `TypeError` for `with raises(..., match=<non-None falsey value>)`. Dec 12, 2018
.coveragerc coverage: use modules for source Sep 19, 2018
.gitattributes Add codecov support to AppVeyor and remove coveralls Sep 5, 2018
.gitignore Ignore Sphinx's .doctrees folder Sep 14, 2018
.pre-commit-config.yaml Upgrade pyupgrade for crlf fixes (again) Oct 31, 2018
.travis.yml Travis: move faster builds to baseline Nov 13, 2018
AUTHORS Use pkg_resources.parse_version in minver check Nov 19, 2018
CHANGELOG.rst Preparing release version 4.0.2 Dec 13, 2018
CITATION Fix linting issues Jul 14, 2018
CONTRIBUTING.rst CI: use py37 instead of py36 by default Nov 12, 2018
HOWTORELEASE.rst doc: fix HOWTORELEASE.rst Nov 3, 2018
LICENSE Update copyright date in LICENSE and README.rst Jun 13, 2017
README.rst Replace coveralls' badge by codecov's Sep 6, 2018
appveyor.yml AppVeyor: run py{27,37}-xdist first Nov 13, 2018
pyproject.toml fix #4177 - pin setuptools>=40.0 Oct 17, 2018
setup.cfg fix url quotes in setup.cfg metadata Oct 16, 2018
setup.py setup.py: add "testing" extra requirement Nov 18, 2018
tox.ini Fix rtd by installing pygments-pytest Nov 24, 2018

README.rst

pytest
Code coverage Status https://travis-ci.org/pytest-dev/pytest.svg?branch=master https://ci.appveyor.com/api/projects/status/mrgbjaua7t33pg6b?svg=true

The pytest framework makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries.

An example of a simple test:

# content of test_sample.py
def inc(x):
    return x + 1


def test_answer():
    assert inc(3) == 5

To execute it:

$ pytest
============================= test session starts =============================
collected 1 items

test_sample.py F

================================== FAILURES ===================================
_________________________________ test_answer _________________________________

    def test_answer():
>       assert inc(3) == 5
E       assert 4 == 5
E        +  where 4 = inc(3)

test_sample.py:5: AssertionError
========================== 1 failed in 0.04 seconds ===========================

Due to pytest's detailed assertion introspection, only plain assert statements are used. See getting-started for more examples.

Features

  • Detailed info on failing assert statements (no need to remember self.assert* names);
  • Auto-discovery of test modules and functions;
  • Modular fixtures for managing small or parametrized long-lived test resources;
  • Can run unittest (or trial), nose test suites out of the box;
  • Python 2.7, Python 3.4+, PyPy 2.3, Jython 2.5 (untested);
  • Rich plugin architecture, with over 315+ external plugins and thriving community;

Documentation

For full documentation, including installation, tutorials and PDF documents, please see https://docs.pytest.org/en/latest/.

Bugs/Requests

Please use the GitHub issue tracker to submit bugs or request features.

Changelog

Consult the Changelog page for fixes and enhancements of each version.

License

Copyright Holger Krekel and others, 2004-2018.

Distributed under the terms of the MIT license, pytest is free and open source software.