Merge remote-tracking branch 'upstream/features' into jonozzz/features

This commit is contained in:
Bruno Oliveira 2018-07-05 18:15:17 -03:00
commit 3c19370cec
288 changed files with 16932 additions and 12480 deletions

2
.gitignore vendored
View File

@ -19,7 +19,7 @@ include/
.hypothesis/ .hypothesis/
# autogenerated # autogenerated
_pytest/_version.py src/_pytest/_version.py
# setuptools # setuptools
.eggs/ .eggs/

36
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,36 @@
exclude: doc/en/example/py2py3/test_py2.py
repos:
- repo: https://github.com/ambv/black
rev: 18.6b4
hooks:
- id: black
args: [--safe, --quiet]
language_version: python3.6
- repo: https://github.com/asottile/blacken-docs
rev: v0.2.0
hooks:
- id: blacken-docs
additional_dependencies: [black==18.6b4]
language_version: python3.6
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
exclude: _pytest/debugging.py
- id: flake8
- repo: https://github.com/asottile/pyupgrade
rev: v1.2.0
hooks:
- id: pyupgrade
- repo: local
hooks:
- id: rst
name: rst
entry: rst-lint --encoding utf-8
files: ^(CHANGELOG.rst|HOWTORELEASE.rst|README.rst|changelog/.*)$
language: python
additional_dependencies: [pygments, restructuredtext_lint]
python_version: python3.6

View File

@ -1,5 +1,9 @@
sudo: false sudo: false
language: python language: python
stages:
- linting
- test
- deploy
python: python:
- '3.6' - '3.6'
install: install:
@ -9,7 +13,7 @@ env:
# coveralls is not listed in tox's envlist, but should run in travis # coveralls is not listed in tox's envlist, but should run in travis
- TOXENV=coveralls - TOXENV=coveralls
# note: please use "tox --listenvs" to populate the build matrix below # note: please use "tox --listenvs" to populate the build matrix below
- TOXENV=linting # please remove the linting env in all cases
- TOXENV=py27 - TOXENV=py27
- TOXENV=py34 - TOXENV=py34
- TOXENV=py36 - TOXENV=py36
@ -33,8 +37,8 @@ jobs:
python: 'pypy-5.4' python: 'pypy-5.4'
- env: TOXENV=py35 - env: TOXENV=py35
python: '3.5' python: '3.5'
- env: TOXENV=py35-freeze - env: TOXENV=py36-freeze
python: '3.5' python: '3.6'
- env: TOXENV=py37 - env: TOXENV=py37
python: 'nightly' python: 'nightly'
@ -53,6 +57,14 @@ jobs:
on: on:
tags: true tags: true
repo: pytest-dev/pytest repo: pytest-dev/pytest
- stage: linting
python: '3.6'
env:
install:
- pip install pre-commit
- pre-commit install-hooks
script:
- pre-commit run --all-files
script: tox --recreate script: tox --recreate
@ -65,3 +77,7 @@ notifications:
skip_join: true skip_join: true
email: email:
- pytest-commit@python.org - pytest-commit@python.org
cache:
directories:
- $HOME/.cache/pip
- $HOME/.cache/pre-commit

View File

@ -23,6 +23,7 @@ Antony Lee
Armin Rigo Armin Rigo
Aron Coyle Aron Coyle
Aron Curzon Aron Curzon
Aviral Verma
Aviv Palivoda Aviv Palivoda
Barney Gale Barney Gale
Ben Webb Ben Webb
@ -81,6 +82,7 @@ Greg Price
Grig Gheorghiu Grig Gheorghiu
Grigorii Eremeev (budulianin) Grigorii Eremeev (budulianin)
Guido Wesdorp Guido Wesdorp
Guoqiang Zhang
Harald Armin Massa Harald Armin Massa
Henk-Jaap Wagenaar Henk-Jaap Wagenaar
Hugo van Kemenade Hugo van Kemenade
@ -125,6 +127,7 @@ Maik Figura
Mandeep Bhutani Mandeep Bhutani
Manuel Krebber Manuel Krebber
Marc Schlaich Marc Schlaich
Marcelo Duarte Trevisani
Marcin Bachry Marcin Bachry
Mark Abramowitz Mark Abramowitz
Markus Unterwaditzer Markus Unterwaditzer
@ -146,6 +149,7 @@ Michael Seifert
Michal Wajszczuk Michal Wajszczuk
Mihai Capotă Mihai Capotă
Mike Lundy Mike Lundy
Miro Hrončok
Nathaniel Waisbrot Nathaniel Waisbrot
Ned Batchelder Ned Batchelder
Neven Mundar Neven Mundar
@ -155,6 +159,7 @@ Oleg Sushchenko
Oliver Bestwalter Oliver Bestwalter
Omar Kohl Omar Kohl
Omer Hadari Omer Hadari
Ondřej Súkup
Patrick Hayes Patrick Hayes
Paweł Adamczak Paweł Adamczak
Pedro Algarvio Pedro Algarvio
@ -178,6 +183,7 @@ Ryan Wooden
Samuel Dion-Girardeau Samuel Dion-Girardeau
Samuele Pedroni Samuele Pedroni
Segev Finer Segev Finer
Serhii Mozghovyi
Simon Gomizelj Simon Gomizelj
Skylar Downes Skylar Downes
Srinivas Reddy Thatiparthy Srinivas Reddy Thatiparthy
@ -202,6 +208,7 @@ Victor Uriarte
Vidar T. Fauske Vidar T. Fauske
Vitaly Lashmanov Vitaly Lashmanov
Vlad Dragos Vlad Dragos
Wil Cooley
William Lee William Lee
Wouter van Ackooy Wouter van Ackooy
Xuan Luong Xuan Luong

View File

@ -8,6 +8,228 @@
.. towncrier release notes start .. towncrier release notes start
Pytest 3.6.3 (2018-07-04)
=========================
Bug Fixes
---------
- Fix ``ImportWarning`` triggered by explicit relative imports in
assertion-rewritten package modules. (`#3061
<https://github.com/pytest-dev/pytest/issues/3061>`_)
- Fix error in ``pytest.approx`` when dealing with 0-dimension numpy
arrays. (`#3593 <https://github.com/pytest-dev/pytest/issues/3593>`_)
- No longer raise ``ValueError`` when using the ``get_marker`` API. (`#3605
<https://github.com/pytest-dev/pytest/issues/3605>`_)
- Fix problem where log messages with non-ascii characters would not
appear in the output log file.
(`#3630 <https://github.com/pytest-dev/pytest/issues/3630>`_)
- No longer raise ``AttributeError`` when legacy marks can't be stored in
functions. (`#3631 <https://github.com/pytest-dev/pytest/issues/3631>`_)
Improved Documentation
----------------------
- The description above the example for ``@pytest.mark.skipif`` now better
matches the code. (`#3611
<https://github.com/pytest-dev/pytest/issues/3611>`_)
Trivial/Internal Changes
------------------------
- Internal refactoring: removed unused ``CallSpec2tox ._globalid_args``
attribute and ``metafunc`` parameter from ``CallSpec2.copy()``. (`#3598
<https://github.com/pytest-dev/pytest/issues/3598>`_)
- Silence usage of ``reduce`` warning in Python 2 (`#3609
<https://github.com/pytest-dev/pytest/issues/3609>`_)
- Fix usage of ``attr.ib`` deprecated ``convert`` parameter. (`#3653
<https://github.com/pytest-dev/pytest/issues/3653>`_)
Pytest 3.6.2 (2018-06-20)
=========================
Bug Fixes
---------
- Fix regression in ``Node.add_marker`` by extracting the mark object of a
``MarkDecorator``. (`#3555
<https://github.com/pytest-dev/pytest/issues/3555>`_)
- Warnings without ``location`` were reported as ``None``. This is corrected to
now report ``<undetermined location>``. (`#3563
<https://github.com/pytest-dev/pytest/issues/3563>`_)
- Continue to call finalizers in the stack when a finalizer in a former scope
raises an exception. (`#3569
<https://github.com/pytest-dev/pytest/issues/3569>`_)
- Fix encoding error with `print` statements in doctests (`#3583
<https://github.com/pytest-dev/pytest/issues/3583>`_)
Improved Documentation
----------------------
- Add documentation for the ``--strict`` flag. (`#3549
<https://github.com/pytest-dev/pytest/issues/3549>`_)
Trivial/Internal Changes
------------------------
- Update old quotation style to parens in fixture.rst documentation. (`#3525
<https://github.com/pytest-dev/pytest/issues/3525>`_)
- Improve display of hint about ``--fulltrace`` with ``KeyboardInterrupt``.
(`#3545 <https://github.com/pytest-dev/pytest/issues/3545>`_)
- pytest's testsuite is no longer runnable through ``python setup.py test`` --
instead invoke ``pytest`` or ``tox`` directly. (`#3552
<https://github.com/pytest-dev/pytest/issues/3552>`_)
- Fix typo in documentation (`#3567
<https://github.com/pytest-dev/pytest/issues/3567>`_)
Pytest 3.6.1 (2018-06-05)
=========================
Bug Fixes
---------
- Fixed a bug where stdout and stderr were logged twice by junitxml when a test
was marked xfail. (`#3491
<https://github.com/pytest-dev/pytest/issues/3491>`_)
- Fix ``usefixtures`` mark applyed to unittest tests by correctly instantiating
``FixtureInfo``. (`#3498
<https://github.com/pytest-dev/pytest/issues/3498>`_)
- Fix assertion rewriter compatibility with libraries that monkey patch
``file`` objects. (`#3503
<https://github.com/pytest-dev/pytest/issues/3503>`_)
Improved Documentation
----------------------
- Added a section on how to use fixtures as factories to the fixture
documentation. (`#3461 <https://github.com/pytest-dev/pytest/issues/3461>`_)
Trivial/Internal Changes
------------------------
- Enable caching for pip/pre-commit in order to reduce build time on
travis/appveyor. (`#3502
<https://github.com/pytest-dev/pytest/issues/3502>`_)
- Switch pytest to the src/ layout as we already suggested it for good practice
- now we implement it as well. (`#3513
<https://github.com/pytest-dev/pytest/issues/3513>`_)
- Fix if in tests to support 3.7.0b5, where a docstring handling in AST got
reverted. (`#3530 <https://github.com/pytest-dev/pytest/issues/3530>`_)
- Remove some python2.5 compatibility code. (`#3529
<https://github.com/pytest-dev/pytest/issues/3529>`_)
Pytest 3.6.0 (2018-05-23)
=========================
Features
--------
- Revamp the internals of the ``pytest.mark`` implementation with correct per
node handling which fixes a number of long standing bugs caused by the old
design. This introduces new ``Node.iter_markers(name)`` and
``Node.get_closest_mark(name)`` APIs. Users are **strongly encouraged** to
read the `reasons for the revamp in the docs
<https://docs.pytest.org/en/latest/mark.html#marker-revamp-and-iteration>`_,
or jump over to details about `updating existing code to use the new APIs
<https://docs.pytest.org/en/latest/mark.html#updating-code>`_. (`#3317
<https://github.com/pytest-dev/pytest/issues/3317>`_)
- Now when ``@pytest.fixture`` is applied more than once to the same function a
``ValueError`` is raised. This buggy behavior would cause surprising problems
and if was working for a test suite it was mostly by accident. (`#2334
<https://github.com/pytest-dev/pytest/issues/2334>`_)
- Support for Python 3.7's builtin ``breakpoint()`` method, see `Using the
builtin breakpoint function
<https://docs.pytest.org/en/latest/usage.html#breakpoint-builtin>`_ for
details. (`#3180 <https://github.com/pytest-dev/pytest/issues/3180>`_)
- ``monkeypatch`` now supports a ``context()`` function which acts as a context
manager which undoes all patching done within the ``with`` block. (`#3290
<https://github.com/pytest-dev/pytest/issues/3290>`_)
- The ``--pdb`` option now causes KeyboardInterrupt to enter the debugger,
instead of stopping the test session. On python 2.7, hitting CTRL+C again
exits the debugger. On python 3.2 and higher, use CTRL+D. (`#3299
<https://github.com/pytest-dev/pytest/issues/3299>`_)
- pytest not longer changes the log level of the root logger when the
``log-level`` parameter has greater numeric value than that of the level of
the root logger, which makes it play better with custom logging configuration
in user code. (`#3307 <https://github.com/pytest-dev/pytest/issues/3307>`_)
Bug Fixes
---------
- A rare race-condition which might result in corrupted ``.pyc`` files on
Windows has been hopefully solved. (`#3008
<https://github.com/pytest-dev/pytest/issues/3008>`_)
- Also use iter_marker for discovering the marks applying for marker
expressions from the cli to avoid the bad data from the legacy mark storage.
(`#3441 <https://github.com/pytest-dev/pytest/issues/3441>`_)
- When showing diffs of failed assertions where the contents contain only
whitespace, escape them using ``repr()`` first to make it easy to spot the
differences. (`#3443 <https://github.com/pytest-dev/pytest/issues/3443>`_)
Improved Documentation
----------------------
- Change documentation copyright year to a range which auto-updates itself each
time it is published. (`#3303
<https://github.com/pytest-dev/pytest/issues/3303>`_)
Trivial/Internal Changes
------------------------
- ``pytest`` now depends on the `python-atomicwrites
<https://github.com/untitaker/python-atomicwrites>`_ library. (`#3008
<https://github.com/pytest-dev/pytest/issues/3008>`_)
- Update all pypi.python.org URLs to pypi.org. (`#3431
<https://github.com/pytest-dev/pytest/issues/3431>`_)
- Detect `pytest_` prefixed hooks using the internal plugin manager since
``pluggy`` is deprecating the ``implprefix`` argument to ``PluginManager``.
(`#3487 <https://github.com/pytest-dev/pytest/issues/3487>`_)
- Import ``Mapping`` and ``Sequence`` from ``_pytest.compat`` instead of
directly from ``collections`` in ``python_api.py::approx``. Add ``Mapping``
to ``_pytest.compat``, import it from ``collections`` on python 2, but from
``collections.abc`` on Python 3 to avoid a ``DeprecationWarning`` on Python
3.7 or newer. (`#3497 <https://github.com/pytest-dev/pytest/issues/3497>`_)
Pytest 3.5.1 (2018-04-23) Pytest 3.5.1 (2018-04-23)
========================= =========================
@ -114,7 +336,7 @@ Features
- Captured log messages are added to the ``<system-out>`` tag in the generated - Captured log messages are added to the ``<system-out>`` tag in the generated
junit xml file if the ``junit_logging`` ini option is set to ``system-out``. junit xml file if the ``junit_logging`` ini option is set to ``system-out``.
If the value of this ini option is ``system-err`, the logs are written to If the value of this ini option is ``system-err``, the logs are written to
``<system-err>``. The default value for ``junit_logging`` is ``no``, meaning ``<system-err>``. The default value for ``junit_logging`` is ``no``, meaning
captured logs are not written to the output file. (`#3156 captured logs are not written to the output file. (`#3156
<https://github.com/pytest-dev/pytest/issues/3156>`_) <https://github.com/pytest-dev/pytest/issues/3156>`_)
@ -1206,7 +1428,7 @@ Changes
* Testcase reports with a ``url`` attribute will now properly write this to junitxml. * Testcase reports with a ``url`` attribute will now properly write this to junitxml.
Thanks `@fushi`_ for the PR (`#1874`_). Thanks `@fushi`_ for the PR (`#1874`_).
* Remove common items from dict comparision output when verbosity=1. Also update * Remove common items from dict comparison output when verbosity=1. Also update
the truncation message to make it clearer that pytest truncates all the truncation message to make it clearer that pytest truncates all
assertion messages if verbosity < 2 (`#1512`_). assertion messages if verbosity < 2 (`#1512`_).
Thanks `@mattduck`_ for the PR Thanks `@mattduck`_ for the PR
@ -1218,7 +1440,7 @@ Changes
* fix `#2013`_: turn RecordedWarning into ``namedtuple``, * fix `#2013`_: turn RecordedWarning into ``namedtuple``,
to give it a comprehensible repr while preventing unwarranted modification. to give it a comprehensible repr while preventing unwarranted modification.
* fix `#2208`_: ensure a iteration limit for _pytest.compat.get_real_func. * fix `#2208`_: ensure an iteration limit for _pytest.compat.get_real_func.
Thanks `@RonnyPfannschmidt`_ for the report and PR. Thanks `@RonnyPfannschmidt`_ for the report and PR.
* Hooks are now verified after collection is complete, rather than right after loading installed plugins. This * Hooks are now verified after collection is complete, rather than right after loading installed plugins. This
@ -1322,7 +1544,7 @@ Bug Fixes
Notably, importing the ``anydbm`` module is fixed. (`#2248`_). Notably, importing the ``anydbm`` module is fixed. (`#2248`_).
Thanks `@pfhayes`_ for the PR. Thanks `@pfhayes`_ for the PR.
* junitxml: Fix problematic case where system-out tag occured twice per testcase * junitxml: Fix problematic case where system-out tag occurred twice per testcase
element in the XML report. Thanks `@kkoukiou`_ for the PR. element in the XML report. Thanks `@kkoukiou`_ for the PR.
* Fix regression, pytest now skips unittest correctly if run with ``--pdb`` * Fix regression, pytest now skips unittest correctly if run with ``--pdb``
@ -2918,7 +3140,7 @@ time or change existing behaviors in order to make them less surprising/more use
"::" node id specifications (copy pasted from "-v" output) "::" node id specifications (copy pasted from "-v" output)
- fix issue544 by only removing "@NUM" at the end of "::" separated parts - fix issue544 by only removing "@NUM" at the end of "::" separated parts
and if the part has an ".py" extension and if the part has a ".py" extension
- don't use py.std import helper, rather import things directly. - don't use py.std import helper, rather import things directly.
Thanks Bruno Oliveira. Thanks Bruno Oliveira.
@ -3189,7 +3411,7 @@ time or change existing behaviors in order to make them less surprising/more use
would not work correctly because pytest assumes @pytest.mark.some would not work correctly because pytest assumes @pytest.mark.some
gets a function to be decorated already. We now at least detect if this gets a function to be decorated already. We now at least detect if this
arg is an lambda and thus the example will work. Thanks Alex Gaynor arg is a lambda and thus the example will work. Thanks Alex Gaynor
for bringing it up. for bringing it up.
- xfail a test on pypy that checks wrong encoding/ascii (pypy does - xfail a test on pypy that checks wrong encoding/ascii (pypy does
@ -3502,7 +3724,7 @@ Bug fixes:
rather use the post-2.0 parametrize features instead of yield, see: rather use the post-2.0 parametrize features instead of yield, see:
http://pytest.org/latest/example/parametrize.html http://pytest.org/latest/example/parametrize.html
- fix autouse-issue where autouse-fixtures would not be discovered - fix autouse-issue where autouse-fixtures would not be discovered
if defined in a a/conftest.py file and tests in a/tests/test_some.py if defined in an a/conftest.py file and tests in a/tests/test_some.py
- fix issue226 - LIFO ordering for fixture teardowns - fix issue226 - LIFO ordering for fixture teardowns
- fix issue224 - invocations with >256 char arguments now work - fix issue224 - invocations with >256 char arguments now work
- fix issue91 - add/discuss package/directory level setups in example - fix issue91 - add/discuss package/directory level setups in example
@ -4072,7 +4294,7 @@ Bug fixes:
- make path.bestrelpath(path) return ".", note that when calling - make path.bestrelpath(path) return ".", note that when calling
X.bestrelpath the assumption is that X is a directory. X.bestrelpath the assumption is that X is a directory.
- make initial conftest discovery ignore "--" prefixed arguments - make initial conftest discovery ignore "--" prefixed arguments
- fix resultlog plugin when used in an multicpu/multihost xdist situation - fix resultlog plugin when used in a multicpu/multihost xdist situation
(thanks Jakub Gustak) (thanks Jakub Gustak)
- perform distributed testing related reporting in the xdist-plugin - perform distributed testing related reporting in the xdist-plugin
rather than having dist-related code in the generic py.test rather than having dist-related code in the generic py.test

View File

@ -139,7 +139,7 @@ Here's a rundown of how a repository transfer usually proceeds
* ``joedoe`` transfers repository ownership to ``pytest-dev`` administrator ``calvin``. * ``joedoe`` transfers repository ownership to ``pytest-dev`` administrator ``calvin``.
* ``calvin`` creates ``pytest-xyz-admin`` and ``pytest-xyz-developers`` teams, inviting ``joedoe`` to both as **maintainer**. * ``calvin`` creates ``pytest-xyz-admin`` and ``pytest-xyz-developers`` teams, inviting ``joedoe`` to both as **maintainer**.
* ``calvin`` transfers repository to ``pytest-dev`` and configures team access: * ``calvin`` transfers repository to ``pytest-dev`` and configures team access:
- ``pytest-xyz-admin`` **admin** access; - ``pytest-xyz-admin`` **admin** access;
- ``pytest-xyz-developers`` **write** access; - ``pytest-xyz-developers`` **write** access;
@ -162,10 +162,11 @@ Preparing Pull Requests
Short version Short version
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
#. Fork the repository; #. Fork the repository.
#. Target ``master`` for bugfixes and doc changes; #. Enable and install `pre-commit <https://pre-commit.com>`_ to ensure style-guides and code checks are followed.
#. Target ``master`` for bugfixes and doc changes.
#. Target ``features`` for new features or functionality changes. #. Target ``features`` for new features or functionality changes.
#. Follow **PEP-8**. There's a ``tox`` command to help fixing it: ``tox -e fix-lint``. #. Follow **PEP-8** for naming and `black <https://github.com/ambv/black>`_ for formatting.
#. Tests are run using ``tox``:: #. Tests are run using ``tox``::
tox -e linting,py27,py36 tox -e linting,py27,py36
@ -176,7 +177,7 @@ Short version
and one of ``bugfix``, ``removal``, ``feature``, ``vendor``, ``doc`` or and one of ``bugfix``, ``removal``, ``feature``, ``vendor``, ``doc`` or
``trivial`` for the issue type. ``trivial`` for the issue type.
#. Unless your change is a trivial or a documentation fix (e.g., a typo or reword of a small section) please #. Unless your change is a trivial or a documentation fix (e.g., a typo or reword of a small section) please
add yourself to the ``AUTHORS`` file, in alphabetical order; add yourself to the ``AUTHORS`` file, in alphabetical order.
Long version Long version
@ -202,20 +203,30 @@ Here is a simple overview, with pytest-specific bits:
$ git clone git@github.com:YOUR_GITHUB_USERNAME/pytest.git $ git clone git@github.com:YOUR_GITHUB_USERNAME/pytest.git
$ cd pytest $ cd pytest
# now, to fix a bug create your own branch off "master": # now, to fix a bug create your own branch off "master":
$ git checkout -b your-bugfix-branch-name master $ git checkout -b your-bugfix-branch-name master
# or to instead add a feature create your own branch off "features": # or to instead add a feature create your own branch off "features":
$ git checkout -b your-feature-branch-name features $ git checkout -b your-feature-branch-name features
Given we have "major.minor.micro" version numbers, bugfixes will usually Given we have "major.minor.micro" version numbers, bugfixes will usually
be released in micro releases whereas features will be released in be released in micro releases whereas features will be released in
minor releases and incompatible changes in major releases. minor releases and incompatible changes in major releases.
If you need some help with Git, follow this quick start If you need some help with Git, follow this quick start
guide: https://git.wiki.kernel.org/index.php/QuickStart guide: https://git.wiki.kernel.org/index.php/QuickStart
#. Install `pre-commit <https://pre-commit.com>`_ and its hook on the pytest repo::
$ pip install --user pre-commit
$ pre-commit install
Afterwards ``pre-commit`` will run whenever you commit.
https://pre-commit.com/ is a framework for managing and maintaining multi-language pre-commit hooks
to ensure code-style and code formatting is consistent.
#. Install tox #. Install tox
Tox is used to run all the tests and will automatically setup virtualenvs Tox is used to run all the tests and will automatically setup virtualenvs
@ -234,15 +245,7 @@ Here is a simple overview, with pytest-specific bits:
This command will run tests via the "tox" tool against Python 2.7 and 3.6 This command will run tests via the "tox" tool against Python 2.7 and 3.6
and also perform "lint" coding-style checks. and also perform "lint" coding-style checks.
#. You can now edit your local working copy. Please follow PEP-8. #. You can now edit your local working copy and run the tests again as necessary. Please follow PEP-8 for naming.
You can now make the changes you want and run the tests again as necessary.
If you have too much linting errors, try running::
$ tox -e fix-lint
To fix pep8 related errors.
You can pass different options to ``tox``. For example, to run tests on Python 2.7 and pass options to pytest You can pass different options to ``tox``. For example, to run tests on Python 2.7 and pass options to pytest
(e.g. enter pdb on failure) to pytest you can do:: (e.g. enter pdb on failure) to pytest you can do::
@ -253,6 +256,9 @@ Here is a simple overview, with pytest-specific bits:
$ tox -e py36 -- testing/test_config.py $ tox -e py36 -- testing/test_config.py
When committing, ``pre-commit`` will re-format the files if necessary.
#. Commit and push once your tests pass and you are happy with your change(s):: #. Commit and push once your tests pass and you are happy with your change(s)::
$ git commit -a -m "<commit message>" $ git commit -a -m "<commit message>"

View File

@ -10,10 +10,6 @@ taking a lot of time to make a new one.
pytest releases must be prepared on **Linux** because the docs and examples expect pytest releases must be prepared on **Linux** because the docs and examples expect
to be executed in that platform. to be executed in that platform.
#. Install development dependencies in a virtual environment with::
pip3 install -U -r tasks/requirements.txt
#. Create a branch ``release-X.Y.Z`` with the version for the release. #. Create a branch ``release-X.Y.Z`` with the version for the release.
* **patch releases**: from the latest ``master``; * **patch releases**: from the latest ``master``;
@ -22,9 +18,19 @@ taking a lot of time to make a new one.
Ensure your are in a clean work tree. Ensure your are in a clean work tree.
#. Generate docs, changelog, announcements and a **local** tag:: #. Install development dependencies in a virtual environment with::
$ pip3 install -U -r tasks/requirements.txt
#. Generate docs, changelog, announcements, and a **local** tag::
$ invoke generate.pre-release <VERSION>
#. Execute pre-commit on all files to ensure the docs are conformant and commit your results::
$ pre-commit run --all-files
$ git commit -am "Fix files with pre-commit"
invoke generate.pre-release <VERSION>
#. Open a PR for this branch targeting ``master``. #. Open a PR for this branch targeting ``master``.

View File

@ -6,13 +6,13 @@
------ ------
.. image:: https://img.shields.io/pypi/v/pytest.svg .. image:: https://img.shields.io/pypi/v/pytest.svg
:target: https://pypi.python.org/pypi/pytest :target: https://pypi.org/project/pytest/
.. image:: https://anaconda.org/conda-forge/pytest/badges/version.svg .. image:: https://img.shields.io/conda/vn/conda-forge/pytest.svg
:target: https://anaconda.org/conda-forge/pytest :target: https://anaconda.org/conda-forge/pytest
.. image:: https://img.shields.io/pypi/pyversions/pytest.svg .. image:: https://img.shields.io/pypi/pyversions/pytest.svg
:target: https://pypi.python.org/pypi/pytest :target: https://pypi.org/project/pytest/
.. image:: https://img.shields.io/coveralls/pytest-dev/pytest/master.svg .. image:: https://img.shields.io/coveralls/pytest-dev/pytest/master.svg
:target: https://coveralls.io/r/pytest-dev/pytest :target: https://coveralls.io/r/pytest-dev/pytest
@ -23,6 +23,9 @@
.. image:: https://ci.appveyor.com/api/projects/status/mrgbjaua7t33pg6b?svg=true .. image:: https://ci.appveyor.com/api/projects/status/mrgbjaua7t33pg6b?svg=true
:target: https://ci.appveyor.com/project/pytestbot/pytest :target: https://ci.appveyor.com/project/pytestbot/pytest
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/ambv/black
.. image:: https://www.codetriage.com/pytest-dev/pytest/badges/users.svg .. image:: https://www.codetriage.com/pytest-dev/pytest/badges/users.svg
:target: https://www.codetriage.com/pytest-dev/pytest :target: https://www.codetriage.com/pytest-dev/pytest
@ -37,6 +40,7 @@ An example of a simple test:
def inc(x): def inc(x):
return x + 1 return x + 1
def test_answer(): def test_answer():
assert inc(3) == 5 assert inc(3) == 5

View File

@ -14,7 +14,7 @@ environment:
- TOXENV: "py34" - TOXENV: "py34"
- TOXENV: "py35" - TOXENV: "py35"
- TOXENV: "py36" - TOXENV: "py36"
- TOXENV: "pypy" # - TOXENV: "pypy" reenable when we are able to provide a scandir wheel or build scandir
- TOXENV: "py27-pexpect" - TOXENV: "py27-pexpect"
- TOXENV: "py27-xdist" - TOXENV: "py27-xdist"
- TOXENV: "py27-trial" - TOXENV: "py27-trial"
@ -27,7 +27,7 @@ environment:
- TOXENV: "py36-pluggymaster" - TOXENV: "py36-pluggymaster"
- TOXENV: "py27-nobyte" - TOXENV: "py27-nobyte"
- TOXENV: "doctesting" - TOXENV: "doctesting"
- TOXENV: "py35-freeze" - TOXENV: "py36-freeze"
- TOXENV: "docs" - TOXENV: "docs"
install: install:
@ -42,3 +42,11 @@ build: false # Not a C# project, build stuff at the test step instead.
test_script: test_script:
- call scripts\call-tox.bat - call scripts\call-tox.bat
cache:
- '%LOCALAPPDATA%\pip\cache'
- '%USERPROFILE%\.cache\pre-commit'
# We don't deploy anything on tags with AppVeyor, we use Travis instead, so we
# might as well save resources
skip_tags: true

View File

@ -1,12 +1,13 @@
import sys import sys
if __name__ == '__main__': if __name__ == "__main__":
import cProfile import cProfile
import pytest import pytest # NOQA
import pstats import pstats
script = sys.argv[1:] if len(sys.argv) > 1 else "empty.py" script = sys.argv[1:] if len(sys.argv) > 1 else "empty.py"
stats = cProfile.run('pytest.cmdline.main(%r)' % script, 'prof') stats = cProfile.run("pytest.cmdline.main(%r)" % script, "prof")
p = pstats.Stats("prof") p = pstats.Stats("prof")
p.strip_dirs() p.strip_dirs()
p.sort_stats('cumulative') p.sort_stats("cumulative")
print(p.print_stats(500)) print(p.print_stats(500))

View File

@ -5,15 +5,18 @@
# FilesCompleter 75.1109 69.2116 # FilesCompleter 75.1109 69.2116
# FastFilesCompleter 0.7383 1.0760 # FastFilesCompleter 0.7383 1.0760
import timeit
if __name__ == '__main__': imports = [
import sys "from argcomplete.completers import FilesCompleter as completer",
import timeit "from _pytest._argcomplete import FastFilesCompleter as completer",
from argcomplete.completers import FilesCompleter ]
from _pytest._argcomplete import FastFilesCompleter
count = 1000 # only a few seconds count = 1000 # only a few seconds
setup = 'from __main__ import FastFilesCompleter\nfc = FastFilesCompleter()' setup = "%s\nfc = completer()"
run = 'fc("/d")' run = 'fc("/d")'
sys.stdout.write('%s\n' % (timeit.timeit(run,
setup=setup.replace('Fast', ''), number=count)))
sys.stdout.write('%s\n' % (timeit.timeit(run, setup=setup, number=count))) if __name__ == "__main__":
print(timeit.timeit(run, setup=setup % imports[0], number=count))
print((timeit.timeit(run, setup=setup % imports[1], number=count)))

View File

@ -1,3 +1,4 @@
import py import py
for i in range(1000): for i in range(1000):
py.builtin.exec_("def test_func_%d(): pass" % i) py.builtin.exec_("def test_func_%d(): pass" % i)

View File

@ -1,12 +1,15 @@
import pytest import pytest
@pytest.fixture(scope='module', params=range(966))
@pytest.fixture(scope="module", params=range(966))
def foo(request): def foo(request):
return request.param return request.param
def test_it(foo): def test_it(foo):
pass pass
def test_it2(foo): def test_it2(foo):
pass pass

View File

@ -1,10 +1,11 @@
from six.moves import range
import pytest import pytest
SKIP = True SKIP = True
@pytest.mark.parametrize("x", xrange(5000))
@pytest.mark.parametrize("x", range(5000))
def test_foo(x): def test_foo(x):
if SKIP: if SKIP:
pytest.skip("heh") pytest.skip("heh")

View File

@ -0,0 +1,3 @@
In case a (direct) parameter of a test overrides some fixture upon which the
test depends indirectly, do the pruning of the fixture dependency tree. That
is, recompute the full set of fixtures the test function needs.

View File

@ -1 +0,0 @@
Now when ``@pytest.fixture`` is applied more than once to the same function a ``ValueError`` is raised. This buggy behavior would cause surprising problems and if was working for a test suite it was mostly by accident.

View File

@ -1 +0,0 @@
A rare race-condition which might result in corrupted ``.pyc`` files on Windows has been hopefully solved.

View File

@ -1 +0,0 @@
``pytest`` now depends on the `python-atomicwrites <https://github.com/untitaker/python-atomicwrites>`_ library.

View File

@ -1 +0,0 @@
Support for Python 3.7's builtin ``breakpoint()`` method, see `Using the builtin breakpoint function <https://docs.pytest.org/en/latest/usage.html#breakpoint-builtin>`_ for details.

View File

@ -1,2 +0,0 @@
``monkeypatch`` now supports a ``context()`` function which acts as a context manager which undoes all patching done
within the ``with`` block.

View File

@ -1,3 +0,0 @@
pytest not longer changes the log level of the root logger when the
``log-level`` parameter has greater numeric value than that of the level of
the root logger, which makes it play better with custom logging configuration in user code.

View File

@ -1 +0,0 @@
introduce correct per node mark handling and deprecate the always incorrect existing mark handling

View File

@ -0,0 +1 @@
Now a ``README.md`` file is created in ``.pytest_cache`` to make it clear why the directory exists.

View File

@ -0,0 +1 @@
``Node.add_marker`` now supports an append=True/False to determine whether the mark comes last (default) or first.

View File

@ -0,0 +1 @@
Fixture ``caplog`` now has a ``messages`` property, providing convenient access to the format-interpolated log messages without the extra data provided by the formatter/handler.

View File

@ -0,0 +1 @@
introduce ``pytester.copy_example`` as helper to do acceptance tests against examples from the project

View File

@ -4,7 +4,7 @@ text that will be added to the next ``CHANGELOG``.
The ``CHANGELOG`` will be read by users, so this description should be aimed to pytest users The ``CHANGELOG`` will be read by users, so this description should be aimed to pytest users
instead of describing internal changes which are only relevant to the developers. instead of describing internal changes which are only relevant to the developers.
Make sure to use full sentences with correct case and punctuation, for example:: Make sure to use full sentences with correct case and punctuation, for example::
Fix issue with non-ascii messages from the ``warnings`` module. Fix issue with non-ascii messages from the ``warnings`` module.

View File

@ -1,9 +1,8 @@
<h3>Useful Links</h3> <h3>Useful Links</h3>
<ul> <ul>
<li><a href="https://pypi.python.org/pypi/pytest">pytest @ PyPI</a></li> <li><a href="https://pypi.org/project/pytest/">pytest @ PyPI</a></li>
<li><a href="https://github.com/pytest-dev/pytest/">pytest @ GitHub</a></li> <li><a href="https://github.com/pytest-dev/pytest/">pytest @ GitHub</a></li>
<li><a href="http://plugincompat.herokuapp.com/">3rd party plugins</a></li> <li><a href="http://plugincompat.herokuapp.com/">3rd party plugins</a></li>
<li><a href="https://github.com/pytest-dev/pytest/issues">Issue Tracker</a></li> <li><a href="https://github.com/pytest-dev/pytest/issues">Issue Tracker</a></li>
<li><a href="https://media.readthedocs.org/pdf/pytest/latest/pytest.pdf">PDF Documentation</a> <li><a href="https://media.readthedocs.org/pdf/pytest/latest/pytest.pdf">PDF Documentation</a>
</ul> </ul>

View File

@ -6,4 +6,4 @@ pygments_style = flask_theme_support.FlaskyStyle
[options] [options]
index_logo = '' index_logo = ''
index_logo_height = 120px index_logo_height = 120px
touch_icon = touch_icon =

View File

@ -1,7 +1,19 @@
# flasky extensions. flasky pygments style based on tango style # flasky extensions. flasky pygments style based on tango style
from pygments.style import Style from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, \ from pygments.token import (
Number, Operator, Generic, Whitespace, Punctuation, Other, Literal Keyword,
Name,
Comment,
String,
Error,
Number,
Operator,
Generic,
Whitespace,
Punctuation,
Other,
Literal,
)
class FlaskyStyle(Style): class FlaskyStyle(Style):
@ -10,77 +22,68 @@ class FlaskyStyle(Style):
styles = { styles = {
# No corresponding class for the following: # No corresponding class for the following:
#Text: "", # class: '' # Text: "", # class: ''
Whitespace: "underline #f8f8f8", # class: 'w' Whitespace: "underline #f8f8f8", # class: 'w'
Error: "#a40000 border:#ef2929", # class: 'err' Error: "#a40000 border:#ef2929", # class: 'err'
Other: "#000000", # class 'x' Other: "#000000", # class 'x'
Comment: "italic #8f5902", # class: 'c'
Comment: "italic #8f5902", # class: 'c' Comment.Preproc: "noitalic", # class: 'cp'
Comment.Preproc: "noitalic", # class: 'cp' Keyword: "bold #004461", # class: 'k'
Keyword.Constant: "bold #004461", # class: 'kc'
Keyword: "bold #004461", # class: 'k' Keyword.Declaration: "bold #004461", # class: 'kd'
Keyword.Constant: "bold #004461", # class: 'kc' Keyword.Namespace: "bold #004461", # class: 'kn'
Keyword.Declaration: "bold #004461", # class: 'kd' Keyword.Pseudo: "bold #004461", # class: 'kp'
Keyword.Namespace: "bold #004461", # class: 'kn' Keyword.Reserved: "bold #004461", # class: 'kr'
Keyword.Pseudo: "bold #004461", # class: 'kp' Keyword.Type: "bold #004461", # class: 'kt'
Keyword.Reserved: "bold #004461", # class: 'kr' Operator: "#582800", # class: 'o'
Keyword.Type: "bold #004461", # class: 'kt' Operator.Word: "bold #004461", # class: 'ow' - like keywords
Punctuation: "bold #000000", # class: 'p'
Operator: "#582800", # class: 'o'
Operator.Word: "bold #004461", # class: 'ow' - like keywords
Punctuation: "bold #000000", # class: 'p'
# because special names such as Name.Class, Name.Function, etc. # because special names such as Name.Class, Name.Function, etc.
# are not recognized as such later in the parsing, we choose them # are not recognized as such later in the parsing, we choose them
# to look the same as ordinary variables. # to look the same as ordinary variables.
Name: "#000000", # class: 'n' Name: "#000000", # class: 'n'
Name.Attribute: "#c4a000", # class: 'na' - to be revised Name.Attribute: "#c4a000", # class: 'na' - to be revised
Name.Builtin: "#004461", # class: 'nb' Name.Builtin: "#004461", # class: 'nb'
Name.Builtin.Pseudo: "#3465a4", # class: 'bp' Name.Builtin.Pseudo: "#3465a4", # class: 'bp'
Name.Class: "#000000", # class: 'nc' - to be revised Name.Class: "#000000", # class: 'nc' - to be revised
Name.Constant: "#000000", # class: 'no' - to be revised Name.Constant: "#000000", # class: 'no' - to be revised
Name.Decorator: "#888", # class: 'nd' - to be revised Name.Decorator: "#888", # class: 'nd' - to be revised
Name.Entity: "#ce5c00", # class: 'ni' Name.Entity: "#ce5c00", # class: 'ni'
Name.Exception: "bold #cc0000", # class: 'ne' Name.Exception: "bold #cc0000", # class: 'ne'
Name.Function: "#000000", # class: 'nf' Name.Function: "#000000", # class: 'nf'
Name.Property: "#000000", # class: 'py' Name.Property: "#000000", # class: 'py'
Name.Label: "#f57900", # class: 'nl' Name.Label: "#f57900", # class: 'nl'
Name.Namespace: "#000000", # class: 'nn' - to be revised Name.Namespace: "#000000", # class: 'nn' - to be revised
Name.Other: "#000000", # class: 'nx' Name.Other: "#000000", # class: 'nx'
Name.Tag: "bold #004461", # class: 'nt' - like a keyword Name.Tag: "bold #004461", # class: 'nt' - like a keyword
Name.Variable: "#000000", # class: 'nv' - to be revised Name.Variable: "#000000", # class: 'nv' - to be revised
Name.Variable.Class: "#000000", # class: 'vc' - to be revised Name.Variable.Class: "#000000", # class: 'vc' - to be revised
Name.Variable.Global: "#000000", # class: 'vg' - to be revised Name.Variable.Global: "#000000", # class: 'vg' - to be revised
Name.Variable.Instance: "#000000", # class: 'vi' - to be revised Name.Variable.Instance: "#000000", # class: 'vi' - to be revised
Number: "#990000", # class: 'm'
Number: "#990000", # class: 'm' Literal: "#000000", # class: 'l'
Literal.Date: "#000000", # class: 'ld'
Literal: "#000000", # class: 'l' String: "#4e9a06", # class: 's'
Literal.Date: "#000000", # class: 'ld' String.Backtick: "#4e9a06", # class: 'sb'
String.Char: "#4e9a06", # class: 'sc'
String: "#4e9a06", # class: 's' String.Doc: "italic #8f5902", # class: 'sd' - like a comment
String.Backtick: "#4e9a06", # class: 'sb' String.Double: "#4e9a06", # class: 's2'
String.Char: "#4e9a06", # class: 'sc' String.Escape: "#4e9a06", # class: 'se'
String.Doc: "italic #8f5902", # class: 'sd' - like a comment String.Heredoc: "#4e9a06", # class: 'sh'
String.Double: "#4e9a06", # class: 's2' String.Interpol: "#4e9a06", # class: 'si'
String.Escape: "#4e9a06", # class: 'se' String.Other: "#4e9a06", # class: 'sx'
String.Heredoc: "#4e9a06", # class: 'sh' String.Regex: "#4e9a06", # class: 'sr'
String.Interpol: "#4e9a06", # class: 'si' String.Single: "#4e9a06", # class: 's1'
String.Other: "#4e9a06", # class: 'sx' String.Symbol: "#4e9a06", # class: 'ss'
String.Regex: "#4e9a06", # class: 'sr' Generic: "#000000", # class: 'g'
String.Single: "#4e9a06", # class: 's1' Generic.Deleted: "#a40000", # class: 'gd'
String.Symbol: "#4e9a06", # class: 'ss' Generic.Emph: "italic #000000", # class: 'ge'
Generic.Error: "#ef2929", # class: 'gr'
Generic: "#000000", # class: 'g' Generic.Heading: "bold #000080", # class: 'gh'
Generic.Deleted: "#a40000", # class: 'gd' Generic.Inserted: "#00A000", # class: 'gi'
Generic.Emph: "italic #000000", # class: 'ge' Generic.Output: "#888", # class: 'go'
Generic.Error: "#ef2929", # class: 'gr' Generic.Prompt: "#745334", # class: 'gp'
Generic.Heading: "bold #000080", # class: 'gh' Generic.Strong: "bold #000000", # class: 'gs'
Generic.Inserted: "#00A000", # class: 'gi' Generic.Subheading: "bold #800080", # class: 'gu'
Generic.Output: "#888", # class: 'go' Generic.Traceback: "bold #a40000", # class: 'gt'
Generic.Prompt: "#745334", # class: 'gp'
Generic.Strong: "bold #000000", # class: 'gs'
Generic.Subheading: "bold #800080", # class: 'gu'
Generic.Traceback: "bold #a40000", # class: 'gt'
} }

View File

@ -5,7 +5,11 @@ Release announcements
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
release-3.6.3
release-3.6.2
release-3.6.1
release-3.6.0
release-3.5.1 release-3.5.1
release-3.5.0 release-3.5.0
release-3.4.2 release-3.4.2

View File

@ -1,4 +1,4 @@
py.test 2.0.3: bug fixes and speed ups py.test 2.0.3: bug fixes and speed ups
=========================================================================== ===========================================================================
Welcome to pytest-2.0.3, a maintenance and bug fix release of pytest, Welcome to pytest-2.0.3, a maintenance and bug fix release of pytest,
@ -37,4 +37,3 @@ Changes between 2.0.2 and 2.0.3
internally) internally)
- fix issue37: avoid invalid characters in junitxml's output - fix issue37: avoid invalid characters in junitxml's output

View File

@ -34,4 +34,3 @@ Changes between 2.1.0 and 2.1.1
- fix issue59: provide system-out/err tags for junitxml output - fix issue59: provide system-out/err tags for junitxml output
- fix issue61: assertion rewriting on boolean operations with 3 or more operands - fix issue61: assertion rewriting on boolean operations with 3 or more operands
- you can now build a man page with "cd doc ; make man" - you can now build a man page with "cd doc ; make man"

View File

@ -30,4 +30,3 @@ Changes between 2.1.1 and 2.1.2
- fix issue68 / packages now work with assertion rewriting - fix issue68 / packages now work with assertion rewriting
- fix issue66: use different assertion rewriting caches when the -O option is passed - fix issue66: use different assertion rewriting caches when the -O option is passed
- don't try assertion rewriting on Jython, use reinterp - don't try assertion rewriting on Jython, use reinterp

View File

@ -9,7 +9,7 @@ and integration testing. See extensive docs with examples here:
The release contains another fix to the perfected assertions introduced The release contains another fix to the perfected assertions introduced
with the 2.1 series as well as the new possibility to customize reporting with the 2.1 series as well as the new possibility to customize reporting
for assertion expressions on a per-directory level. for assertion expressions on a per-directory level.
If you want to install or upgrade pytest, just type one of:: If you want to install or upgrade pytest, just type one of::

View File

@ -27,7 +27,7 @@ Changes between 2.2.0 and 2.2.1
---------------------------------------- ----------------------------------------
- fix issue99 (in pytest and py) internallerrors with resultlog now - fix issue99 (in pytest and py) internallerrors with resultlog now
produce better output - fixed by normalizing pytest_internalerror produce better output - fixed by normalizing pytest_internalerror
input arguments. input arguments.
- fix issue97 / traceback issues (in pytest and py) improve traceback output - fix issue97 / traceback issues (in pytest and py) improve traceback output
in conjunction with jinja2 and cython which hack tracebacks in conjunction with jinja2 and cython which hack tracebacks
@ -35,7 +35,7 @@ Changes between 2.2.0 and 2.2.1
the final test in a test node will now run its teardown directly the final test in a test node will now run its teardown directly
instead of waiting for the end of the session. Thanks Dave Hunt for instead of waiting for the end of the session. Thanks Dave Hunt for
the good reporting and feedback. The pytest_runtest_protocol as well the good reporting and feedback. The pytest_runtest_protocol as well
as the pytest_runtest_teardown hooks now have "nextitem" available as the pytest_runtest_teardown hooks now have "nextitem" available
which will be None indicating the end of the test run. which will be None indicating the end of the test run.
- fix collection crash due to unknown-source collected items, thanks - fix collection crash due to unknown-source collected items, thanks
to Ralf Schmitt (fixed by depending on a more recent pylib) to Ralf Schmitt (fixed by depending on a more recent pylib)

View File

@ -4,7 +4,7 @@ pytest-2.2.2: bug fixes
pytest-2.2.2 (updated to 2.2.3 to fix packaging issues) is a minor pytest-2.2.2 (updated to 2.2.3 to fix packaging issues) is a minor
backward-compatible release of the versatile py.test testing tool. It backward-compatible release of the versatile py.test testing tool. It
contains bug fixes and a few refinements particularly to reporting with contains bug fixes and a few refinements particularly to reporting with
"--collectonly", see below for betails. "--collectonly", see below for betails.
For general information see here: For general information see here:
@ -27,7 +27,7 @@ Changes between 2.2.1 and 2.2.2
- fix issue101: wrong args to unittest.TestCase test function now - fix issue101: wrong args to unittest.TestCase test function now
produce better output produce better output
- fix issue102: report more useful errors and hints for when a - fix issue102: report more useful errors and hints for when a
test directory was renamed and some pyc/__pycache__ remain test directory was renamed and some pyc/__pycache__ remain
- fix issue106: allow parametrize to be applied multiple times - fix issue106: allow parametrize to be applied multiple times
e.g. from module, class and at function level. e.g. from module, class and at function level.
@ -38,6 +38,6 @@ Changes between 2.2.1 and 2.2.2
- fix issue115: make --collectonly robust against early failure - fix issue115: make --collectonly robust against early failure
(missing files/directories) (missing files/directories)
- "-qq --collectonly" now shows only files and the number of tests in them - "-qq --collectonly" now shows only files and the number of tests in them
- "-q --collectonly" now shows test ids - "-q --collectonly" now shows test ids
- allow adding of attributes to test reports such that it also works - allow adding of attributes to test reports such that it also works
with distributed testing (no upgrade of pytest-xdist needed) with distributed testing (no upgrade of pytest-xdist needed)

View File

@ -36,4 +36,3 @@ Changes between 2.2.3 and 2.2.4
configure/sessionstart where called configure/sessionstart where called
- fix issue #144: better mangle test ids to junitxml classnames - fix issue #144: better mangle test ids to junitxml classnames
- upgrade distribute_setup.py to 0.6.27 - upgrade distribute_setup.py to 0.6.27

View File

@ -1,7 +1,7 @@
pytest-2.3: improved fixtures / better unittest integration pytest-2.3: improved fixtures / better unittest integration
============================================================================= =============================================================================
pytest-2.3 comes with many major improvements for fixture/funcarg management pytest-2.3 comes with many major improvements for fixture/funcarg management
and parametrized testing in Python. It is now easier, more efficient and and parametrized testing in Python. It is now easier, more efficient and
more predicatable to re-run the same tests with different fixture more predicatable to re-run the same tests with different fixture
instances. Also, you can directly declare the caching "scope" of instances. Also, you can directly declare the caching "scope" of
@ -9,7 +9,7 @@ fixtures so that dependent tests throughout your whole test suite can
re-use database or other expensive fixture objects with ease. Lastly, re-use database or other expensive fixture objects with ease. Lastly,
it's possible for fixture functions (formerly known as funcarg it's possible for fixture functions (formerly known as funcarg
factories) to use other fixtures, allowing for a completely modular and factories) to use other fixtures, allowing for a completely modular and
re-useable fixture design. re-useable fixture design.
For detailed info and tutorial-style examples, see: For detailed info and tutorial-style examples, see:
@ -27,7 +27,7 @@ All changes are backward compatible and you should be able to continue
to run your test suites and 3rd party plugins that worked with to run your test suites and 3rd party plugins that worked with
pytest-2.2.4. pytest-2.2.4.
If you are interested in the precise reasoning (including examples) of the If you are interested in the precise reasoning (including examples) of the
pytest-2.3 fixture evolution, please consult pytest-2.3 fixture evolution, please consult
http://pytest.org/latest/funcarg_compare.html http://pytest.org/latest/funcarg_compare.html
@ -43,7 +43,7 @@ and more details for those already in the knowing of pytest can be found
in the CHANGELOG below. in the CHANGELOG below.
Particular thanks for this release go to Floris Bruynooghe, Alex Okrushko Particular thanks for this release go to Floris Bruynooghe, Alex Okrushko
Carl Meyer, Ronny Pfannschmidt, Benjamin Peterson and Alex Gaynor for helping Carl Meyer, Ronny Pfannschmidt, Benjamin Peterson and Alex Gaynor for helping
to get the new features right and well integrated. Ronny and Floris to get the new features right and well integrated. Ronny and Floris
also helped to fix a number of bugs and yet more people helped by also helped to fix a number of bugs and yet more people helped by
providing bug reports. providing bug reports.
@ -94,7 +94,7 @@ Changes between 2.2.4 and 2.3.0
- pluginmanager.register(...) now raises ValueError if the - pluginmanager.register(...) now raises ValueError if the
plugin has been already registered or the name is taken plugin has been already registered or the name is taken
- fix issue159: improve http://pytest.org/latest/faq.html - fix issue159: improve http://pytest.org/latest/faq.html
especially with respect to the "magic" history, also mention especially with respect to the "magic" history, also mention
pytest-django, trial and unittest integration. pytest-django, trial and unittest integration.
@ -125,10 +125,9 @@ Changes between 2.2.4 and 2.3.0
you can use startdir.bestrelpath(yourpath) to show you can use startdir.bestrelpath(yourpath) to show
nice relative path nice relative path
- allow plugins to implement both pytest_report_header and - allow plugins to implement both pytest_report_header and
pytest_sessionstart (sessionstart is invoked first). pytest_sessionstart (sessionstart is invoked first).
- don't show deselected reason line if there is none - don't show deselected reason line if there is none
- py.test -vv will show all of assert comparisons instead of truncating - py.test -vv will show all of assert comparisons instead of truncating

View File

@ -3,16 +3,16 @@ pytest-2.3.1: fix regression with factory functions
pytest-2.3.1 is a quick follow-up release: pytest-2.3.1 is a quick follow-up release:
- fix issue202 - regression with fixture functions/funcarg factories: - fix issue202 - regression with fixture functions/funcarg factories:
using "self" is now safe again and works as in 2.2.4. Thanks using "self" is now safe again and works as in 2.2.4. Thanks
to Eduard Schettino for the quick bug report. to Eduard Schettino for the quick bug report.
- disable pexpect pytest self tests on Freebsd - thanks Koob for the - disable pexpect pytest self tests on Freebsd - thanks Koob for the
quick reporting quick reporting
- fix/improve interactive docs with --markers - fix/improve interactive docs with --markers
See See
http://pytest.org/ http://pytest.org/

View File

@ -8,9 +8,9 @@ pytest-2.3.2 is another stabilization release:
- fix teardown-ordering for parametrized setups - fix teardown-ordering for parametrized setups
- fix unittest and trial compat behaviour with respect to runTest() methods - fix unittest and trial compat behaviour with respect to runTest() methods
- issue 206 and others: some improvements to packaging - issue 206 and others: some improvements to packaging
- fix issue127 and others: improve some docs - fix issue127 and others: improve some docs
See See
http://pytest.org/ http://pytest.org/
@ -26,7 +26,7 @@ holger krekel
Changes between 2.3.1 and 2.3.2 Changes between 2.3.1 and 2.3.2
----------------------------------- -----------------------------------
- fix issue208 and fix issue29 use new py version to avoid long pauses - fix issue208 and fix issue29 use new py version to avoid long pauses
when printing tracebacks in long modules when printing tracebacks in long modules
- fix issue205 - conftests in subdirs customizing - fix issue205 - conftests in subdirs customizing

View File

@ -6,7 +6,7 @@ which offers uebersimple assertions, scalable fixture mechanisms
and deep customization for testing with Python. Particularly, and deep customization for testing with Python. Particularly,
this release provides: this release provides:
- integration fixes and improvements related to flask, numpy, nose, - integration fixes and improvements related to flask, numpy, nose,
unittest, mock unittest, mock
- makes pytest work on py24 again (yes, people sometimes still need to use it) - makes pytest work on py24 again (yes, people sometimes still need to use it)
@ -16,7 +16,7 @@ this release provides:
Thanks to Manuel Jacob, Thomas Waldmann, Ronny Pfannschmidt, Pavel Repin Thanks to Manuel Jacob, Thomas Waldmann, Ronny Pfannschmidt, Pavel Repin
and Andreas Taumoefolau for providing patches and all for the issues. and Andreas Taumoefolau for providing patches and all for the issues.
See See
http://pytest.org/ http://pytest.org/
@ -59,4 +59,3 @@ Changes between 2.3.2 and 2.3.3
- fix issue127 - improve documentation for pytest_addoption() and - fix issue127 - improve documentation for pytest_addoption() and
add a ``config.getoption(name)`` helper function for consistency. add a ``config.getoption(name)`` helper function for consistency.

View File

@ -10,15 +10,15 @@ comes with the following fixes and features:
can write: -k "name1 or name2" etc. This is a slight usage incompatibility can write: -k "name1 or name2" etc. This is a slight usage incompatibility
if you used special syntax like "TestClass.test_method" which you now if you used special syntax like "TestClass.test_method" which you now
need to write as -k "TestClass and test_method" to match a certain need to write as -k "TestClass and test_method" to match a certain
method in a certain test class. method in a certain test class.
- allow to dynamically define markers via - allow to dynamically define markers via
item.keywords[...]=assignment integrating with "-m" option item.keywords[...]=assignment integrating with "-m" option
- yielded test functions will now have autouse-fixtures active but - yielded test functions will now have autouse-fixtures active but
cannot accept fixtures as funcargs - it's anyway recommended to cannot accept fixtures as funcargs - it's anyway recommended to
rather use the post-2.0 parametrize features instead of yield, see: rather use the post-2.0 parametrize features instead of yield, see:
http://pytest.org/latest/example/parametrize.html http://pytest.org/latest/example/parametrize.html
- fix autouse-issue where autouse-fixtures would not be discovered - fix autouse-issue where autouse-fixtures would not be discovered
if defined in a a/conftest.py file and tests in a/tests/test_some.py if defined in an a/conftest.py file and tests in a/tests/test_some.py
- fix issue226 - LIFO ordering for fixture teardowns - fix issue226 - LIFO ordering for fixture teardowns
- fix issue224 - invocations with >256 char arguments now work - fix issue224 - invocations with >256 char arguments now work
- fix issue91 - add/discuss package/directory level setups in example - fix issue91 - add/discuss package/directory level setups in example
@ -26,7 +26,7 @@ comes with the following fixes and features:
Thanks in particular to Thomas Waldmann for spotting and reporting issues. Thanks in particular to Thomas Waldmann for spotting and reporting issues.
See See
http://pytest.org/ http://pytest.org/

View File

@ -13,8 +13,8 @@ few interesting new plugins saw the light last month:
- pytest-random: randomize test ordering - pytest-random: randomize test ordering
And several others like pytest-django saw maintenance releases. And several others like pytest-django saw maintenance releases.
For a more complete list, check out For a more complete list, check out
https://pypi.python.org/pypi?%3Aaction=search&term=pytest&submit=search. https://pypi.org/search/?q=pytest
For general information see: For general information see:
@ -81,7 +81,7 @@ Changes between 2.3.4 and 2.3.5
- fix bug where using capsys with pytest.set_trace() in a test - fix bug where using capsys with pytest.set_trace() in a test
function would break when looking at capsys.readouterr() function would break when looking at capsys.readouterr()
- allow to specify prefixes starting with "_" when - allow to specify prefixes starting with "_" when
customizing python_functions test discovery. (thanks Graham Horler) customizing python_functions test discovery. (thanks Graham Horler)
- improve PYTEST_DEBUG tracing output by putting - improve PYTEST_DEBUG tracing output by putting
@ -94,4 +94,3 @@ Changes between 2.3.4 and 2.3.5
- fix issue134 - print the collect errors that prevent running specified test items - fix issue134 - print the collect errors that prevent running specified test items
- fix issue266 - accept unicode in MarkEvaluator expressions - fix issue266 - accept unicode in MarkEvaluator expressions

View File

@ -1,9 +1,9 @@
pytest-2.4.0: new fixture features/hooks and bug fixes pytest-2.4.0: new fixture features/hooks and bug fixes
=========================================================================== ===========================================================================
The just released pytest-2.4.0 brings many improvements and numerous The just released pytest-2.4.0 brings many improvements and numerous
bug fixes while remaining plugin- and test-suite compatible apart bug fixes while remaining plugin- and test-suite compatible apart
from a few supposedly very minor incompatibilities. See below for from a few supposedly very minor incompatibilities. See below for
a full list of details. A few feature highlights: a full list of details. A few feature highlights:
- new yield-style fixtures `pytest.yield_fixture - new yield-style fixtures `pytest.yield_fixture
@ -13,7 +13,7 @@ a full list of details. A few feature highlights:
- improved pdb support: ``import pdb ; pdb.set_trace()`` now works - improved pdb support: ``import pdb ; pdb.set_trace()`` now works
without requiring prior disabling of stdout/stderr capturing. without requiring prior disabling of stdout/stderr capturing.
Also the ``--pdb`` options works now on collection and internal errors Also the ``--pdb`` options works now on collection and internal errors
and we introduced a new experimental hook for IDEs/plugins to and we introduced a new experimental hook for IDEs/plugins to
intercept debugging: ``pytest_exception_interact(node, call, report)``. intercept debugging: ``pytest_exception_interact(node, call, report)``.
- shorter monkeypatch variant to allow specifying an import path as - shorter monkeypatch variant to allow specifying an import path as
@ -23,21 +23,21 @@ a full list of details. A few feature highlights:
called if the corresponding setup method succeeded. called if the corresponding setup method succeeded.
- integrate tab-completion on command line options if you - integrate tab-completion on command line options if you
have `argcomplete <http://pypi.python.org/pypi/argcomplete>`_ have `argcomplete <https://pypi.org/project/argcomplete/>`_
configured. configured.
- allow boolean expression directly with skipif/xfail - allow boolean expression directly with skipif/xfail
if a "reason" is also specified. if a "reason" is also specified.
- a new hook ``pytest_load_initial_conftests`` allows plugins like - a new hook ``pytest_load_initial_conftests`` allows plugins like
`pytest-django <http://pypi.python.org/pypi/pytest-django>`_ to `pytest-django <https://pypi.org/project/pytest-django/>`_ to
influence the environment before conftest files import ``django``. influence the environment before conftest files import ``django``.
- reporting: color the last line red or green depending if - reporting: color the last line red or green depending if
failures/errors occurred or everything passed. failures/errors occurred or everything passed.
The documentation has been updated to accommodate the changes, The documentation has been updated to accommodate the changes,
see `http://pytest.org <http://pytest.org>`_ see `http://pytest.org <http://pytest.org>`_
To install or upgrade pytest:: To install or upgrade pytest::
@ -45,8 +45,8 @@ To install or upgrade pytest::
easy_install -U pytest easy_install -U pytest
**Many thanks to all who helped, including Floris Bruynooghe, **Many thanks to all who helped, including Floris Bruynooghe,
Brianna Laugher, Andreas Pelme, Anthon van der Neut, Anatoly Bubenkoff, Brianna Laugher, Andreas Pelme, Anthon van der Neut, Anatoly Bubenkoff,
Vladimir Keleshev, Mathieu Agopian, Ronny Pfannschmidt, Christian Vladimir Keleshev, Mathieu Agopian, Ronny Pfannschmidt, Christian
Theunert and many others.** Theunert and many others.**
@ -101,12 +101,12 @@ new features:
- make "import pdb ; pdb.set_trace()" work natively wrt capturing (no - make "import pdb ; pdb.set_trace()" work natively wrt capturing (no
"-s" needed anymore), making ``pytest.set_trace()`` a mere shortcut. "-s" needed anymore), making ``pytest.set_trace()`` a mere shortcut.
- fix issue181: --pdb now also works on collect errors (and - fix issue181: --pdb now also works on collect errors (and
on internal errors) . This was implemented by a slight internal on internal errors) . This was implemented by a slight internal
refactoring and the introduction of a new hook refactoring and the introduction of a new hook
``pytest_exception_interact`` hook (see next item). ``pytest_exception_interact`` hook (see next item).
- fix issue341: introduce new experimental hook for IDEs/terminals to - fix issue341: introduce new experimental hook for IDEs/terminals to
intercept debugging: ``pytest_exception_interact(node, call, report)``. intercept debugging: ``pytest_exception_interact(node, call, report)``.
- new monkeypatch.setattr() variant to provide a shorter - new monkeypatch.setattr() variant to provide a shorter
@ -124,7 +124,7 @@ new features:
phase of a node. phase of a node.
- simplify pytest.mark.parametrize() signature: allow to pass a - simplify pytest.mark.parametrize() signature: allow to pass a
CSV-separated string to specify argnames. For example: CSV-separated string to specify argnames. For example:
``pytest.mark.parametrize("input,expected", [(1,2), (2,3)])`` ``pytest.mark.parametrize("input,expected", [(1,2), (2,3)])``
works as well as the previous: works as well as the previous:
``pytest.mark.parametrize(("input", "expected"), ...)``. ``pytest.mark.parametrize(("input", "expected"), ...)``.
@ -149,10 +149,10 @@ new features:
Bug fixes: Bug fixes:
- fix issue358 - capturing options are now parsed more properly - fix issue358 - capturing options are now parsed more properly
by using a new parser.parse_known_args method. by using a new parser.parse_known_args method.
- pytest now uses argparse instead of optparse (thanks Anthon) which - pytest now uses argparse instead of optparse (thanks Anthon) which
means that "argparse" is added as a dependency if installing into python2.6 means that "argparse" is added as a dependency if installing into python2.6
environments or below. environments or below.
@ -193,7 +193,7 @@ Bug fixes:
- fix issue323 - sorting of many module-scoped arg parametrizations - fix issue323 - sorting of many module-scoped arg parametrizations
- make sessionfinish hooks execute with the same cwd-context as at - make sessionfinish hooks execute with the same cwd-context as at
session start (helps fix plugin behaviour which write output files session start (helps fix plugin behaviour which write output files
with relative path such as pytest-cov) with relative path such as pytest-cov)
- fix issue316 - properly reference collection hooks in docs - fix issue316 - properly reference collection hooks in docs
@ -201,7 +201,7 @@ Bug fixes:
- fix issue 306 - cleanup of -k/-m options to only match markers/test - fix issue 306 - cleanup of -k/-m options to only match markers/test
names/keywords respectively. Thanks Wouter van Ackooy. names/keywords respectively. Thanks Wouter van Ackooy.
- improved doctest counting for doctests in python modules -- - improved doctest counting for doctests in python modules --
files without any doctest items will not show up anymore files without any doctest items will not show up anymore
and doctest examples are counted as separate test items. and doctest examples are counted as separate test items.
thanks Danilo Bellini. thanks Danilo Bellini.
@ -211,7 +211,7 @@ Bug fixes:
mode. Thanks Jason R. Coombs. mode. Thanks Jason R. Coombs.
- fix junitxml generation when test output contains control characters, - fix junitxml generation when test output contains control characters,
addressing issue267, thanks Jaap Broekhuizen addressing issue267, thanks Jaap Broekhuizen
- fix issue338: honor --tb style for setup/teardown errors as well. Thanks Maho. - fix issue338: honor --tb style for setup/teardown errors as well. Thanks Maho.
@ -220,6 +220,5 @@ Bug fixes:
- better parametrize error messages, thanks Brianna Laugher - better parametrize error messages, thanks Brianna Laugher
- pytest_terminal_summary(terminalreporter) hooks can now use - pytest_terminal_summary(terminalreporter) hooks can now use
".section(title)" and ".line(msg)" methods to print extra ".section(title)" and ".line(msg)" methods to print extra
information at the end of a test run. information at the end of a test run.

View File

@ -8,7 +8,7 @@ compared to 2.3.5 before they hit more people:
"type" keyword should also be converted to the respective types. "type" keyword should also be converted to the respective types.
thanks Floris Bruynooghe, @dnozay. (fixes issue360 and issue362) thanks Floris Bruynooghe, @dnozay. (fixes issue360 and issue362)
- fix dotted filename completion when using argcomplete - fix dotted filename completion when using argcomplete
thanks Anthon van der Neuth. (fixes issue361) thanks Anthon van der Neuth. (fixes issue361)
- fix regression when a 1-tuple ("arg",) is used for specifying - fix regression when a 1-tuple ("arg",) is used for specifying

View File

@ -26,9 +26,9 @@ pytest-2.4.2 is another bug-fixing release:
- remove attempt to "dup" stdout at startup as it's icky. - remove attempt to "dup" stdout at startup as it's icky.
the normal capturing should catch enough possibilities the normal capturing should catch enough possibilities
of tests messing up standard FDs. of tests messing up standard FDs.
- add pluginmanager.do_configure(config) as a link to - add pluginmanager.do_configure(config) as a link to
config.do_configure() for plugin-compatibility config.do_configure() for plugin-compatibility
as usual, docs at http://pytest.org and upgrades via:: as usual, docs at http://pytest.org and upgrades via::

View File

@ -4,7 +4,7 @@ pytest-2.5.0: now down to ZERO reported bugs!
pytest-2.5.0 is a big fixing release, the result of two community bug pytest-2.5.0 is a big fixing release, the result of two community bug
fixing days plus numerous additional works from many people and fixing days plus numerous additional works from many people and
reporters. The release should be fully compatible to 2.4.2, existing reporters. The release should be fully compatible to 2.4.2, existing
plugins and test suites. We aim at maintaining this level of ZERO reported plugins and test suites. We aim at maintaining this level of ZERO reported
bugs because it's no fun if your testing tool has bugs, is it? Under a bugs because it's no fun if your testing tool has bugs, is it? Under a
condition, though: when submitting a bug report please provide condition, though: when submitting a bug report please provide
clear information about the circumstances and a simple example which clear information about the circumstances and a simple example which
@ -17,12 +17,12 @@ help.
For those who use older Python versions, please note that pytest is not For those who use older Python versions, please note that pytest is not
automatically tested on python2.5 due to virtualenv, setuptools and tox automatically tested on python2.5 due to virtualenv, setuptools and tox
not supporting it anymore. Manual verification shows that it mostly not supporting it anymore. Manual verification shows that it mostly
works fine but it's not going to be part of the automated release works fine but it's not going to be part of the automated release
process and thus likely to break in the future. process and thus likely to break in the future.
As usual, current docs are at As usual, current docs are at
http://pytest.org http://pytest.org
and you can upgrade from pypi via:: and you can upgrade from pypi via::
@ -40,28 +40,28 @@ holger krekel
2.5.0 2.5.0
----------------------------------- -----------------------------------
- dropped python2.5 from automated release testing of pytest itself - dropped python2.5 from automated release testing of pytest itself
which means it's probably going to break soon (but still works which means it's probably going to break soon (but still works
with this release we believe). with this release we believe).
- simplified and fixed implementation for calling finalizers when - simplified and fixed implementation for calling finalizers when
parametrized fixtures or function arguments are involved. finalization parametrized fixtures or function arguments are involved. finalization
is now performed lazily at setup time instead of in the "teardown phase". is now performed lazily at setup time instead of in the "teardown phase".
While this might sound odd at first, it helps to ensure that we are While this might sound odd at first, it helps to ensure that we are
correctly handling setup/teardown even in complex code. User-level code correctly handling setup/teardown even in complex code. User-level code
should not be affected unless it's implementing the pytest_runtest_teardown should not be affected unless it's implementing the pytest_runtest_teardown
hook and expecting certain fixture instances are torn down within (very hook and expecting certain fixture instances are torn down within (very
unlikely and would have been unreliable anyway). unlikely and would have been unreliable anyway).
- PR90: add --color=yes|no|auto option to force terminal coloring - PR90: add --color=yes|no|auto option to force terminal coloring
mode ("auto" is default). Thanks Marc Abramowitz. mode ("auto" is default). Thanks Marc Abramowitz.
- fix issue319 - correctly show unicode in assertion errors. Many - fix issue319 - correctly show unicode in assertion errors. Many
thanks to Floris Bruynooghe for the complete PR. Also means thanks to Floris Bruynooghe for the complete PR. Also means
we depend on py>=1.4.19 now. we depend on py>=1.4.19 now.
- fix issue396 - correctly sort and finalize class-scoped parametrized - fix issue396 - correctly sort and finalize class-scoped parametrized
tests independently from number of methods on the class. tests independently from number of methods on the class.
- refix issue323 in a better way -- parametrization should now never - refix issue323 in a better way -- parametrization should now never
cause Runtime Recursion errors because the underlying algorithm cause Runtime Recursion errors because the underlying algorithm
@ -70,18 +70,18 @@ holger krekel
to problems for more than >966 non-function scoped parameters). to problems for more than >966 non-function scoped parameters).
- fix issue290 - there is preliminary support now for parametrizing - fix issue290 - there is preliminary support now for parametrizing
with repeated same values (sometimes useful to test if calling with repeated same values (sometimes useful to test if calling
a second time works as with the first time). a second time works as with the first time).
- close issue240 - document precisely how pytest module importing - close issue240 - document precisely how pytest module importing
works, discuss the two common test directory layouts, and how it works, discuss the two common test directory layouts, and how it
interacts with PEP420-namespace packages. interacts with PEP420-namespace packages.
- fix issue246 fix finalizer order to be LIFO on independent fixtures - fix issue246 fix finalizer order to be LIFO on independent fixtures
depending on a parametrized higher-than-function scoped fixture. depending on a parametrized higher-than-function scoped fixture.
(was quite some effort so please bear with the complexity of this sentence :) (was quite some effort so please bear with the complexity of this sentence :)
Thanks Ralph Schmitt for the precise failure example. Thanks Ralph Schmitt for the precise failure example.
- fix issue244 by implementing special index for parameters to only use - fix issue244 by implementing special index for parameters to only use
indices for paramentrized test ids indices for paramentrized test ids
@ -99,9 +99,9 @@ holger krekel
filtering with simple strings that are not valid python expressions. filtering with simple strings that are not valid python expressions.
Examples: "-k 1.3" matches all tests parametrized with 1.3. Examples: "-k 1.3" matches all tests parametrized with 1.3.
"-k None" filters all tests that have "None" in their name "-k None" filters all tests that have "None" in their name
and conversely "-k 'not None'". and conversely "-k 'not None'".
Previously these examples would raise syntax errors. Previously these examples would raise syntax errors.
- fix issue384 by removing the trial support code - fix issue384 by removing the trial support code
since the unittest compat enhancements allow since the unittest compat enhancements allow
trial to handle it on its own trial to handle it on its own
@ -109,7 +109,7 @@ holger krekel
- don't hide an ImportError when importing a plugin produces one. - don't hide an ImportError when importing a plugin produces one.
fixes issue375. fixes issue375.
- fix issue275 - allow usefixtures and autouse fixtures - fix issue275 - allow usefixtures and autouse fixtures
for running doctest text files. for running doctest text files.
- fix issue380 by making --resultlog only rely on longrepr instead - fix issue380 by making --resultlog only rely on longrepr instead
@ -135,20 +135,20 @@ holger krekel
(it already did neutralize pytest.mark.xfail markers) (it already did neutralize pytest.mark.xfail markers)
- refine pytest / pkg_resources interactions: The AssertionRewritingHook - refine pytest / pkg_resources interactions: The AssertionRewritingHook
PEP302 compliant loader now registers itself with setuptools/pkg_resources PEP302 compliant loader now registers itself with setuptools/pkg_resources
properly so that the pkg_resources.resource_stream method works properly. properly so that the pkg_resources.resource_stream method works properly.
Fixes issue366. Thanks for the investigations and full PR to Jason R. Coombs. Fixes issue366. Thanks for the investigations and full PR to Jason R. Coombs.
- pytestconfig fixture is now session-scoped as it is the same object during the - pytestconfig fixture is now session-scoped as it is the same object during the
whole test run. Fixes issue370. whole test run. Fixes issue370.
- avoid one surprising case of marker malfunction/confusion:: - avoid one surprising case of marker malfunction/confusion::
@pytest.mark.some(lambda arg: ...) @pytest.mark.some(lambda arg: ...)
def test_function(): def test_function():
would not work correctly because pytest assumes @pytest.mark.some would not work correctly because pytest assumes @pytest.mark.some
gets a function to be decorated already. We now at least detect if this gets a function to be decorated already. We now at least detect if this
arg is a lambda and thus the example will work. Thanks Alex Gaynor arg is a lambda and thus the example will work. Thanks Alex Gaynor
for bringing it up. for bringing it up.
@ -159,11 +159,11 @@ holger krekel
although it's not needed by pytest itself atm. Also although it's not needed by pytest itself atm. Also
fix caching. Fixes issue376. fix caching. Fixes issue376.
- fix issue221 - handle importing of namespace-package with no - fix issue221 - handle importing of namespace-package with no
__init__.py properly. __init__.py properly.
- refactor internal FixtureRequest handling to avoid monkeypatching. - refactor internal FixtureRequest handling to avoid monkeypatching.
One of the positive user-facing effects is that the "request" object One of the positive user-facing effects is that the "request" object
can now be used in closures. can now be used in closures.
- fixed version comparison in pytest.importskip(modname, minverstring) - fixed version comparison in pytest.importskip(modname, minverstring)
@ -172,4 +172,3 @@ holger krekel
does not duplicate the unittest-API into the "plain" namespace. does not duplicate the unittest-API into the "plain" namespace.
- fix verbose reporting for @mock'd test functions - fix verbose reporting for @mock'd test functions

View File

@ -1,8 +1,8 @@
pytest-2.5.1: fixes and new home page styling pytest-2.5.1: fixes and new home page styling
=========================================================================== ===========================================================================
pytest is a mature Python testing tool with more than a 1000 tests pytest is a mature Python testing tool with more than a 1000 tests
against itself, passing on many different interpreters and platforms. against itself, passing on many different interpreters and platforms.
The 2.5.1 release maintains the "zero-reported-bugs" promise by fixing The 2.5.1 release maintains the "zero-reported-bugs" promise by fixing
the three bugs reported since the last release a few days ago. It also the three bugs reported since the last release a few days ago. It also
@ -11,12 +11,12 @@ the flask theme from Armin Ronacher:
http://pytest.org http://pytest.org
If you have anything more to improve styling and docs, If you have anything more to improve styling and docs,
we'd be very happy to merge further pull requests. we'd be very happy to merge further pull requests.
On the coding side, the release also contains a little enhancement to On the coding side, the release also contains a little enhancement to
fixture decorators allowing to directly influence generation of test fixture decorators allowing to directly influence generation of test
ids, thanks to Floris Bruynooghe. Other thanks for helping with ids, thanks to Floris Bruynooghe. Other thanks for helping with
this release go to Anatoly Bubenkoff and Ronny Pfannschmidt. this release go to Anatoly Bubenkoff and Ronny Pfannschmidt.
As usual, you can upgrade from pypi via:: As usual, you can upgrade from pypi via::
@ -37,11 +37,10 @@ holger krekel
- Allow parameterized fixtures to specify the ID of the parameters by - Allow parameterized fixtures to specify the ID of the parameters by
adding an ids argument to pytest.fixture() and pytest.yield_fixture(). adding an ids argument to pytest.fixture() and pytest.yield_fixture().
Thanks Floris Bruynooghe. Thanks Floris Bruynooghe.
- fix issue404 by always using the binary xml escape in the junitxml - fix issue404 by always using the binary xml escape in the junitxml
plugin. Thanks Ronny Pfannschmidt. plugin. Thanks Ronny Pfannschmidt.
- fix issue407: fix addoption docstring to point to argparse instead of - fix issue407: fix addoption docstring to point to argparse instead of
optparse. Thanks Daniel D. Wright. optparse. Thanks Daniel D. Wright.

View File

@ -1,8 +1,8 @@
pytest-2.5.2: fixes pytest-2.5.2: fixes
=========================================================================== ===========================================================================
pytest is a mature Python testing tool with more than a 1000 tests pytest is a mature Python testing tool with more than a 1000 tests
against itself, passing on many different interpreters and platforms. against itself, passing on many different interpreters and platforms.
The 2.5.2 release fixes a few bugs with two maybe-bugs remaining and The 2.5.2 release fixes a few bugs with two maybe-bugs remaining and
actively being worked on (and waiting for the bug reporter's input). actively being worked on (and waiting for the bug reporter's input).
@ -19,18 +19,18 @@ As usual, you can upgrade from pypi via::
Thanks to the following people who contributed to this release: Thanks to the following people who contributed to this release:
Anatoly Bubenkov Anatoly Bubenkov
Ronny Pfannschmidt Ronny Pfannschmidt
Floris Bruynooghe Floris Bruynooghe
Bruno Oliveira Bruno Oliveira
Andreas Pelme Andreas Pelme
Jurko Gospodnetić Jurko Gospodnetić
Piotr Banaszkiewicz Piotr Banaszkiewicz
Simon Liedtke Simon Liedtke
lakka lakka
Lukasz Balcerzak Lukasz Balcerzak
Philippe Muller Philippe Muller
Daniel Hahler Daniel Hahler
have fun, have fun,
holger krekel holger krekel
@ -39,11 +39,11 @@ holger krekel
----------------------------------- -----------------------------------
- fix issue409 -- better interoperate with cx_freeze by not - fix issue409 -- better interoperate with cx_freeze by not
trying to import from collections.abc which causes problems trying to import from collections.abc which causes problems
for py27/cx_freeze. Thanks Wolfgang L. for reporting and tracking it down. for py27/cx_freeze. Thanks Wolfgang L. for reporting and tracking it down.
- fixed docs and code to use "pytest" instead of "py.test" almost everywhere. - fixed docs and code to use "pytest" instead of "py.test" almost everywhere.
Thanks Jurko Gospodnetic for the complete PR. Thanks Jurko Gospodnetic for the complete PR.
- fix issue425: mention at end of "py.test -h" that --markers - fix issue425: mention at end of "py.test -h" that --markers
and --fixtures work according to specified test path (or current dir) and --fixtures work according to specified test path (or current dir)
@ -54,11 +54,10 @@ holger krekel
- copy, cleanup and integrate py.io capture - copy, cleanup and integrate py.io capture
from pylib 1.4.20.dev2 (rev 13d9af95547e) from pylib 1.4.20.dev2 (rev 13d9af95547e)
- address issue416: clarify docs as to conftest.py loading semantics - address issue416: clarify docs as to conftest.py loading semantics
- fix issue429: comparing byte strings with non-ascii chars in assert - fix issue429: comparing byte strings with non-ascii chars in assert
expressions now work better. Thanks Floris Bruynooghe. expressions now work better. Thanks Floris Bruynooghe.
- make capfd/capsys.capture private, its unused and shouldn't be exposed - make capfd/capsys.capture private, its unused and shouldn't be exposed

View File

@ -52,8 +52,7 @@ Changes 2.6.1
"::" node id specifications (copy pasted from "-v" output) "::" node id specifications (copy pasted from "-v" output)
- fix issue544 by only removing "@NUM" at the end of "::" separated parts - fix issue544 by only removing "@NUM" at the end of "::" separated parts
and if the part has an ".py" extension and if the part has a ".py" extension
- don't use py.std import helper, rather import things directly. - don't use py.std import helper, rather import things directly.
Thanks Bruno Oliveira. Thanks Bruno Oliveira.

View File

@ -49,4 +49,3 @@ holger krekel
- Do not mark as universal wheel because Python 2.6 is different from - Do not mark as universal wheel because Python 2.6 is different from
other builds due to the extra argparse dependency. Fixes issue566. other builds due to the extra argparse dependency. Fixes issue566.
Thanks sontek. Thanks sontek.

View File

@ -49,4 +49,3 @@ Changes 2.6.3
- check xfail/skip also with non-python function test items. Thanks - check xfail/skip also with non-python function test items. Thanks
Floris Bruynooghe. Floris Bruynooghe.

View File

@ -98,4 +98,3 @@ holger krekel
- On failure, the ``sys.last_value``, ``sys.last_type`` and - On failure, the ``sys.last_value``, ``sys.last_type`` and
``sys.last_traceback`` are set, so that a user can inspect the error ``sys.last_traceback`` are set, so that a user can inspect the error
via postmortem debugging (almarklein). via postmortem debugging (almarklein).

View File

@ -55,4 +55,3 @@ The py.test Development Team
- fix issue756, fix issue752 (and similar issues): depend on py-1.4.29 - fix issue756, fix issue752 (and similar issues): depend on py-1.4.29
which has a refined algorithm for traceback generation. which has a refined algorithm for traceback generation.

View File

@ -53,7 +53,6 @@ The py.test Development Team
Thanks Gabriel Reis for the PR. Thanks Gabriel Reis for the PR.
- add more talks to the documentation - add more talks to the documentation
- extend documentation on the --ignore cli option - extend documentation on the --ignore cli option
- use pytest-runner for setuptools integration - use pytest-runner for setuptools integration
- minor fixes for interaction with OS X El Capitan system integrity protection (thanks Florian) - minor fixes for interaction with OS X El Capitan system integrity protection (thanks Florian)

View File

@ -28,4 +28,4 @@ The py.test Development Team
2.8.7 (compared to 2.8.6) 2.8.7 (compared to 2.8.6)
------------------------- -------------------------
- fix #1338: use predictable object resolution for monkeypatch - fix #1338: use predictable object resolution for monkeypatch

View File

@ -14,25 +14,25 @@ As usual, you can upgrade from pypi via::
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:
Anatoly Bubenkov Anatoly Bubenkov
Bruno Oliveira Bruno Oliveira
Buck Golemon Buck Golemon
David Vierra David Vierra
Florian Bruhin Florian Bruhin
Galaczi Endre Galaczi Endre
Georgy Dyuldin Georgy Dyuldin
Lukas Bednar Lukas Bednar
Luke Murphy Luke Murphy
Marcin Biernat Marcin Biernat
Matt Williams Matt Williams
Michael Aquilina Michael Aquilina
Raphael Pierzina Raphael Pierzina
Ronny Pfannschmidt Ronny Pfannschmidt
Ryan Wooden Ryan Wooden
Tiemo Kieft Tiemo Kieft
TomV TomV
holger krekel holger krekel
jab jab
Happy testing, Happy testing,
@ -76,18 +76,18 @@ The py.test Development Team
**Changes** **Changes**
* **Important**: `py.code <https://pylib.readthedocs.io/en/latest/code.html>`_ has been * **Important**: `py.code <https://pylib.readthedocs.io/en/latest/code.html>`_ has been
merged into the ``pytest`` repository as ``pytest._code``. This decision merged into the ``pytest`` repository as ``pytest._code``. This decision
was made because ``py.code`` had very few uses outside ``pytest`` and the was made because ``py.code`` had very few uses outside ``pytest`` and the
fact that it was in a different repository made it difficult to fix bugs on fact that it was in a different repository made it difficult to fix bugs on
its code in a timely manner. The team hopes with this to be able to better its code in a timely manner. The team hopes with this to be able to better
refactor out and improve that code. refactor out and improve that code.
This change shouldn't affect users, but it is useful to let users aware This change shouldn't affect users, but it is useful to let users aware
if they encounter any strange behavior. if they encounter any strange behavior.
Keep in mind that the code for ``pytest._code`` is **private** and Keep in mind that the code for ``pytest._code`` is **private** and
**experimental**, so you definitely should not import it explicitly! **experimental**, so you definitely should not import it explicitly!
Please note that the original ``py.code`` is still available in Please note that the original ``py.code`` is still available in
`pylib <https://pylib.readthedocs.io>`_. `pylib <https://pylib.readthedocs.io>`_.
* ``pytest_enter_pdb`` now optionally receives the pytest config object. * ``pytest_enter_pdb`` now optionally receives the pytest config object.
@ -129,8 +129,8 @@ The py.test Development Team
* Fix (`#1422`_): junit record_xml_property doesn't allow multiple records * Fix (`#1422`_): junit record_xml_property doesn't allow multiple records
with same name. with same name.
.. _`traceback style docs`: https://pytest.org/latest/usage.html#modifying-python-traceback-printing .. _`traceback style docs`: https://pytest.org/latest/usage.html#modifying-python-traceback-printing
.. _#1422: https://github.com/pytest-dev/pytest/issues/1422 .. _#1422: https://github.com/pytest-dev/pytest/issues/1422
@ -156,4 +156,4 @@ The py.test Development Team
.. _@tomviner: https://github.com/tomviner .. _@tomviner: https://github.com/tomviner
.. _@RonnyPfannschmidt: https://github.com/RonnyPfannschmidt .. _@RonnyPfannschmidt: https://github.com/RonnyPfannschmidt
.. _@rabbbit: https://github.com/rabbbit .. _@rabbbit: https://github.com/rabbbit
.. _@hackebrot: https://github.com/hackebrot .. _@hackebrot: https://github.com/hackebrot

View File

@ -14,17 +14,17 @@ As usual, you can upgrade from pypi via::
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:
Bruno Oliveira Bruno Oliveira
Daniel Hahler Daniel Hahler
Dmitry Malinovsky Dmitry Malinovsky
Florian Bruhin Florian Bruhin
Floris Bruynooghe Floris Bruynooghe
Matt Bachmann Matt Bachmann
Ronny Pfannschmidt Ronny Pfannschmidt
TomV TomV
Vladimir Bolshakov Vladimir Bolshakov
Zearin Zearin
palaviv palaviv
Happy testing, Happy testing,

View File

@ -8,10 +8,10 @@ against itself, passing on many different interpreters and platforms.
This release contains a lot of bugs fixes and improvements, and much of This release contains a lot of bugs fixes and improvements, and much of
the work done on it was possible because of the 2016 Sprint[1], which the work done on it was possible because of the 2016 Sprint[1], which
was funded by an indiegogo campaign which raised over US$12,000 with was funded by an indiegogo campaign which raised over US$12,000 with
nearly 100 backers. nearly 100 backers.
There's a "What's new in pytest 3.0" [2] blog post highlighting the There's a "What's new in pytest 3.0" [2] blog post highlighting the
major features in this release. major features in this release.
To see the complete changelog and documentation, please visit: To see the complete changelog and documentation, please visit:

View File

@ -7,7 +7,7 @@ This release fixes some regressions reported in version 3.0.0, being a
drop-in replacement. To upgrade: drop-in replacement. To upgrade:
pip install --upgrade pytest pip install --upgrade pytest
The changelog is available at http://doc.pytest.org/en/latest/changelog.html. The changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -7,7 +7,7 @@ This release fixes some regressions and bugs reported in version 3.0.1, being a
drop-in replacement. To upgrade:: drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The changelog is available at http://doc.pytest.org/en/latest/changelog.html. The changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -3,11 +3,11 @@ pytest-3.0.3
pytest 3.0.3 has just been released to PyPI. pytest 3.0.3 has just been released to PyPI.
This release fixes some regressions and bugs reported in the last version, This release fixes some regressions and bugs reported in the last version,
being a drop-in replacement. To upgrade:: being a drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The changelog is available at http://doc.pytest.org/en/latest/changelog.html. The changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -3,11 +3,11 @@ pytest-3.0.4
pytest 3.0.4 has just been released to PyPI. pytest 3.0.4 has just been released to PyPI.
This release fixes some regressions and bugs reported in the last version, This release fixes some regressions and bugs reported in the last version,
being a drop-in replacement. To upgrade:: being a drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The changelog is available at http://doc.pytest.org/en/latest/changelog.html. The changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -6,7 +6,7 @@ pytest 3.0.5 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade:: This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The changelog is available at http://doc.pytest.org/en/latest/changelog.html. The changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -6,7 +6,7 @@ pytest 3.0.6 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade:: This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.

View File

@ -6,7 +6,7 @@ pytest 3.0.7 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade:: This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -6,7 +6,7 @@ pytest 3.1.1 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade:: This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -6,7 +6,7 @@ pytest 3.1.2 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade:: This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -6,7 +6,7 @@ pytest 3.1.3 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade:: This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -6,7 +6,7 @@ pytest 3.2.1 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade:: This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -6,7 +6,7 @@ pytest 3.2.2 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade:: This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -6,7 +6,7 @@ pytest 3.2.3 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade:: This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -6,7 +6,7 @@ pytest 3.2.4 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade:: This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -6,7 +6,7 @@ pytest 3.2.5 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade:: This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -6,7 +6,7 @@ pytest 3.3.1 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade:: This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -6,7 +6,7 @@ pytest 3.3.2 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade:: This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -6,7 +6,7 @@ pytest 3.4.1 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade:: This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -6,7 +6,7 @@ pytest 3.4.2 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade:: This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -6,7 +6,7 @@ pytest 3.5.1 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade:: This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html. The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them: Thanks to all who contributed to this release, among them:

View File

@ -0,0 +1,41 @@
pytest-3.6.0
=======================================
The pytest team is proud to announce the 3.6.0 release!
pytest is a mature Python testing tool with more than a 1600 tests
against itself, passing on many different interpreters and platforms.
This release contains a number of bugs fixes and improvements, so users are encouraged
to take a look at the CHANGELOG:
http://doc.pytest.org/en/latest/changelog.html
For complete documentation, please visit:
http://docs.pytest.org
As usual, you can upgrade from pypi via:
pip install -U pytest
Thanks to all who contributed to this release, among them:
* Anthony Shaw
* ApaDoctor
* Brian Maissy
* Bruno Oliveira
* Jon Dufresne
* Katerina Koukiou
* Miro Hrončok
* Rachel Kogan
* Ronny Pfannschmidt
* Tim Hughes
* Tyler Goodlet
* Ville Skyttä
* aviral1701
* feuillemorte
Happy testing,
The Pytest Development Team

View File

@ -0,0 +1,24 @@
pytest-3.6.1
=======================================
pytest 3.6.1 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:
* Anthony Sottile
* Bruno Oliveira
* Jeffrey Rackauckas
* Miro Hrončok
* Niklas Meinzer
* Oliver Bestwalter
* Ronny Pfannschmidt
Happy testing,
The pytest Development Team

View File

@ -0,0 +1,29 @@
pytest-3.6.2
=======================================
pytest 3.6.2 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:
* Alan Velasco
* Alex Barbato
* Anthony Sottile
* Bartosz Cierocki
* Bruno Oliveira
* Daniel Hahler
* Guoqiang Zhang
* Hynek Schlawack
* John T. Wodder II
* Michael Käufl
* Ronny Pfannschmidt
* Samuel Dion-Girardeau
Happy testing,
The pytest Development Team

View File

@ -0,0 +1,28 @@
pytest-3.6.3
=======================================
pytest 3.6.3 has just been released to PyPI.
This is a bug-fix release, being a drop-in replacement. To upgrade::
pip install --upgrade pytest
The full changelog is available at http://doc.pytest.org/en/latest/changelog.html.
Thanks to all who contributed to this release, among them:
* AdamEr8
* Anthony Sottile
* Bruno Oliveira
* Jean-Paul Calderone
* Jon Dufresne
* Marcelo Duarte Trevisani
* Ondřej Súkup
* Ronny Pfannschmidt
* T.E.A de Souza
* Victor
* victor
Happy testing,
The pytest Development Team

View File

@ -29,17 +29,17 @@ you will see the return value of the function call::
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 item collected 1 item
test_assert1.py F [100%] test_assert1.py F [100%]
================================= FAILURES ================================= ================================= FAILURES =================================
______________________________ test_function _______________________________ ______________________________ test_function _______________________________
def test_function(): def test_function():
> assert f() == 4 > assert f() == 4
E assert 3 == 4 E assert 3 == 4
E + where 3 = f() E + where 3 = f()
test_assert1.py:5: AssertionError test_assert1.py:5: AssertionError
========================= 1 failed in 0.12 seconds ========================= ========================= 1 failed in 0.12 seconds =========================
@ -91,7 +91,7 @@ In the context manager form you may use the keyword argument
``message`` to specify a custom failure message:: ``message`` to specify a custom failure message::
>>> with raises(ZeroDivisionError, message="Expecting ZeroDivisionError"): >>> with raises(ZeroDivisionError, message="Expecting ZeroDivisionError"):
... pass ... pass
... Failed: Expecting ZeroDivisionError ... Failed: Expecting ZeroDivisionError
If you want to write test code that works on Python 2.4 as well, If you want to write test code that works on Python 2.4 as well,
@ -172,12 +172,12 @@ if you run this module::
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 item collected 1 item
test_assert2.py F [100%] test_assert2.py F [100%]
================================= FAILURES ================================= ================================= FAILURES =================================
___________________________ test_set_comparison ____________________________ ___________________________ test_set_comparison ____________________________
def test_set_comparison(): def test_set_comparison():
set1 = set("1308") set1 = set("1308")
set2 = set("8035") set2 = set("8035")
@ -188,7 +188,7 @@ if you run this module::
E Extra items in the right set: E Extra items in the right set:
E '5' E '5'
E Use -v to get the full diff E Use -v to get the full diff
test_assert2.py:5: AssertionError test_assert2.py:5: AssertionError
========================= 1 failed in 0.12 seconds ========================= ========================= 1 failed in 0.12 seconds =========================
@ -209,7 +209,7 @@ the ``pytest_assertrepr_compare`` hook.
.. autofunction:: _pytest.hookspec.pytest_assertrepr_compare .. autofunction:: _pytest.hookspec.pytest_assertrepr_compare
:noindex: :noindex:
As an example consider adding the following hook in a :ref:`conftest.py <conftest.py>` As an example consider adding the following hook in a :ref:`conftest.py <conftest.py>`
file which provides an alternative explanation for ``Foo`` objects:: file which provides an alternative explanation for ``Foo`` objects::
# content of conftest.py # content of conftest.py
@ -241,14 +241,14 @@ the conftest file::
F [100%] F [100%]
================================= FAILURES ================================= ================================= FAILURES =================================
_______________________________ test_compare _______________________________ _______________________________ test_compare _______________________________
def test_compare(): def test_compare():
f1 = Foo(1) f1 = Foo(1)
f2 = Foo(2) f2 = Foo(2)
> assert f1 == f2 > assert f1 == f2
E assert Comparing Foo instances: E assert Comparing Foo instances:
E vals: 1 != 2 E vals: 1 != 2
test_foocompare.py:11: AssertionError test_foocompare.py:11: AssertionError
1 failed in 0.12 seconds 1 failed in 0.12 seconds

View File

@ -14,7 +14,7 @@ Install argcomplete using::
For global activation of all argcomplete enabled python applications run:: For global activation of all argcomplete enabled python applications run::
sudo activate-global-python-argcomplete sudo activate-global-python-argcomplete
For permanent (but not global) ``pytest`` activation, use:: For permanent (but not global) ``pytest`` activation, use::
@ -23,6 +23,3 @@ For permanent (but not global) ``pytest`` activation, use::
For one-time activation of argcomplete for ``pytest`` only, use:: For one-time activation of argcomplete for ``pytest`` only, use::
eval "$(register-python-argcomplete pytest)" eval "$(register-python-argcomplete pytest)"

View File

@ -17,13 +17,13 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
$ pytest -q --fixtures $ pytest -q --fixtures
cache cache
Return a cache object that can persist state between testing sessions. Return a cache object that can persist state between testing sessions.
cache.get(key, default) cache.get(key, default)
cache.set(key, value) cache.set(key, value)
Keys must be a ``/`` separated value, where the first part is usually the Keys must be a ``/`` separated value, where the first part is usually the
name of your plugin or application to avoid clashes with other cache users. name of your plugin or application to avoid clashes with other cache users.
Values can be any object handled by the json stdlib module. Values can be any object handled by the json stdlib module.
capsys capsys
Enable capturing of writes to ``sys.stdout`` and ``sys.stderr`` and make Enable capturing of writes to ``sys.stdout`` and ``sys.stderr`` and make
@ -49,9 +49,9 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests. Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests.
pytestconfig pytestconfig
Session-scoped fixture that returns the :class:`_pytest.config.Config` object. Session-scoped fixture that returns the :class:`_pytest.config.Config` object.
Example:: Example::
def test_foo(pytestconfig): def test_foo(pytestconfig):
if pytestconfig.getoption("verbose"): if pytestconfig.getoption("verbose"):
... ...
@ -61,9 +61,9 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
configured reporters, like JUnit XML. configured reporters, like JUnit XML.
The fixture is callable with ``(name, value)``, with value being automatically The fixture is callable with ``(name, value)``, with value being automatically
xml-encoded. xml-encoded.
Example:: Example::
def test_function(record_property): def test_function(record_property):
record_property("example_key", 1) record_property("example_key", 1)
record_xml_property record_xml_property
@ -74,9 +74,9 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
automatically xml-encoded automatically xml-encoded
caplog caplog
Access and control log capturing. Access and control log capturing.
Captured logs are available through the following methods:: Captured logs are available through the following methods::
* caplog.text -> string containing formatted log output * caplog.text -> string containing formatted log output
* caplog.records -> list of logging.LogRecord instances * caplog.records -> list of logging.LogRecord instances
* caplog.record_tuples -> list of (logger_name, level, message) tuples * caplog.record_tuples -> list of (logger_name, level, message) tuples
@ -84,23 +84,23 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
monkeypatch monkeypatch
The returned ``monkeypatch`` fixture provides these The returned ``monkeypatch`` fixture provides these
helper methods to modify objects, dictionaries or os.environ:: helper methods to modify objects, dictionaries or os.environ::
monkeypatch.setattr(obj, name, value, raising=True) monkeypatch.setattr(obj, name, value, raising=True)
monkeypatch.delattr(obj, name, raising=True) monkeypatch.delattr(obj, name, raising=True)
monkeypatch.setitem(mapping, name, value) monkeypatch.setitem(mapping, name, value)
monkeypatch.delitem(obj, name, raising=True) monkeypatch.delitem(obj, name, raising=True)
monkeypatch.setenv(name, value, prepend=False) monkeypatch.setenv(name, value, prepend=False)
monkeypatch.delenv(name, value, raising=True) monkeypatch.delenv(name, raising=True)
monkeypatch.syspath_prepend(path) monkeypatch.syspath_prepend(path)
monkeypatch.chdir(path) monkeypatch.chdir(path)
All modifications will be undone after the requesting All modifications will be undone after the requesting
test function or fixture has finished. The ``raising`` test function or fixture has finished. The ``raising``
parameter determines if a KeyError or AttributeError parameter determines if a KeyError or AttributeError
will be raised if the set/deletion operation has no target. will be raised if the set/deletion operation has no target.
recwarn recwarn
Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions. Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.
See http://docs.python.org/library/warnings.html for information See http://docs.python.org/library/warnings.html for information
on warning categories. on warning categories.
tmpdir_factory tmpdir_factory
@ -111,13 +111,12 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
created as a sub directory of the base temporary created as a sub directory of the base temporary
directory. The returned object is a `py.path.local`_ directory. The returned object is a `py.path.local`_
path object. path object.
.. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html .. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html
no tests ran in 0.12 seconds no tests ran in 0.12 seconds
You can also interactively ask for help, e.g. by typing on the Python interactive prompt something like:: You can also interactively ask for help, e.g. by typing on the Python interactive prompt something like::
import pytest import pytest
help(pytest) help(pytest)

View File

@ -20,7 +20,7 @@ last ``pytest`` invocation:
For cleanup (usually not needed), a ``--cache-clear`` option allows to remove For cleanup (usually not needed), a ``--cache-clear`` option allows to remove
all cross-session cache contents ahead of a test run. all cross-session cache contents ahead of a test run.
Other plugins may access the `config.cache`_ object to set/get Other plugins may access the `config.cache`_ object to set/get
**json encodable** values between ``pytest`` invocations. **json encodable** values between ``pytest`` invocations.
.. note:: .. note::
@ -49,26 +49,26 @@ If you run this for the first time you will see two failures::
.................F.......F........................ [100%] .................F.......F........................ [100%]
================================= FAILURES ================================= ================================= FAILURES =================================
_______________________________ test_num[17] _______________________________ _______________________________ test_num[17] _______________________________
i = 17 i = 17
@pytest.mark.parametrize("i", range(50)) @pytest.mark.parametrize("i", range(50))
def test_num(i): def test_num(i):
if i in (17, 25): if i in (17, 25):
> pytest.fail("bad luck") > pytest.fail("bad luck")
E Failed: bad luck E Failed: bad luck
test_50.py:6: Failed test_50.py:6: Failed
_______________________________ test_num[25] _______________________________ _______________________________ test_num[25] _______________________________
i = 25 i = 25
@pytest.mark.parametrize("i", range(50)) @pytest.mark.parametrize("i", range(50))
def test_num(i): def test_num(i):
if i in (17, 25): if i in (17, 25):
> pytest.fail("bad luck") > pytest.fail("bad luck")
E Failed: bad luck E Failed: bad luck
test_50.py:6: Failed test_50.py:6: Failed
2 failed, 48 passed in 0.12 seconds 2 failed, 48 passed in 0.12 seconds
@ -80,31 +80,31 @@ If you then run it with ``--lf``::
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
collected 50 items / 48 deselected collected 50 items / 48 deselected
run-last-failure: rerun previous 2 failures run-last-failure: rerun previous 2 failures
test_50.py FF [100%] test_50.py FF [100%]
================================= FAILURES ================================= ================================= FAILURES =================================
_______________________________ test_num[17] _______________________________ _______________________________ test_num[17] _______________________________
i = 17 i = 17
@pytest.mark.parametrize("i", range(50)) @pytest.mark.parametrize("i", range(50))
def test_num(i): def test_num(i):
if i in (17, 25): if i in (17, 25):
> pytest.fail("bad luck") > pytest.fail("bad luck")
E Failed: bad luck E Failed: bad luck
test_50.py:6: Failed test_50.py:6: Failed
_______________________________ test_num[25] _______________________________ _______________________________ test_num[25] _______________________________
i = 25 i = 25
@pytest.mark.parametrize("i", range(50)) @pytest.mark.parametrize("i", range(50))
def test_num(i): def test_num(i):
if i in (17, 25): if i in (17, 25):
> pytest.fail("bad luck") > pytest.fail("bad luck")
E Failed: bad luck E Failed: bad luck
test_50.py:6: Failed test_50.py:6: Failed
================= 2 failed, 48 deselected in 0.12 seconds ================== ================= 2 failed, 48 deselected in 0.12 seconds ==================
@ -121,31 +121,31 @@ of ``FF`` and dots)::
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
collected 50 items collected 50 items
run-last-failure: rerun previous 2 failures first run-last-failure: rerun previous 2 failures first
test_50.py FF................................................ [100%] test_50.py FF................................................ [100%]
================================= FAILURES ================================= ================================= FAILURES =================================
_______________________________ test_num[17] _______________________________ _______________________________ test_num[17] _______________________________
i = 17 i = 17
@pytest.mark.parametrize("i", range(50)) @pytest.mark.parametrize("i", range(50))
def test_num(i): def test_num(i):
if i in (17, 25): if i in (17, 25):
> pytest.fail("bad luck") > pytest.fail("bad luck")
E Failed: bad luck E Failed: bad luck
test_50.py:6: Failed test_50.py:6: Failed
_______________________________ test_num[25] _______________________________ _______________________________ test_num[25] _______________________________
i = 25 i = 25
@pytest.mark.parametrize("i", range(50)) @pytest.mark.parametrize("i", range(50))
def test_num(i): def test_num(i):
if i in (17, 25): if i in (17, 25):
> pytest.fail("bad luck") > pytest.fail("bad luck")
E Failed: bad luck E Failed: bad luck
test_50.py:6: Failed test_50.py:6: Failed
=================== 2 failed, 48 passed in 0.12 seconds ==================== =================== 2 failed, 48 passed in 0.12 seconds ====================
@ -198,13 +198,13 @@ of the sleep::
F [100%] F [100%]
================================= FAILURES ================================= ================================= FAILURES =================================
______________________________ test_function _______________________________ ______________________________ test_function _______________________________
mydata = 42 mydata = 42
def test_function(mydata): def test_function(mydata):
> assert mydata == 23 > assert mydata == 23
E assert 42 == 23 E assert 42 == 23
test_caching.py:14: AssertionError test_caching.py:14: AssertionError
1 failed in 0.12 seconds 1 failed in 0.12 seconds
@ -215,13 +215,13 @@ the cache and this will be quick::
F [100%] F [100%]
================================= FAILURES ================================= ================================= FAILURES =================================
______________________________ test_function _______________________________ ______________________________ test_function _______________________________
mydata = 42 mydata = 42
def test_function(mydata): def test_function(mydata):
> assert mydata == 23 > assert mydata == 23
E assert 42 == 23 E assert 42 == 23
test_caching.py:14: AssertionError test_caching.py:14: AssertionError
1 failed in 0.12 seconds 1 failed in 0.12 seconds
@ -234,7 +234,7 @@ Inspecting Cache content
You can always peek at the content of the cache using the You can always peek at the content of the cache using the
``--cache-show`` command line option:: ``--cache-show`` command line option::
$ py.test --cache-show $ pytest --cache-show
=========================== test session starts ============================ =========================== test session starts ============================
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
@ -246,7 +246,7 @@ You can always peek at the content of the cache using the
['test_caching.py::test_function'] ['test_caching.py::test_function']
example/value contains: example/value contains:
42 42
======================= no tests ran in 0.12 seconds ======================= ======================= no tests ran in 0.12 seconds =======================
Clearing Cache content Clearing Cache content
@ -260,5 +260,3 @@ by adding the ``--cache-clear`` option like this::
This is recommended for invocations from Continuous Integration This is recommended for invocations from Continuous Integration
servers where isolation and correctness is more important servers where isolation and correctness is more important
than speed. than speed.

View File

@ -68,16 +68,16 @@ of the failing function and hide the other one::
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR, inifile: rootdir: $REGENDOC_TMPDIR, inifile:
collected 2 items collected 2 items
test_module.py .F [100%] test_module.py .F [100%]
================================= FAILURES ================================= ================================= FAILURES =================================
________________________________ test_func2 ________________________________ ________________________________ test_func2 ________________________________
def test_func2(): def test_func2():
> assert False > assert False
E assert False E assert False
test_module.py:9: AssertionError test_module.py:9: AssertionError
-------------------------- Captured stdout setup --------------------------- -------------------------- Captured stdout setup ---------------------------
setting up <function test_func2 at 0xdeadbeef> setting up <function test_func2 at 0xdeadbeef>
@ -92,7 +92,7 @@ an example test function that performs some output related checks:
.. code-block:: python .. code-block:: python
def test_myoutput(capsys): # or use "capfd" for fd-level def test_myoutput(capsys): # or use "capfd" for fd-level
print("hello") print("hello")
sys.stderr.write("world\n") sys.stderr.write("world\n")
captured = capsys.readouterr() captured = capsys.readouterr()
@ -145,9 +145,9 @@ as a context manager, disabling capture inside the ``with`` block:
.. code-block:: python .. code-block:: python
def test_disabling_capturing(capsys): def test_disabling_capturing(capsys):
print('this output is captured') print("this output is captured")
with capsys.disabled(): with capsys.disabled():
print('output not captured, going directly to sys.stdout') print("output not captured, going directly to sys.stdout")
print('this output is also captured') print("this output is also captured")
.. include:: links.inc .. include:: links.inc

View File

@ -1,17 +0,0 @@
import py
import subprocess
def test_build_docs(tmpdir):
doctrees = tmpdir.join("doctrees")
htmldir = tmpdir.join("html")
subprocess.check_call([
"sphinx-build", "-W", "-bhtml",
"-d", str(doctrees), ".", str(htmldir)])
def test_linkcheck(tmpdir):
doctrees = tmpdir.join("doctrees")
htmldir = tmpdir.join("html")
subprocess.check_call(
["sphinx-build", "-blinkcheck",
"-d", str(doctrees), ".", str(htmldir)])

View File

@ -20,6 +20,7 @@
import os import os
import sys import sys
import datetime
from _pytest import __version__ as version from _pytest import __version__ as version
@ -28,7 +29,7 @@ release = ".".join(version.split(".")[:2])
# If extensions (or modules to document with autodoc) are in another directory, # If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.')) # sys.path.insert(0, os.path.abspath('.'))
autodoc_member_order = "bysource" autodoc_member_order = "bysource"
todo_include_todos = 1 todo_include_todos = 1
@ -36,58 +37,68 @@ todo_include_todos = 1
# -- General configuration ----------------------------------------------------- # -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here. # If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0' # needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions # Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.autosummary', extensions = [
'sphinx.ext.intersphinx', 'sphinx.ext.viewcode', 'sphinxcontrib_trio'] "sphinx.ext.autodoc",
"sphinx.ext.todo",
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
"sphinxcontrib_trio",
]
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] templates_path = ["_templates"]
# The suffix of source filenames. # The suffix of source filenames.
source_suffix = '.rst' source_suffix = ".rst"
# The encoding of source files. # The encoding of source files.
#source_encoding = 'utf-8-sig' # source_encoding = 'utf-8-sig'
# The master toctree document. # The master toctree document.
master_doc = 'contents' master_doc = "contents"
# General information about the project. # General information about the project.
project = u'pytest' project = u"pytest"
copyright = u'2015, holger krekel and pytest-dev team' year = datetime.datetime.utcnow().year
copyright = u"2015{} , holger krekel and pytest-dev team".format(year)
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
#language = None # language = None
# There are two options for replacing |today|: either, you set today to some # There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used: # non-false value, then it is used:
#today = '' # today = ''
# Else, today_fmt is used as the format for a strftime call. # Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y' # today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and # List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files. # directories to ignore when looking for source files.
exclude_patterns = ['links.inc', '_build', 'naming20.rst', 'test/*', exclude_patterns = [
"links.inc",
"_build",
"naming20.rst",
"test/*",
"old_*", "old_*",
'*attic*', "*attic*",
'*/attic*', "*/attic*",
'funcargs.rst', "funcargs.rst",
'setup.rst', "setup.rst",
'example/remoteinterp.rst', "example/remoteinterp.rst",
] ]
# The reST default role (used for this markup: `text`) to use for all documents. # The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None # default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text. # If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True # add_function_parentheses = True
# If true, the current module name will be prepended to all description # If true, the current module name will be prepended to all description
# unit titles (such as .. function::). # unit titles (such as .. function::).
@ -95,39 +106,36 @@ add_module_names = False
# If true, sectionauthor and moduleauthor directives will be shown in the # If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default. # output. They are ignored by default.
#show_authors = False # show_authors = False
# The name of the Pygments (syntax highlighting) style to use. # The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx' pygments_style = "sphinx"
# A list of ignored prefixes for module index sorting. # A list of ignored prefixes for module index sorting.
#modindex_common_prefix = [] # modindex_common_prefix = []
# -- Options for HTML output --------------------------------------------------- # -- Options for HTML output ---------------------------------------------------
sys.path.append(os.path.abspath('_themes')) sys.path.append(os.path.abspath("_themes"))
html_theme_path = ['_themes'] html_theme_path = ["_themes"]
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
html_theme = 'flask' html_theme = "flask"
# Theme options are theme-specific and customize the look and feel of a theme # Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the # further. For a list of options available for each theme, see the
# documentation. # documentation.
html_theme_options = { html_theme_options = {"index_logo": None}
'index_logo': None
}
# Add any paths that contain custom themes here, relative to this directory. # Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = [] # html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to # The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation". # "<project> v<release> documentation".
html_title = 'pytest documentation' html_title = "pytest documentation"
# A shorter title for the navigation bar. Default is the same as html_title. # A shorter title for the navigation bar. Default is the same as html_title.
html_short_title = "pytest-%s" % release html_short_title = "pytest-%s" % release
@ -148,37 +156,37 @@ html_favicon = "img/pytest1favi.ico"
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format. # using the given strftime format.
#html_last_updated_fmt = '%b %d, %Y' # html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to # If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities. # typographically correct entities.
#html_use_smartypants = True # html_use_smartypants = True
# Custom sidebar templates, maps document names to template names. # Custom sidebar templates, maps document names to template names.
#html_sidebars = {} # html_sidebars = {}
#html_sidebars = {'index': 'indexsidebar.html'} # html_sidebars = {'index': 'indexsidebar.html'}
html_sidebars = { html_sidebars = {
'index': [ "index": [
'sidebarintro.html', "sidebarintro.html",
'globaltoc.html', "globaltoc.html",
'links.html', "links.html",
'sourcelink.html', "sourcelink.html",
'searchbox.html' "searchbox.html",
],
"**": [
"globaltoc.html",
"relations.html",
"links.html",
"sourcelink.html",
"searchbox.html",
], ],
'**': [
'globaltoc.html',
'relations.html',
'links.html',
'sourcelink.html',
'searchbox.html'
]
} }
# Additional templates that should be rendered to pages, maps page names to # Additional templates that should be rendered to pages, maps page names to
# template names. # template names.
#html_additional_pages = {} # html_additional_pages = {}
#html_additional_pages = {'index': 'index.html'} # html_additional_pages = {'index': 'index.html'}
# If false, no module index is generated. # If false, no module index is generated.
@ -188,63 +196,68 @@ html_domain_indices = True
html_use_index = False html_use_index = False
# If true, the index is split into individual pages for each letter. # If true, the index is split into individual pages for each letter.
#html_split_index = False # html_split_index = False
# If true, links to the reST sources are added to the pages. # If true, links to the reST sources are added to the pages.
html_show_sourcelink = False html_show_sourcelink = False
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True # html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True # html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will # If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the # contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served. # base URL from which the finished HTML is served.
#html_use_opensearch = '' # html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml"). # This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None # html_file_suffix = None
# Output file base name for HTML help builder. # Output file base name for HTML help builder.
htmlhelp_basename = 'pytestdoc' htmlhelp_basename = "pytestdoc"
# -- Options for LaTeX output -------------------------------------------------- # -- Options for LaTeX output --------------------------------------------------
# The paper size ('letter' or 'a4'). # The paper size ('letter' or 'a4').
#latex_paper_size = 'letter' # latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt'). # The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt' # latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples # Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]). # (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [ latex_documents = [
('contents', 'pytest.tex', u'pytest Documentation', (
u'holger krekel, trainer and consultant, http://merlinux.eu', 'manual'), "contents",
"pytest.tex",
u"pytest Documentation",
u"holger krekel, trainer and consultant, http://merlinux.eu",
"manual",
)
] ]
# The name of an image file (relative to this directory) to place at the top of # The name of an image file (relative to this directory) to place at the top of
# the title page. # the title page.
latex_logo = 'img/pytest1.png' latex_logo = "img/pytest1.png"
# For "manual" documents, if this is true, then toplevel headings are parts, # For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters. # not chapters.
#latex_use_parts = False # latex_use_parts = False
# If true, show page references after internal links. # If true, show page references after internal links.
#latex_show_pagerefs = False # latex_show_pagerefs = False
# If true, show URL addresses after external links. # If true, show URL addresses after external links.
#latex_show_urls = False # latex_show_urls = False
# Additional stuff for the LaTeX preamble. # Additional stuff for the LaTeX preamble.
#latex_preamble = '' # latex_preamble = ''
# Documents to append as an appendix to all manuals. # Documents to append as an appendix to all manuals.
#latex_appendices = [] # latex_appendices = []
# If false, no module index is generated. # If false, no module index is generated.
latex_domain_indices = False latex_domain_indices = False
@ -253,72 +266,78 @@ latex_domain_indices = False
# One entry per manual page. List of tuples # One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section). # (source start file, name, description, authors, manual section).
man_pages = [ man_pages = [("usage", "pytest", u"pytest usage", [u"holger krekel at merlinux eu"], 1)]
('usage', 'pytest', u'pytest usage',
[u'holger krekel at merlinux eu'], 1)
]
# -- Options for Epub output --------------------------------------------------- # -- Options for Epub output ---------------------------------------------------
# Bibliographic Dublin Core info. # Bibliographic Dublin Core info.
epub_title = u'pytest' epub_title = u"pytest"
epub_author = u'holger krekel at merlinux eu' epub_author = u"holger krekel at merlinux eu"
epub_publisher = u'holger krekel at merlinux eu' epub_publisher = u"holger krekel at merlinux eu"
epub_copyright = u'2013, holger krekel et alii' epub_copyright = u"2013, holger krekel et alii"
# The language of the text. It defaults to the language option # The language of the text. It defaults to the language option
# or en if the language is not set. # or en if the language is not set.
#epub_language = '' # epub_language = ''
# The scheme of the identifier. Typical schemes are ISBN or URL. # The scheme of the identifier. Typical schemes are ISBN or URL.
#epub_scheme = '' # epub_scheme = ''
# The unique identifier of the text. This can be a ISBN number # The unique identifier of the text. This can be a ISBN number
# or the project homepage. # or the project homepage.
#epub_identifier = '' # epub_identifier = ''
# A unique identification for the text. # A unique identification for the text.
#epub_uid = '' # epub_uid = ''
# HTML files that should be inserted before the pages created by sphinx. # HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title. # The format is a list of tuples containing the path and title.
#epub_pre_files = [] # epub_pre_files = []
# HTML files shat should be inserted after the pages created by sphinx. # HTML files shat should be inserted after the pages created by sphinx.
# The format is a list of tuples containing the path and title. # The format is a list of tuples containing the path and title.
#epub_post_files = [] # epub_post_files = []
# A list of files that should not be packed into the epub file. # A list of files that should not be packed into the epub file.
#epub_exclude_files = [] # epub_exclude_files = []
# The depth of the table of contents in toc.ncx. # The depth of the table of contents in toc.ncx.
#epub_tocdepth = 3 # epub_tocdepth = 3
# Allow duplicate toc entries. # Allow duplicate toc entries.
#epub_tocdup = True # epub_tocdup = True
# -- Options for texinfo output ------------------------------------------------ # -- Options for texinfo output ------------------------------------------------
texinfo_documents = [ texinfo_documents = [
(master_doc, 'pytest', 'pytest Documentation', (
('Holger Krekel@*Benjamin Peterson@*Ronny Pfannschmidt@*' master_doc,
'Floris Bruynooghe@*others'), "pytest",
'pytest', "pytest Documentation",
'simple powerful testing with Python', (
'Programming', "Holger Krekel@*Benjamin Peterson@*Ronny Pfannschmidt@*"
1), "Floris Bruynooghe@*others"
),
"pytest",
"simple powerful testing with Python",
"Programming",
1,
)
] ]
# Example configuration for intersphinx: refer to the Python standard library. # Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'python': ('http://docs.python.org/3', None)} intersphinx_mapping = {"python": ("http://docs.python.org/3", None)}
def setup(app): def setup(app):
#from sphinx.ext.autodoc import cut_lines # from sphinx.ext.autodoc import cut_lines
#app.connect('autodoc-process-docstring', cut_lines(4, what=['module'])) # app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
app.add_description_unit('confval', 'confval', app.add_description_unit(
objname='configuration value', "confval",
indextemplate='pair: %s; configuration value') "confval",
objname="configuration value",
indextemplate="pair: %s; configuration value",
)

View File

@ -8,9 +8,9 @@ Contact channels
- `pytest issue tracker`_ to report bugs or suggest features (for version - `pytest issue tracker`_ to report bugs or suggest features (for version
2.0 and above). 2.0 and above).
- `pytest on stackoverflow.com <http://stackoverflow.com/search?q=pytest>`_ - `pytest on stackoverflow.com <http://stackoverflow.com/search?q=pytest>`_
to post questions with the tag ``pytest``. New Questions will usually to post questions with the tag ``pytest``. New Questions will usually
be seen by pytest users or developers and answered quickly. be seen by pytest users or developers and answered quickly.
- `Testing In Python`_: a mailing list for Python testing tools and discussion. - `Testing In Python`_: a mailing list for Python testing tools and discussion.
@ -47,4 +47,3 @@ Contact channels
.. _`development mailing list`: .. _`development mailing list`:
.. _`pytest-dev at python.org (mailing list)`: http://mail.python.org/mailman/listinfo/pytest-dev .. _`pytest-dev at python.org (mailing list)`: http://mail.python.org/mailman/listinfo/pytest-dev
.. _`pytest-commit at python.org (mailing list)`: http://mail.python.org/mailman/listinfo/pytest-commit .. _`pytest-commit at python.org (mailing list)`: http://mail.python.org/mailman/listinfo/pytest-commit

View File

@ -15,12 +15,12 @@ Full pytest documentation
existingtestsuite existingtestsuite
assert assert
fixture fixture
mark
monkeypatch monkeypatch
tmpdir tmpdir
capture capture
warnings warnings
doctest doctest
mark
skipping skipping
parametrize parametrize
cache cache
@ -62,4 +62,3 @@ Full pytest documentation
:maxdepth: 1 :maxdepth: 1
changelog changelog

View File

@ -38,7 +38,7 @@ Here's a summary what ``pytest`` uses ``rootdir`` for:
Important to emphasize that ``rootdir`` is **NOT** used to modify ``sys.path``/``PYTHONPATH`` or Important to emphasize that ``rootdir`` is **NOT** used to modify ``sys.path``/``PYTHONPATH`` or
influence how modules are imported. See :ref:`pythonpath` for more details. influence how modules are imported. See :ref:`pythonpath` for more details.
``--rootdir=path`` command-line option can be used to force a specific directory. ``--rootdir=path`` command-line option can be used to force a specific directory.
The directory passed may contain environment variables when it is used in conjunction The directory passed may contain environment variables when it is used in conjunction
with ``addopts`` in a ``pytest.ini`` file. with ``addopts`` in a ``pytest.ini`` file.

View File

@ -10,7 +10,7 @@ Code Style
---------- ----------
* `PEP-8 <https://www.python.org/dev/peps/pep-0008>`_ * `PEP-8 <https://www.python.org/dev/peps/pep-0008>`_
* `flake8 <https://pypi.python.org/pypi/flake8>`_ for quality checks * `flake8 <https://pypi.org/project/flake8/>`_ for quality checks
* `invoke <http://www.pyinvoke.org/>`_ to automate development tasks * `invoke <http://www.pyinvoke.org/>`_ to automate development tasks
@ -40,7 +40,7 @@ avoid creating labels just for the sake of creating them.
Each label should include a description in the GitHub's interface stating its purpose. Each label should include a description in the GitHub's interface stating its purpose.
Temporary labels Temporary labels
~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
To classify issues for a special event it is encouraged to create a temporary label. This helps those involved to find To classify issues for a special event it is encouraged to create a temporary label. This helps those involved to find
the relevant issues to work on. Examples of that are sprints in Python events or global hacking events. the relevant issues to work on. Examples of that are sprints in Python events or global hacking events.

View File

@ -65,9 +65,9 @@ then you can just invoke ``pytest`` without command line options::
platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y
rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini
collected 1 item collected 1 item
mymodule.py . [100%] mymodule.py . [100%]
========================= 1 passed in 0.12 seconds ========================= ========================= 1 passed in 0.12 seconds =========================
It is possible to use fixtures using the ``getfixture`` helper:: It is possible to use fixtures using the ``getfixture`` helper::
@ -168,5 +168,3 @@ by using one of standard doctest modules format in options
pytest --doctest-modules --doctest-report cdiff pytest --doctest-modules --doctest-report cdiff
pytest --doctest-modules --doctest-report ndiff pytest --doctest-modules --doctest-report ndiff
pytest --doctest-modules --doctest-report only_first_failure pytest --doctest-modules --doctest-report only_first_failure

View File

@ -2,102 +2,109 @@ from pytest import raises
import _pytest._code import _pytest._code
import py import py
def otherfunc(a,b):
assert a==b
def somefunc(x,y): def otherfunc(a, b):
otherfunc(x,y) assert a == b
def somefunc(x, y):
otherfunc(x, y)
def otherfunc_multi(a, b):
assert a == b
def otherfunc_multi(a,b):
assert (a ==
b)
def test_generative(param1, param2): def test_generative(param1, param2):
assert param1 * 2 < param2 assert param1 * 2 < param2
def pytest_generate_tests(metafunc): def pytest_generate_tests(metafunc):
if 'param1' in metafunc.fixturenames: if "param1" in metafunc.fixturenames:
metafunc.addcall(funcargs=dict(param1=3, param2=6)) metafunc.addcall(funcargs=dict(param1=3, param2=6))
class TestFailing(object): class TestFailing(object):
def test_simple(self): def test_simple(self):
def f(): def f():
return 42 return 42
def g(): def g():
return 43 return 43
assert f() == g() assert f() == g()
def test_simple_multiline(self): def test_simple_multiline(self):
otherfunc_multi( otherfunc_multi(42, 6 * 9)
42,
6*9)
def test_not(self): def test_not(self):
def f(): def f():
return 42 return 42
assert not f() assert not f()
class TestSpecialisedExplanations(object): class TestSpecialisedExplanations(object):
def test_eq_text(self): def test_eq_text(self):
assert 'spam' == 'eggs' assert "spam" == "eggs"
def test_eq_similar_text(self): def test_eq_similar_text(self):
assert 'foo 1 bar' == 'foo 2 bar' assert "foo 1 bar" == "foo 2 bar"
def test_eq_multiline_text(self): def test_eq_multiline_text(self):
assert 'foo\nspam\nbar' == 'foo\neggs\nbar' assert "foo\nspam\nbar" == "foo\neggs\nbar"
def test_eq_long_text(self): def test_eq_long_text(self):
a = '1'*100 + 'a' + '2'*100 a = "1" * 100 + "a" + "2" * 100
b = '1'*100 + 'b' + '2'*100 b = "1" * 100 + "b" + "2" * 100
assert a == b assert a == b
def test_eq_long_text_multiline(self): def test_eq_long_text_multiline(self):
a = '1\n'*100 + 'a' + '2\n'*100 a = "1\n" * 100 + "a" + "2\n" * 100
b = '1\n'*100 + 'b' + '2\n'*100 b = "1\n" * 100 + "b" + "2\n" * 100
assert a == b assert a == b
def test_eq_list(self): def test_eq_list(self):
assert [0, 1, 2] == [0, 1, 3] assert [0, 1, 2] == [0, 1, 3]
def test_eq_list_long(self): def test_eq_list_long(self):
a = [0]*100 + [1] + [3]*100 a = [0] * 100 + [1] + [3] * 100
b = [0]*100 + [2] + [3]*100 b = [0] * 100 + [2] + [3] * 100
assert a == b assert a == b
def test_eq_dict(self): def test_eq_dict(self):
assert {'a': 0, 'b': 1, 'c': 0} == {'a': 0, 'b': 2, 'd': 0} assert {"a": 0, "b": 1, "c": 0} == {"a": 0, "b": 2, "d": 0}
def test_eq_set(self): def test_eq_set(self):
assert set([0, 10, 11, 12]) == set([0, 20, 21]) assert {0, 10, 11, 12} == {0, 20, 21}
def test_eq_longer_list(self): def test_eq_longer_list(self):
assert [1,2] == [1,2,3] assert [1, 2] == [1, 2, 3]
def test_in_list(self): def test_in_list(self):
assert 1 in [0, 2, 3, 4, 5] assert 1 in [0, 2, 3, 4, 5]
def test_not_in_text_multiline(self): def test_not_in_text_multiline(self):
text = 'some multiline\ntext\nwhich\nincludes foo\nand a\ntail' text = "some multiline\ntext\nwhich\nincludes foo\nand a\ntail"
assert 'foo' not in text assert "foo" not in text
def test_not_in_text_single(self): def test_not_in_text_single(self):
text = 'single foo line' text = "single foo line"
assert 'foo' not in text assert "foo" not in text
def test_not_in_text_single_long(self): def test_not_in_text_single_long(self):
text = 'head ' * 50 + 'foo ' + 'tail ' * 20 text = "head " * 50 + "foo " + "tail " * 20
assert 'foo' not in text assert "foo" not in text
def test_not_in_text_single_long_term(self): def test_not_in_text_single_long_term(self):
text = 'head ' * 50 + 'f'*70 + 'tail ' * 20 text = "head " * 50 + "f" * 70 + "tail " * 20
assert 'f'*70 not in text assert "f" * 70 not in text
def test_attribute(): def test_attribute():
class Foo(object): class Foo(object):
b = 1 b = 1
i = Foo() i = Foo()
assert i.b == 2 assert i.b == 2
@ -105,14 +112,17 @@ def test_attribute():
def test_attribute_instance(): def test_attribute_instance():
class Foo(object): class Foo(object):
b = 1 b = 1
assert Foo().b == 2 assert Foo().b == 2
def test_attribute_failure(): def test_attribute_failure():
class Foo(object): class Foo(object):
def _get_b(self): def _get_b(self):
raise Exception('Failed to get attrib') raise Exception("Failed to get attrib")
b = property(_get_b) b = property(_get_b)
i = Foo() i = Foo()
assert i.b == 2 assert i.b == 2
@ -120,17 +130,20 @@ def test_attribute_failure():
def test_attribute_multiple(): def test_attribute_multiple():
class Foo(object): class Foo(object):
b = 1 b = 1
class Bar(object): class Bar(object):
b = 2 b = 2
assert Foo().b == Bar().b assert Foo().b == Bar().b
def globf(x): def globf(x):
return x+1 return x + 1
class TestRaises(object): class TestRaises(object):
def test_raises(self): def test_raises(self):
s = 'qwe' s = "qwe" # NOQA
raises(TypeError, "int(s)") raises(TypeError, "int(s)")
def test_raises_doesnt(self): def test_raises_doesnt(self):
@ -140,15 +153,15 @@ class TestRaises(object):
raise ValueError("demo error") raise ValueError("demo error")
def test_tupleerror(self): def test_tupleerror(self):
a,b = [1] a, b = [1] # NOQA
def test_reinterpret_fails_with_print_for_the_fun_of_it(self): def test_reinterpret_fails_with_print_for_the_fun_of_it(self):
l = [1,2,3] items = [1, 2, 3]
print ("l is %r" % l) print("items is %r" % items)
a,b = l.pop() a, b = items.pop()
def test_some_error(self): def test_some_error(self):
if namenotexi: if namenotexi: # NOQA
pass pass
def func1(self): def func1(self):
@ -159,31 +172,33 @@ class TestRaises(object):
def test_dynamic_compile_shows_nicely(): def test_dynamic_compile_shows_nicely():
import imp import imp
import sys import sys
src = 'def foo():\n assert 1 == 0\n'
name = 'abc-123' src = "def foo():\n assert 1 == 0\n"
name = "abc-123"
module = imp.new_module(name) module = imp.new_module(name)
code = _pytest._code.compile(src, name, 'exec') code = _pytest._code.compile(src, name, "exec")
py.builtin.exec_(code, module.__dict__) py.builtin.exec_(code, module.__dict__)
sys.modules[name] = module sys.modules[name] = module
module.foo() module.foo()
class TestMoreErrors(object): class TestMoreErrors(object):
def test_complex_error(self): def test_complex_error(self):
def f(): def f():
return 44 return 44
def g(): def g():
return 43 return 43
somefunc(f(), g()) somefunc(f(), g())
def test_z1_unpack_error(self): def test_z1_unpack_error(self):
l = [] items = []
a,b = l a, b = items
def test_z2_type_error(self): def test_z2_type_error(self):
l = 3 items = 3
a,b = l a, b = items
def test_startswith(self): def test_startswith(self):
s = "123" s = "123"
@ -193,15 +208,17 @@ class TestMoreErrors(object):
def test_startswith_nested(self): def test_startswith_nested(self):
def f(): def f():
return "123" return "123"
def g(): def g():
return "456" return "456"
assert f().startswith(g()) assert f().startswith(g())
def test_global_func(self): def test_global_func(self):
assert isinstance(globf(42), float) assert isinstance(globf(42), float)
def test_instance(self): def test_instance(self):
self.x = 6*7 self.x = 6 * 7
assert self.x != 42 assert self.x != 42
def test_compare(self): def test_compare(self):
@ -216,25 +233,29 @@ class TestMoreErrors(object):
class TestCustomAssertMsg(object): class TestCustomAssertMsg(object):
def test_single_line(self): def test_single_line(self):
class A(object): class A(object):
a = 1 a = 1
b = 2 b = 2
assert A.a == b, "A.a appears not to be b" assert A.a == b, "A.a appears not to be b"
def test_multiline(self): def test_multiline(self):
class A(object): class A(object):
a = 1 a = 1
b = 2 b = 2
assert A.a == b, "A.a appears not to be b\n" \ assert (
"or does not appear to be b\none of those" A.a == b
), "A.a appears not to be b\n" "or does not appear to be b\none of those"
def test_custom_repr(self): def test_custom_repr(self):
class JSON(object): class JSON(object):
a = 1 a = 1
def __repr__(self): def __repr__(self):
return "This is JSON\n{\n 'foo': 'bar'\n}" return "This is JSON\n{\n 'foo': 'bar'\n}"
a = JSON() a = JSON()
b = 2 b = 2
assert a.a == b, a assert a.a == b, a

View File

@ -1,10 +1,13 @@
import pytest, py import pytest
import py
mydir = py.path.local(__file__).dirpath() mydir = py.path.local(__file__).dirpath()
def pytest_runtest_setup(item): def pytest_runtest_setup(item):
if isinstance(item, pytest.Function): if isinstance(item, pytest.Function):
if not item.fspath.relto(mydir): if not item.fspath.relto(mydir):
return return
mod = item.getparent(pytest.Module).obj mod = item.getparent(pytest.Module).obj
if hasattr(mod, 'hello'): if hasattr(mod, "hello"):
print ("mod.hello %r" % (mod.hello,)) print("mod.hello %r" % (mod.hello,))

View File

@ -1,5 +1,6 @@
hello = "world" hello = "world"
def test_func(): def test_func():
pass pass

View File

@ -1,14 +1,14 @@
import py import py
failure_demo = py.path.local(__file__).dirpath('failure_demo.py')
pytest_plugins = 'pytester', failure_demo = py.path.local(__file__).dirpath("failure_demo.py")
pytest_plugins = ("pytester",)
def test_failure_demo_fails_properly(testdir): def test_failure_demo_fails_properly(testdir):
target = testdir.tmpdir.join(failure_demo.basename) target = testdir.tmpdir.join(failure_demo.basename)
failure_demo.copy(target) failure_demo.copy(target)
failure_demo.copy(testdir.tmpdir.join(failure_demo.basename)) failure_demo.copy(testdir.tmpdir.join(failure_demo.basename))
result = testdir.runpytest(target, syspathinsert=True) result = testdir.runpytest(target, syspathinsert=True)
result.stdout.fnmatch_lines([ result.stdout.fnmatch_lines(["*42 failed*"])
"*42 failed*"
])
assert result.ret != 0 assert result.ret != 0

Some files were not shown because too many files have changed in this diff Show More