1.. image:: http://docs.pytest.org/en/latest/_static/pytest1.png
2   :target: http://docs.pytest.org
3   :align: center
4   :alt: pytest
5
6------
7
8.. image:: https://img.shields.io/pypi/v/pytest.svg
9    :target: https://pypi.python.org/pypi/pytest
10
11.. image:: https://anaconda.org/conda-forge/pytest/badges/version.svg
12    :target: https://anaconda.org/conda-forge/pytest
13
14.. image:: https://img.shields.io/pypi/pyversions/pytest.svg
15    :target: https://pypi.python.org/pypi/pytest
16
17.. image:: https://img.shields.io/coveralls/pytest-dev/pytest/master.svg
18    :target: https://coveralls.io/r/pytest-dev/pytest
19
20.. image:: https://travis-ci.org/pytest-dev/pytest.svg?branch=master
21    :target: https://travis-ci.org/pytest-dev/pytest
22
23.. image:: https://ci.appveyor.com/api/projects/status/mrgbjaua7t33pg6b?svg=true
24    :target: https://ci.appveyor.com/project/pytestbot/pytest
25
26The ``pytest`` framework makes it easy to write small tests, yet
27scales to support complex functional testing for applications and libraries.
28
29An example of a simple test:
30
31.. code-block:: python
32
33    # content of test_sample.py
34    def inc(x):
35        return x + 1
36
37    def test_answer():
38        assert inc(3) == 5
39
40
41To execute it::
42
43    $ pytest
44    ============================= test session starts =============================
45    collected 1 items
46
47    test_sample.py F
48
49    ================================== FAILURES ===================================
50    _________________________________ test_answer _________________________________
51
52        def test_answer():
53    >       assert inc(3) == 5
54    E       assert 4 == 5
55    E        +  where 4 = inc(3)
56
57    test_sample.py:5: AssertionError
58    ========================== 1 failed in 0.04 seconds ===========================
59
60
61Due to ``pytest``'s detailed assertion introspection, only plain ``assert`` statements are used. See `getting-started <http://docs.pytest.org/en/latest/getting-started.html#our-first-test-run>`_ for more examples.
62
63
64Features
65--------
66
67- Detailed info on failing `assert statements <http://docs.pytest.org/en/latest/assert.html>`_ (no need to remember ``self.assert*`` names);
68
69- `Auto-discovery
70  <http://docs.pytest.org/en/latest/goodpractices.html#python-test-discovery>`_
71  of test modules and functions;
72
73- `Modular fixtures <http://docs.pytest.org/en/latest/fixture.html>`_ for
74  managing small or parametrized long-lived test resources;
75
76- Can run `unittest <http://docs.pytest.org/en/latest/unittest.html>`_ (or trial),
77  `nose <http://docs.pytest.org/en/latest/nose.html>`_ test suites out of the box;
78
79- Python 2.7, Python 3.4+, PyPy 2.3, Jython 2.5 (untested);
80
81- Rich plugin architecture, with over 315+ `external plugins <http://plugincompat.herokuapp.com>`_ and thriving community;
82
83
84Documentation
85-------------
86
87For full documentation, including installation, tutorials and PDF documents, please see http://docs.pytest.org.
88
89
90Bugs/Requests
91-------------
92
93Please use the `GitHub issue tracker <https://github.com/pytest-dev/pytest/issues>`_ to submit bugs or request features.
94
95
96Changelog
97---------
98
99Consult the `Changelog <http://docs.pytest.org/en/latest/changelog.html>`__ page for fixes and enhancements of each version.
100
101
102License
103-------
104
105Copyright Holger Krekel and others, 2004-2017.
106
107Distributed under the terms of the `MIT`_ license, pytest is free and open source software.
108
109.. _`MIT`: https://github.com/pytest-dev/pytest/blob/master/LICENSE
110