2010-11-02 07:53:53 +08:00
|
|
|
|
2012-10-12 20:52:36 +08:00
|
|
|
.. _features:
|
2010-11-02 07:53:53 +08:00
|
|
|
|
2012-10-28 18:25:53 +08:00
|
|
|
pytest: helps you write better programs
|
2011-07-07 04:05:48 +08:00
|
|
|
=============================================
|
2010-11-06 06:37:31 +08:00
|
|
|
|
2012-10-09 20:35:17 +08:00
|
|
|
**a mature full-featured Python testing tool**
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2015-09-17 19:30:35 +08:00
|
|
|
- runs on Posix/Windows, Python 2.6-3.5, PyPy and (possibly still) Jython-2.5.1
|
2014-07-17 22:38:54 +08:00
|
|
|
- **well tested** with more than a thousand tests against itself
|
2013-12-17 14:58:49 +08:00
|
|
|
- **strict backward compatibility policy** for safe pytest upgrades
|
2011-07-09 19:23:58 +08:00
|
|
|
- :ref:`comprehensive online <toc>` and `PDF documentation <pytest.pdf>`_
|
2014-07-17 22:38:54 +08:00
|
|
|
- many :ref:`third party plugins <extplugins>` and :ref:`builtin helpers <pytest helpers>`,
|
2013-12-17 14:58:49 +08:00
|
|
|
- used in :ref:`many small and large projects and organisations <projects>`
|
2011-07-08 18:42:26 +08:00
|
|
|
- comes with many :ref:`tested examples <examples>`
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2012-10-09 20:35:17 +08:00
|
|
|
**provides easy no-boilerplate testing**
|
2011-07-07 04:05:48 +08:00
|
|
|
|
2014-07-17 22:38:54 +08:00
|
|
|
- makes it :ref:`easy to get started <getstarted>`,
|
2013-12-17 14:58:49 +08:00
|
|
|
has many :ref:`usage options <usage>`
|
2011-07-07 04:05:48 +08:00
|
|
|
- :ref:`assert with the assert statement`
|
|
|
|
- helpful :ref:`traceback and failing assertion reporting <tbreportdemo>`
|
2013-12-17 14:58:49 +08:00
|
|
|
- :ref:`print debugging <printdebugging>` and :ref:`the
|
2011-07-07 04:05:48 +08:00
|
|
|
capturing of standard output during test execution <captures>`
|
|
|
|
|
2012-10-09 20:35:17 +08:00
|
|
|
**scales from simple unit to complex functional testing**
|
2011-07-07 04:05:48 +08:00
|
|
|
|
2013-05-08 03:34:59 +08:00
|
|
|
- :ref:`modular parametrizeable fixtures <fixture>` (new in 2.3,
|
2014-10-14 06:12:01 +08:00
|
|
|
continuously improved)
|
2012-10-07 19:06:17 +08:00
|
|
|
- :ref:`parametrized test functions <parametrized test functions>`
|
2012-10-18 18:24:50 +08:00
|
|
|
- :ref:`mark`
|
2013-05-08 03:34:59 +08:00
|
|
|
- :ref:`skipping` (improved in 2.4)
|
2013-12-17 14:58:49 +08:00
|
|
|
- :ref:`distribute tests to multiple CPUs <xdistcpu>` through :ref:`xdist plugin <xdist>`
|
|
|
|
- :ref:`continuously re-run failing tests <looponfailing>`
|
2015-09-16 23:15:31 +08:00
|
|
|
- :doc:`cache`
|
2011-07-07 04:05:48 +08:00
|
|
|
- flexible :ref:`Python test discovery`
|
|
|
|
|
2013-12-17 14:58:49 +08:00
|
|
|
**integrates with other testing methods and tools**:
|
2011-07-07 04:05:48 +08:00
|
|
|
|
2014-07-17 22:38:54 +08:00
|
|
|
- multi-paradigm: pytest can run ``nose``, ``unittest`` and
|
2013-12-17 14:58:49 +08:00
|
|
|
``doctest`` style test suites, including running testcases made for
|
2012-10-25 19:48:31 +08:00
|
|
|
Django and trial
|
2012-10-09 20:35:17 +08:00
|
|
|
- supports :ref:`good integration practises <goodpractises>`
|
2011-07-07 04:05:48 +08:00
|
|
|
- supports extended :ref:`xUnit style setup <xunitsetup>`
|
|
|
|
- supports domain-specific :ref:`non-python tests`
|
2013-12-17 15:30:35 +08:00
|
|
|
- supports generating `test coverage reports
|
|
|
|
<https://pypi.python.org/pypi/pytest-cov>`_
|
2012-10-18 18:24:50 +08:00
|
|
|
- supports :pep:`8` compliant coding styles in tests
|
2011-07-07 04:05:48 +08:00
|
|
|
|
2012-10-09 20:35:17 +08:00
|
|
|
**extensive plugin and customization system**:
|
2011-07-07 04:05:48 +08:00
|
|
|
|
|
|
|
- all collection, reporting, running aspects are delegated to hook functions
|
2013-05-08 03:34:59 +08:00
|
|
|
- customizations can be per-directory, per-project or per PyPI released plugin
|
|
|
|
- it is easy to add command line options or customize existing behaviour
|
2015-04-25 17:29:11 +08:00
|
|
|
- :ref:`easy to write your own plugins <writing-plugins>`
|
2011-07-07 04:05:48 +08:00
|
|
|
|
2013-06-20 20:05:16 +08:00
|
|
|
|
2011-07-07 04:05:48 +08:00
|
|
|
.. _`easy`: http://bruynooghe.blogspot.com/2009/12/skipping-slow-test-by-default-in-pytest.html
|
2009-03-24 00:40:18 +08:00
|
|
|
|
2008-08-16 23:26:59 +08:00
|
|
|
|