The pytest framework makes it easy to write small tests, yet scales to support complex functional testing
Python
blueyed Merge pull request #3548 from blueyed/fix-docs
tox: clean up docs target
Latest commit b88e09a Aug 14, 2018
Permalink
Failed to load latest commit information.
.github Manage GH labels using the new 'labels' tool Jul 14, 2018
bench sort out flake8 issues and unicode name usage May 23, 2018
changelog Merge pull request #3795 from nicoddemus/changelog-3774 Aug 14, 2018
doc/en Add a changelog blurb and title, similar to tox Aug 4, 2018
extra sort out flake8 issues and unicode name usage May 23, 2018
scripts Enforce that changelog files are .rst Aug 1, 2018
src Merge pull request #3801 from nicoddemus/improve-warning-addoption Aug 14, 2018
testing Merge pull request #3780 from nicoddemus/mock-integration-fix Aug 9, 2018
.coveragerc Remove code for unsupported Python versions Oct 10, 2017
.gitattributes Use "union" merge strategy for CHANGELOG Aug 10, 2015
.gitignore switch to src layout May 26, 2018
.pre-commit-config.yaml Enforce that changelog files are .rst Aug 1, 2018
.travis.yml Use proper quotes for python 3.7 on travis.yml Jul 30, 2018
AUTHORS Fix truncated locals in verbose mode Jul 15, 2018
CHANGELOG.rst Add a changelog blurb and title, similar to tox Aug 4, 2018
CITATION Fix linting issues Jul 14, 2018
CONTRIBUTING.rst Improve contributing instructions regarding black/linting Jun 11, 2018
HOWTORELEASE.rst Revamp the release script: drop invoke and use tox directly Jul 14, 2018
LICENSE Update copyright date in LICENSE and README.rst Jun 13, 2017
README.rst Adjust copyright in README Jul 7, 2018
appveyor.yml Merge remote-tracking branch 'upstream/master' into release-3.7.0 Jul 30, 2018
pyproject.toml Use "pytest" on the CHANGELOG Jul 27, 2018
setup.cfg restore setuptools_scm write_to usage Apr 23, 2017
setup.py fix #3757 by pinning to pathlib2 that supports __fspath__ Aug 1, 2018
tox.ini Merge pull request #3548 from blueyed/fix-docs Aug 14, 2018

README.rst

pytest
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 http://docs.pytest.org.

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.