Compare commits
203 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2a8866bce | ||
|
|
c69978fbb0 | ||
|
|
c1eaa72883 | ||
|
|
55f3ffd2ba | ||
|
|
55eb82c434 | ||
|
|
d94a29e866 | ||
|
|
a7d2a82caa | ||
|
|
ce95437dee | ||
|
|
3ba3112a85 | ||
|
|
c019e489d2 | ||
|
|
43e4fcf6dd | ||
|
|
65ca554230 | ||
|
|
52a2999a91 | ||
|
|
f3580bee2d | ||
|
|
deb163d237 | ||
|
|
6f81602ba2 | ||
|
|
ac17f20d98 | ||
|
|
a9b7de8bf0 | ||
|
|
0fc75c9622 | ||
|
|
9726fafa98 | ||
|
|
cf7bb70809 | ||
|
|
03c3930734 | ||
|
|
25a4d7d882 | ||
|
|
eead0365b5 | ||
|
|
eb3b989286 | ||
|
|
cdb46e9f16 | ||
|
|
ead25634fe | ||
|
|
3f3521c826 | ||
|
|
0c2dfb9683 | ||
|
|
5d6b0a59c0 | ||
|
|
c629f6b18b | ||
|
|
b48eda6d7d | ||
|
|
81243657be | ||
|
|
24fe051803 | ||
|
|
16bcfa749e | ||
|
|
d083153548 | ||
|
|
41e6b04f0b | ||
|
|
33c2a3a3e5 | ||
|
|
97d5da5c99 | ||
|
|
d1005ebb8f | ||
|
|
c4623939af | ||
|
|
060609317a | ||
|
|
bae0f7f46a | ||
|
|
09a50b6e6d | ||
|
|
200fe072f1 | ||
|
|
ff9ec13ddb | ||
|
|
9384ff38c9 | ||
|
|
1e6e373913 | ||
|
|
e510eb0d45 | ||
|
|
2e2d6a8bef | ||
|
|
44cd1c9862 | ||
|
|
f6f084fa01 | ||
|
|
b7d212c0c9 | ||
|
|
bda3e53df6 | ||
|
|
9d4354c0a4 | ||
|
|
f99ddbfdf2 | ||
|
|
019dc14fc4 | ||
|
|
dbb58b39d9 | ||
|
|
c3ca44b46f | ||
|
|
f6df3b0b97 | ||
|
|
e9d4853296 | ||
|
|
28c2327f73 | ||
|
|
8ed5b77aba | ||
|
|
660b84a052 | ||
|
|
d73e689991 | ||
|
|
c773ea664b | ||
|
|
aa757f7715 | ||
|
|
4222a806f1 | ||
|
|
415c76b255 | ||
|
|
f1c9554f42 | ||
|
|
3d0b756877 | ||
|
|
ea4e9fa4e2 | ||
|
|
777bde7c60 | ||
|
|
e19f3c260f | ||
|
|
5025478ac2 | ||
|
|
5b73de92c2 | ||
|
|
6a237bd49f | ||
|
|
89710b4901 | ||
|
|
459d6e610c | ||
|
|
d1adbf4a5c | ||
|
|
c11cc36997 | ||
|
|
2b7fae2368 | ||
|
|
f2ca0b8170 | ||
|
|
912c8f0540 | ||
|
|
8f12269db7 | ||
|
|
7325a5fe2e | ||
|
|
9f4d0be895 | ||
|
|
394367e1d2 | ||
|
|
7e15fb7f2d | ||
|
|
8859936301 | ||
|
|
d580f5bac8 | ||
|
|
5941b2e071 | ||
|
|
bca19a1156 | ||
|
|
3df5989326 | ||
|
|
98b9de4ff1 | ||
|
|
0e248c9aed | ||
|
|
883b3ca2c1 | ||
|
|
e4bb48995a | ||
|
|
1d15bb2880 | ||
|
|
959395b796 | ||
|
|
f6caf230f8 | ||
|
|
f2cdbe776e | ||
|
|
97c9c10f3c | ||
|
|
f74930db79 | ||
|
|
5a88a9b22a | ||
|
|
d0d4759c96 | ||
|
|
749316623b | ||
|
|
0c8569dcb0 | ||
|
|
5f2444d2a2 | ||
|
|
537dca477b | ||
|
|
8480111012 | ||
|
|
c63dc62294 | ||
|
|
8d19ccb56f | ||
|
|
eac4514227 | ||
|
|
16f0d100cc | ||
|
|
0b620c304b | ||
|
|
7371d436d2 | ||
|
|
b928928942 | ||
|
|
4337e9c4ba | ||
|
|
8dfd6c17e3 | ||
|
|
de7c97aa1e | ||
|
|
ace668ae8f | ||
|
|
857db415bc | ||
|
|
f8623a6668 | ||
|
|
4cadc600d5 | ||
|
|
d62ec2985d | ||
|
|
b2341899c5 | ||
|
|
2c84e9ddac | ||
|
|
b7dd8eac8e | ||
|
|
61d0209093 | ||
|
|
8b9bb5ff54 | ||
|
|
cb2c89a070 | ||
|
|
cea9367739 | ||
|
|
e1a66d54b9 | ||
|
|
a37f9f19d4 | ||
|
|
91aa6ab0df | ||
|
|
c85c5d05c5 | ||
|
|
34df678bc3 | ||
|
|
8c91ffc701 | ||
|
|
eda39f361d | ||
|
|
c58770bfef | ||
|
|
d9858844c3 | ||
|
|
04b8111f8f | ||
|
|
0253f7b8d5 | ||
|
|
5999368002 | ||
|
|
bf2f2dc2a6 | ||
|
|
787b0212d1 | ||
|
|
1de5af66da | ||
|
|
61caa4f776 | ||
|
|
9ca7e46a0a | ||
|
|
f66e0825b2 | ||
|
|
f5f924d293 | ||
|
|
c3d1986101 | ||
|
|
89de87dce1 | ||
|
|
ab005a4261 | ||
|
|
3d6ad054c0 | ||
|
|
b6e619413f | ||
|
|
a43fb9cd93 | ||
|
|
68f3818562 | ||
|
|
e39556ada0 | ||
|
|
a298077461 | ||
|
|
a759da0208 | ||
|
|
6ab36592ea | ||
|
|
c45b7012f5 | ||
|
|
1d10db4bab | ||
|
|
767e44ef29 | ||
|
|
e53bb1af45 | ||
|
|
2ed4c2135a | ||
|
|
8cfec56a82 | ||
|
|
818a412d29 | ||
|
|
2cb0145bce | ||
|
|
c6951d5184 | ||
|
|
dd1ee22293 | ||
|
|
a999fcd36a | ||
|
|
ba8ae427e2 | ||
|
|
7f93063945 | ||
|
|
63f070317c | ||
|
|
3d84f35850 | ||
|
|
3d794b6b38 | ||
|
|
d8f4663f49 | ||
|
|
5ec1dd2609 | ||
|
|
d7ada40130 | ||
|
|
a098226ee4 | ||
|
|
05d4a3f9eb | ||
|
|
2161b54555 | ||
|
|
69ff29bf44 | ||
|
|
de83d35994 | ||
|
|
c7c4f62f77 | ||
|
|
e635f9f9b2 | ||
|
|
f250e912eb | ||
|
|
351931d5ca | ||
|
|
28c785a0d1 | ||
|
|
3de715ec13 | ||
|
|
ea5fb0c153 | ||
|
|
c7a45d6eaf | ||
|
|
e9f240a9a3 | ||
|
|
be93fdf11d | ||
|
|
82d806deb6 | ||
|
|
9a0f2a9fb7 | ||
|
|
d99243c1a7 | ||
|
|
8844d9d04f | ||
|
|
54e00429e4 | ||
|
|
4e35c00ab0 |
1
.hgtags
1
.hgtags
@@ -72,3 +72,4 @@ a064ad64d167508a8e9e73766b1a4e6bd10c85db 2.5.0
|
||||
a4f9639702baa3eb4f3b16e162f74f7b69f3f9e1 2.6.1
|
||||
a4f25c5e649892b5cc746d21be971e4773478af9 2.6.2
|
||||
2967aa416a4f3cdb65fc75073a2a148e1f372742 2.6.3
|
||||
f03b6de8325f5b6c35cea7c3de092f134ea8ef07 2.6.4
|
||||
|
||||
3
AUTHORS
3
AUTHORS
@@ -45,3 +45,6 @@ Andy Freeland
|
||||
Trevor Bekolay
|
||||
David Mohr
|
||||
Nicolas Delaby
|
||||
Tom Viner
|
||||
Dave Hunt
|
||||
Charles Cloud
|
||||
|
||||
84
CHANGELOG
84
CHANGELOG
@@ -1,7 +1,78 @@
|
||||
2.7.0 (compared to 2.6.4)
|
||||
-----------------------------
|
||||
|
||||
- fix issue435: make reload() work when assert rewriting is active.
|
||||
Thanks Daniel Hahler.
|
||||
|
||||
- fix issue616: conftest.py files and their contained fixutres are now
|
||||
properly considered for visibility, independently from the exact
|
||||
current working directory and test arguments that are used.
|
||||
Many thanks to Eric Siegerman and his PR235 which contains
|
||||
systematic tests for conftest visibility and now passes.
|
||||
This change also introduces the concept of a ``rootdir`` which
|
||||
is printed as a new pytest header and documented in the pytest
|
||||
customize web page.
|
||||
|
||||
- change reporting of "diverted" tests, i.e. tests that are collected
|
||||
in one file but actually come from another (e.g. when tests in a test class
|
||||
come from a base class in a different file). We now show the nodeid
|
||||
and indicate via a postfix the other file.
|
||||
|
||||
- add ability to set command line options by environment variable PYTEST_ADDOPTS.
|
||||
|
||||
- added documentation on the new pytest-dev teams on bitbucket and
|
||||
github. See https://pytest.org/latest/contributing.html .
|
||||
Thanks to Anatoly for pushing and initial work on this.
|
||||
|
||||
- fix issue650: new option ``--docttest-ignore-import-errors`` which
|
||||
will turn import errors in doctests into skips. Thanks Charles Cloud
|
||||
for the complete PR.
|
||||
|
||||
- fix issue655: work around different ways that cause python2/3
|
||||
to leak sys.exc_info into fixtures/tests causing failures in 3rd party code
|
||||
|
||||
- fix issue615: assertion re-writing did not correctly escape % signs
|
||||
when formatting boolean operations, which tripped over mixing
|
||||
booleans with modulo operators. Thanks to Tom Viner for the report,
|
||||
triaging and fix.
|
||||
|
||||
- implement issue351: add ability to specify parametrize ids as a callable
|
||||
to generate custom test ids. Thanks Brianna Laugher for the idea and
|
||||
implementation.
|
||||
|
||||
- introduce and document new hookwrapper mechanism useful for plugins
|
||||
which want to wrap the execution of certain hooks for their purposes.
|
||||
This supersedes the undocumented ``__multicall__`` protocol which
|
||||
pytest itself and some external plugins use. Note that pytest-2.8
|
||||
is scheduled to drop supporting the old ``__multicall__``
|
||||
and only support the hookwrapper protocol.
|
||||
|
||||
- majorly speed up invocation of plugin hooks
|
||||
|
||||
- use hookwrapper mechanism in builtin pytest plugins.
|
||||
|
||||
- add a doctest ini option for doctest flags, thanks Holger Peters.
|
||||
|
||||
- add note to docs that if you want to mark a parameter and the
|
||||
parameter is a callable, you also need to pass in a reason to disambiguate
|
||||
it from the "decorator" case. Thanks Tom Viner.
|
||||
|
||||
- "python_classes" and "python_functions" options now support glob-patterns
|
||||
for test discovery, as discussed in issue600. Thanks Ldiary Translations.
|
||||
|
||||
- allow to override parametrized fixtures with non-parametrized ones and vice versa (bubenkoff).
|
||||
|
||||
- fix issue463: raise specific error for 'parameterize' misspelling (pfctdayelise).
|
||||
|
||||
- On failure, the ``sys.last_value``, ``sys.last_type`` and
|
||||
``sys.last_traceback`` are set, so that a user can inspect the error
|
||||
via postmortem debugging (almarklein).
|
||||
|
||||
2.6.4
|
||||
----------
|
||||
|
||||
- Improve assertion failure reporting on iterables, by using ndiff and pprint.
|
||||
- Improve assertion failure reporting on iterables, by using ndiff and
|
||||
pprint.
|
||||
|
||||
- removed outdated japanese docs from source tree.
|
||||
|
||||
@@ -21,6 +92,11 @@
|
||||
- fix issue614: fixed pastebin support.
|
||||
|
||||
|
||||
- fix issue620: add explanation in the --genscript target about what
|
||||
the binary blob means. Thanks Dinu Gherman.
|
||||
|
||||
- fix issue614: fixed pastebin support.
|
||||
|
||||
2.6.3
|
||||
-----------
|
||||
|
||||
@@ -74,7 +150,7 @@
|
||||
Thanks sontek.
|
||||
|
||||
- Implement issue549: user-provided assertion messages now no longer
|
||||
replace the py.test instrospection message but are shown in addition
|
||||
replace the py.test introspection message but are shown in addition
|
||||
to them.
|
||||
|
||||
2.6.1
|
||||
@@ -420,7 +496,7 @@ v2.4.2
|
||||
|
||||
- introduce node.get_marker/node.add_marker API for plugins
|
||||
like pytest-pep8 and pytest-flakes to avoid the messy
|
||||
details of the node.keywords pseudo-dicts. Adapated
|
||||
details of the node.keywords pseudo-dicts. Adapted
|
||||
docs.
|
||||
|
||||
- remove attempt to "dup" stdout at startup as it's icky.
|
||||
@@ -487,7 +563,7 @@ new features:
|
||||
as strings will remain fully supported.
|
||||
|
||||
- reporting: color the last line red or green depending if
|
||||
failures/errors occured or everything passed. thanks Christian
|
||||
failures/errors occurred or everything passed. thanks Christian
|
||||
Theunert.
|
||||
|
||||
- make "import pdb ; pdb.set_trace()" work natively wrt capturing (no
|
||||
|
||||
151
CONTRIBUTING.rst
151
CONTRIBUTING.rst
@@ -1,18 +1,62 @@
|
||||
============
|
||||
Contributing
|
||||
============
|
||||
============================
|
||||
Contribution getting started
|
||||
============================
|
||||
|
||||
Contributions are highly welcomed and appreciated. Every little help counts,
|
||||
so do not hesitate!
|
||||
|
||||
.. contents:: Contribution links
|
||||
:depth: 2
|
||||
|
||||
Types of contributions
|
||||
======================
|
||||
|
||||
.. _submitplugin:
|
||||
|
||||
Submit a plugin, co-develop pytest
|
||||
----------------------------------
|
||||
|
||||
Pytest development of the core, some plugins and support code happens
|
||||
in repositories living under:
|
||||
|
||||
- `the pytest-dev bitbucket team <https://bitbucket.org/pytest-dev>`_
|
||||
|
||||
- `the pytest-dev github organisation <https://github.com/pytest-dev>`_
|
||||
|
||||
All pytest-dev team members have write access to all contained
|
||||
repositories. pytest core and plugins are generally developed
|
||||
using `pull requests`_ to respective repositories.
|
||||
|
||||
You can submit your plugin by subscribing to the `pytest-dev mail list
|
||||
<https://mail.python.org/mailman/listinfo/pytest-dev>`_ and writing a
|
||||
mail pointing to your existing pytest plugin repository which must have
|
||||
the following:
|
||||
|
||||
- PyPI presence with a ``setup.py`` that contains a license, ``pytest-``
|
||||
prefixed, version number, authors, short and long description.
|
||||
|
||||
- a ``tox.ini`` for running tests using `tox <http://tox.testrun.org>`_.
|
||||
|
||||
- a ``README.txt`` describing how to use the plugin and on which
|
||||
platforms it runs.
|
||||
|
||||
- a ``LICENSE.txt`` file or equivalent containing the licensing
|
||||
information, with matching info in ``setup.py``.
|
||||
|
||||
- an issue tracker unless you rather want to use the core ``pytest``
|
||||
issue tracker.
|
||||
|
||||
If no contributor strongly objects and two agree, the repo will be
|
||||
transferred to the ``pytest-dev`` organisation and you'll become a
|
||||
member of the ``pytest-dev`` team, with commit rights to all projects.
|
||||
We recommend that each plugin has at least three people who have the
|
||||
right to release to pypi.
|
||||
|
||||
|
||||
.. _reportbugs:
|
||||
|
||||
Report bugs
|
||||
-----------
|
||||
|
||||
Report bugs at https://bitbucket.org/hpk42/pytest/issues.
|
||||
Report bugs for pytest at https://bitbucket.org/pytest-dev/pytest/issues
|
||||
|
||||
If you are reporting a bug, please include:
|
||||
|
||||
@@ -22,13 +66,15 @@ If you are reporting a bug, please include:
|
||||
installed libraries and pytest version.
|
||||
* Detailed steps to reproduce the bug.
|
||||
|
||||
.. _submitfeedback:
|
||||
|
||||
Submit feedback for developers
|
||||
------------------------------
|
||||
|
||||
Do you like pytest? Share some love on Twitter or in your blog posts!
|
||||
|
||||
We'd also like to hear about your propositions and suggestions. Feel free to
|
||||
`submit them as issues <https://bitbucket.org/hpk42/pytest/issues>`__ and:
|
||||
`submit them as issues <https://bitbucket.org/pytest-dev/pytest/issues>`__ and:
|
||||
|
||||
* Set the "kind" to "enhancement" or "proposal" so that we can quickly find
|
||||
about them.
|
||||
@@ -37,21 +83,24 @@ We'd also like to hear about your propositions and suggestions. Feel free to
|
||||
* If you have required skills and/or knowledge, we are very happy for
|
||||
:ref:`pull requests <pull-requests>`.
|
||||
|
||||
.. _fixbugs:
|
||||
|
||||
Fix bugs
|
||||
--------
|
||||
|
||||
Look through the BitBucket issues for bugs. Here is sample filter you can use:
|
||||
https://bitbucket.org/hpk42/pytest/issues?status=new&status=open&kind=bug
|
||||
https://bitbucket.org/pytest-dev/pytest/issues?status=new&status=open&kind=bug
|
||||
|
||||
:ref:`Talk <contact>` to developers to find out how you can fix specific bugs.
|
||||
|
||||
.. _writeplugins:
|
||||
|
||||
Implement features
|
||||
------------------
|
||||
|
||||
Look through the BitBucket issues for enhancements. Here is sample filter you
|
||||
can use:
|
||||
https://bitbucket.org/hpk42/pytest/issues?status=new&status=open&kind=enhancement
|
||||
https://bitbucket.org/pytest-dev/pytest/issues?status=new&status=open&kind=enhancement
|
||||
|
||||
:ref:`Talk <contact>` to developers to find out how you can implement specific
|
||||
features.
|
||||
@@ -66,37 +115,34 @@ pytest could always use more documentation. What exactly is needed?
|
||||
* Docstrings. There's never too much of them.
|
||||
* Blog posts, articles and such -- they're all very appreciated.
|
||||
|
||||
.. _`pull requests`:
|
||||
.. _pull-requests:
|
||||
|
||||
Preparing Pull Requests on Bitbucket
|
||||
=====================================
|
||||
------------------------------------
|
||||
|
||||
.. note::
|
||||
What is a "pull request"? It informs project's core developers about the
|
||||
changes you want to review and merge. Pull requests are stored on
|
||||
`BitBucket servers <https://bitbucket.org/hpk42/pytest/pull-requests>`__.
|
||||
`BitBucket servers <https://bitbucket.org/pytest-dev/pytest/pull-requests>`__.
|
||||
Once you send pull request, we can discuss it's potential modifications and
|
||||
even add more commits to it later on.
|
||||
|
||||
The primary development platform for pytest is BitBucket. You can find all
|
||||
the issues there and submit your pull requests.
|
||||
|
||||
1. Fork the
|
||||
`pytest BitBucket repository <https://bitbucket.org/hpk42/pytest>`__. It's
|
||||
#. Fork the
|
||||
`pytest BitBucket repository <https://bitbucket.org/pytest-dev/pytest>`__. It's
|
||||
fine to use ``pytest`` as your fork repository name because it will live
|
||||
under your user.
|
||||
|
||||
.. _virtualenvactivate:
|
||||
#. Create a development environment
|
||||
(will implicitly use http://www.virtualenv.org/en/latest/)::
|
||||
|
||||
2. Create and activate a fork-specific virtualenv
|
||||
(http://www.virtualenv.org/en/latest/)::
|
||||
$ make develop
|
||||
$ source .env/bin/activate
|
||||
|
||||
$ virtualenv pytest-venv
|
||||
$ source pytest-venv/bin/activate
|
||||
|
||||
.. _checkout:
|
||||
|
||||
3. Clone your fork locally using `Mercurial <http://mercurial.selenic.com/>`_
|
||||
#. Clone your fork locally using `Mercurial <http://mercurial.selenic.com/>`_
|
||||
(``hg``) and create a branch::
|
||||
|
||||
$ hg clone ssh://hg@bitbucket.org/YOUR_BITBUCKET_USERNAME/pytest
|
||||
@@ -106,55 +152,56 @@ the issues there and submit your pull requests.
|
||||
If you need some help with Mercurial, follow this quick start
|
||||
guide: http://mercurial.selenic.com/wiki/QuickStart
|
||||
|
||||
.. _testing-pytest:
|
||||
#. Create a development environment
|
||||
(will implicitly use http://www.virtualenv.org/en/latest/)::
|
||||
|
||||
4. You can now edit your local working copy. To test you need to
|
||||
install the "tox" tool into your virtualenv::
|
||||
$ make develop
|
||||
$ source .env/bin/activate
|
||||
|
||||
$ pip install tox
|
||||
#. You can now edit your local working copy.
|
||||
|
||||
You need to have Python 2.7 and 3.3 available in your system. Now
|
||||
running tests is as simple as issuing this command::
|
||||
You need to have Python 2.7 and 3.4 available in your system. Now
|
||||
running tests is as simple as issuing this command::
|
||||
|
||||
$ python runtox.py -e py27,py33,flakes
|
||||
$ python runtox.py -e py27,py34,flakes
|
||||
|
||||
This command will run tests via the "tox" tool against Python 2.7 and 3.3
|
||||
and also perform "flakes" coding-style checks. ``runtox.py`` is
|
||||
a thin wrapper around ``tox`` which installs from a development package
|
||||
index where newer (not yet released to pypi) versions of dependencies
|
||||
(especially ``py``) might be present.
|
||||
This command will run tests via the "tox" tool against Python 2.7 and 3.4
|
||||
and also perform "flakes" coding-style checks. ``runtox.py`` is
|
||||
a thin wrapper around ``tox`` which installs from a development package
|
||||
index where newer (not yet released to pypi) versions of dependencies
|
||||
(especially ``py``) might be present.
|
||||
|
||||
To run tests on py27 and pass options (e.g. enter pdb on failure)
|
||||
to pytest you can do::
|
||||
To run tests on py27 and pass options (e.g. enter pdb on failure)
|
||||
to pytest you can do::
|
||||
|
||||
$ python runtox.py -e py27 -- --pdb
|
||||
|
||||
or to only run tests in a particular test module on py33::
|
||||
or to only run tests in a particular test module on py34::
|
||||
|
||||
$ python runtox.py -e py33 -- testing/test_config.py
|
||||
$ python runtox.py -e py34 -- testing/test_config.py
|
||||
|
||||
5. 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)::
|
||||
|
||||
$ hg commit -m"<commit message>"
|
||||
$ hg push -b .
|
||||
|
||||
6. Finally, submit a pull request through the BitBucket website:
|
||||
#. Finally, submit a pull request through the BitBucket website:
|
||||
|
||||
.. image:: img/pullrequest.png
|
||||
:width: 700px
|
||||
:align: center
|
||||
.. image:: img/pullrequest.png
|
||||
:width: 700px
|
||||
:align: center
|
||||
|
||||
::
|
||||
::
|
||||
|
||||
source: YOUR_BITBUCKET_USERNAME/pytest
|
||||
branch: your-branch-name
|
||||
|
||||
target: hpk42/pytest
|
||||
target: pytest-dev/pytest
|
||||
branch: default
|
||||
|
||||
.. _contribution-using-git:
|
||||
|
||||
What about git (and so GitHub)?
|
||||
Using git with bitbucket/hg
|
||||
-------------------------------
|
||||
|
||||
There used to be the pytest GitHub mirror. It was removed in favor of the
|
||||
@@ -162,10 +209,8 @@ Mercurial one, to remove confusion of people not knowing where it's better to
|
||||
put their issues and pull requests. Also it wasn't easily possible to automate
|
||||
the mirroring process.
|
||||
|
||||
However, it's still possible to use git to contribute to pytest using tools
|
||||
like `gitifyhg <https://github.com/buchuki/gitifyhg>`_ which allows you to
|
||||
clone and work with Mercurial repo still using git.
|
||||
|
||||
.. warning::
|
||||
Remember that git is **not** a default version control system for pytest and
|
||||
you need to be careful using it.
|
||||
In general we recommend to work with the same version control system of the
|
||||
original repository. If you insist on using git with bitbucket/hg you
|
||||
may try `gitifyhg <https://github.com/buchuki/gitifyhg>`_ but are on your
|
||||
own and need to submit pull requests through the respective platform,
|
||||
nevertheless.
|
||||
|
||||
10
ISSUES.txt
10
ISSUES.txt
@@ -49,7 +49,7 @@ probably makes sense in order to keep the declarative nature. This mirrors
|
||||
the marker-mechanism with respect to a test module but puts it to a directory
|
||||
scale.
|
||||
|
||||
When doing larger scoped parametrization it probably becomes neccessary
|
||||
When doing larger scoped parametrization it probably becomes necessary
|
||||
to allow parametrization to be ignored if the according parameter is not
|
||||
used (currently any parametrized argument that is not present in a function will cause a ValueError). Example:
|
||||
|
||||
@@ -77,7 +77,7 @@ this would run the test_hello() function three times with three
|
||||
different values for self.db. This could also work with unittest/nose
|
||||
style tests, i.e. it leverages existing test suites without needing
|
||||
to rewrite them. Together with the previously mentioned setup_test()
|
||||
maybe the setupfunc could be ommitted?
|
||||
maybe the setupfunc could be omitted?
|
||||
|
||||
optimizations
|
||||
---------------------------------------------------------------
|
||||
@@ -229,7 +229,7 @@ tags: feature
|
||||
|
||||
pytest.ensuretemp and pytest.config are probably the last
|
||||
objects containing global state. Often using them is not
|
||||
neccessary. This is about trying to get rid of them, i.e.
|
||||
necessary. This is about trying to get rid of them, i.e.
|
||||
deprecating them and checking with PyPy's usages as well
|
||||
as others.
|
||||
|
||||
@@ -298,7 +298,7 @@ tags: feature
|
||||
|
||||
The idea is that you can e.g. import modules in a test and afterwards
|
||||
sys.modules, sys.meta_path etc would be reverted. It can go further
|
||||
then just importing however, e.g. current working direcroty, file
|
||||
then just importing however, e.g. current working directory, file
|
||||
descriptors, ...
|
||||
|
||||
This would probably be done by marking::
|
||||
@@ -357,7 +357,7 @@ a few use-cases come to mind:
|
||||
id, call = prepare_check(check)
|
||||
# bubble should only prevent exception propagation after a failure
|
||||
# the whole test should still fail
|
||||
# there might be need for a loer level api and taking custom markers into account
|
||||
# there might be need for a lower level api and taking custom markers into account
|
||||
with pytest.section(id, bubble=False):
|
||||
call()
|
||||
|
||||
|
||||
25
Makefile
Normal file
25
Makefile
Normal file
@@ -0,0 +1,25 @@
|
||||
# Set of targets useful for development/release process
|
||||
PYTHON = python2.7
|
||||
PATH := $(PWD)/.env/bin:$(PATH)
|
||||
|
||||
# prepare virtual python environment
|
||||
.env:
|
||||
virtualenv .env -p $(PYTHON)
|
||||
|
||||
# install all needed for development
|
||||
develop: .env
|
||||
pip install -e . tox -r requirements-docs.txt
|
||||
|
||||
# clean the development envrironment
|
||||
clean:
|
||||
-rm -rf .env
|
||||
|
||||
# generate documentation
|
||||
docs: develop
|
||||
find doc/en -name '*.txt' -not -path 'doc/en/_build/*' | xargs .env/bin/regendoc
|
||||
cd doc/en; make html
|
||||
|
||||
# upload documentation
|
||||
upload-docs: develop
|
||||
find doc/en -name '*.txt' -not -path 'doc/en/_build/*' | xargs .env/bin/regendoc --update
|
||||
cd doc/en; make install
|
||||
14
README.rst
14
README.rst
@@ -1,15 +1,15 @@
|
||||
.. image:: https://drone.io/bitbucket.org/hpk42/pytest/status.png
|
||||
:target: https://drone.io/bitbucket.org/hpk42/pytest/latest
|
||||
.. image:: https://drone.io/bitbucket.org/pytest-dev/pytest/status.png
|
||||
:target: https://drone.io/bitbucket.org/pytest-dev/pytest/latest
|
||||
.. image:: https://pypip.in/v/pytest/badge.png
|
||||
:target: https://crate.io/packages/pytest/
|
||||
:target: https://pypi.python.org/pypi/pytest
|
||||
|
||||
Documentation: http://pytest.org/latest/
|
||||
|
||||
Changelog: http://pytest.org/latest/changelog.html
|
||||
|
||||
Issues: https://bitbucket.org/hpk42/pytest/issues?status=open
|
||||
Issues: https://bitbucket.org/pytest-dev/pytest/issues?status=open
|
||||
|
||||
CI: https://drone.io/bitbucket.org/hpk42/pytest
|
||||
CI: https://drone.io/bitbucket.org/pytest-dev/pytest
|
||||
|
||||
The ``pytest`` testing tool makes it easy to write small tests, yet
|
||||
scales to support complex functional testing. It provides
|
||||
@@ -44,11 +44,11 @@ For much more info, including PDF docs, see
|
||||
|
||||
and report bugs at:
|
||||
|
||||
http://bitbucket.org/hpk42/pytest/issues/
|
||||
http://bitbucket.org/pytest-dev/pytest/issues/
|
||||
|
||||
and checkout or fork repo at:
|
||||
|
||||
http://bitbucket.org/hpk42/pytest/
|
||||
http://bitbucket.org/pytest-dev/pytest/
|
||||
|
||||
|
||||
Copyright Holger Krekel and others, 2004-2014
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
#
|
||||
__version__ = '2.6.4'
|
||||
__version__ = '2.7.0'
|
||||
|
||||
@@ -122,7 +122,7 @@ class AssertionRewritingHook(object):
|
||||
# One of the path components was not a directory, likely
|
||||
# because we're in a zip file.
|
||||
write = False
|
||||
elif e == errno.EACCES:
|
||||
elif e in [errno.EACCES, errno.EROFS]:
|
||||
state.trace("read only directory: %r" % fn_pypath.dirname)
|
||||
write = False
|
||||
else:
|
||||
@@ -146,6 +146,12 @@ class AssertionRewritingHook(object):
|
||||
return self
|
||||
|
||||
def load_module(self, name):
|
||||
# If there is an existing module object named 'fullname' in
|
||||
# sys.modules, the loader must use that existing module. (Otherwise,
|
||||
# the reload() builtin will not work correctly.)
|
||||
if name in sys.modules:
|
||||
return sys.modules[name]
|
||||
|
||||
co, pyc = self.modules.pop(name)
|
||||
# I wish I could just call imp.load_compiled here, but __file__ has to
|
||||
# be set properly. In Python 3.2+, this all would be handled correctly
|
||||
@@ -382,7 +388,12 @@ def _should_repr_global_name(obj):
|
||||
return not hasattr(obj, "__name__") and not py.builtin.callable(obj)
|
||||
|
||||
def _format_boolop(explanations, is_or):
|
||||
return "(" + (is_or and " or " or " and ").join(explanations) + ")"
|
||||
explanation = "(" + (is_or and " or " or " and ").join(explanations) + ")"
|
||||
if py.builtin._istext(explanation):
|
||||
t = py.builtin.text
|
||||
else:
|
||||
t = py.builtin.bytes
|
||||
return explanation.replace(t('%'), t('%%'))
|
||||
|
||||
def _call_reprcompare(ops, results, expls, each_obj):
|
||||
for i, res, expl in zip(range(len(ops)), results, expls):
|
||||
@@ -455,7 +466,7 @@ class AssertionRewriter(ast.NodeVisitor):
|
||||
for an overview of how this works.
|
||||
|
||||
The entry point here is .run() which will iterate over all the
|
||||
statenemts in an ast.Module and for each ast.Assert statement it
|
||||
statements in an ast.Module and for each ast.Assert statement it
|
||||
finds call .visit() with it. Then .visit_Assert() takes over and
|
||||
is responsible for creating new ast statements to replace the
|
||||
original assert statement: it re-writes the test of an assertion
|
||||
|
||||
@@ -29,8 +29,8 @@ def pytest_addoption(parser):
|
||||
help="shortcut for --capture=no.")
|
||||
|
||||
|
||||
@pytest.mark.tryfirst
|
||||
def pytest_load_initial_conftests(early_config, parser, args, __multicall__):
|
||||
@pytest.mark.hookwrapper
|
||||
def pytest_load_initial_conftests(early_config, parser, args):
|
||||
ns = early_config.known_args_namespace
|
||||
pluginmanager = early_config.pluginmanager
|
||||
capman = CaptureManager(ns.capture)
|
||||
@@ -47,15 +47,11 @@ def pytest_load_initial_conftests(early_config, parser, args, __multicall__):
|
||||
|
||||
# finally trigger conftest loading but while capturing (issue93)
|
||||
capman.init_capturings()
|
||||
try:
|
||||
try:
|
||||
return __multicall__.execute()
|
||||
finally:
|
||||
out, err = capman.suspendcapture()
|
||||
except:
|
||||
outcome = yield
|
||||
out, err = capman.suspendcapture()
|
||||
if outcome.excinfo is not None:
|
||||
sys.stdout.write(out)
|
||||
sys.stderr.write(err)
|
||||
raise
|
||||
|
||||
|
||||
class CaptureManager:
|
||||
@@ -105,20 +101,19 @@ class CaptureManager:
|
||||
if capfuncarg is not None:
|
||||
capfuncarg.close()
|
||||
|
||||
@pytest.mark.tryfirst
|
||||
def pytest_make_collect_report(self, __multicall__, collector):
|
||||
if not isinstance(collector, pytest.File):
|
||||
return
|
||||
self.resumecapture()
|
||||
try:
|
||||
rep = __multicall__.execute()
|
||||
finally:
|
||||
@pytest.mark.hookwrapper
|
||||
def pytest_make_collect_report(self, collector):
|
||||
if isinstance(collector, pytest.File):
|
||||
self.resumecapture()
|
||||
outcome = yield
|
||||
out, err = self.suspendcapture()
|
||||
if out:
|
||||
rep.sections.append(("Captured stdout", out))
|
||||
if err:
|
||||
rep.sections.append(("Captured stderr", err))
|
||||
return rep
|
||||
rep = outcome.get_result()
|
||||
if out:
|
||||
rep.sections.append(("Captured stdout", out))
|
||||
if err:
|
||||
rep.sections.append(("Captured stderr", err))
|
||||
else:
|
||||
yield
|
||||
|
||||
@pytest.mark.hookwrapper
|
||||
def pytest_runtest_setup(self, item):
|
||||
|
||||
@@ -98,7 +98,7 @@ class PytestPluginManager(PluginManager):
|
||||
err = py.io.dupfile(err, encoding=encoding)
|
||||
except Exception:
|
||||
pass
|
||||
self.trace.root.setwriter(err.write)
|
||||
self.set_tracing(err.write)
|
||||
|
||||
def pytest_configure(self, config):
|
||||
config.addinivalue_line("markers",
|
||||
@@ -657,6 +657,12 @@ class Config(object):
|
||||
sys.stderr.write("INTERNALERROR> %s\n" %line)
|
||||
sys.stderr.flush()
|
||||
|
||||
def cwd_relative_nodeid(self, nodeid):
|
||||
# nodeid's are relative to the rootpath, compute relative to cwd
|
||||
if self.invocation_dir != self.rootdir:
|
||||
fullpath = self.rootdir.join(nodeid)
|
||||
nodeid = self.invocation_dir.bestrelpath(fullpath)
|
||||
return nodeid
|
||||
|
||||
@classmethod
|
||||
def fromdictargs(cls, option_dict, args):
|
||||
@@ -682,11 +688,8 @@ class Config(object):
|
||||
setattr(self.option, opt.dest, opt.default)
|
||||
|
||||
def _getmatchingplugins(self, fspath):
|
||||
allconftests = self._conftest._conftestpath2mod.values()
|
||||
plugins = [x for x in self.pluginmanager.getplugins()
|
||||
if x not in allconftests]
|
||||
plugins += self._conftest.getconftestmodules(fspath)
|
||||
return plugins
|
||||
return self.pluginmanager._plugins + \
|
||||
self._conftest.getconftestmodules(fspath)
|
||||
|
||||
def pytest_load_initial_conftests(self, early_config):
|
||||
self._conftest.setinitial(early_config.known_args_namespace)
|
||||
@@ -694,20 +697,16 @@ class Config(object):
|
||||
|
||||
def _initini(self, args):
|
||||
parsed_args = self._parser.parse_known_args(args)
|
||||
if parsed_args.inifilename:
|
||||
iniconfig = py.iniconfig.IniConfig(parsed_args.inifilename)
|
||||
if 'pytest' in iniconfig.sections:
|
||||
self.inicfg = iniconfig['pytest']
|
||||
else:
|
||||
self.inicfg = {}
|
||||
else:
|
||||
self.inicfg = getcfg(args, ["pytest.ini", "tox.ini", "setup.cfg"])
|
||||
r = determine_setup(parsed_args.inifilename, parsed_args.file_or_dir)
|
||||
self.rootdir, self.inifile, self.inicfg = r
|
||||
self.invocation_dir = py.path.local()
|
||||
self._parser.addini('addopts', 'extra command line options', 'args')
|
||||
self._parser.addini('minversion', 'minimally required pytest version')
|
||||
|
||||
def _preparse(self, args, addopts=True):
|
||||
self._initini(args)
|
||||
if addopts:
|
||||
args[:] = shlex.split(os.environ.get('PYTEST_ADDOPTS', '')) + args
|
||||
args[:] = self.getini("addopts") + args
|
||||
self._checkversion()
|
||||
self.pluginmanager.consider_preparse(args)
|
||||
@@ -861,8 +860,58 @@ def getcfg(args, inibasenames):
|
||||
if exists(p):
|
||||
iniconfig = py.iniconfig.IniConfig(p)
|
||||
if 'pytest' in iniconfig.sections:
|
||||
return iniconfig['pytest']
|
||||
return {}
|
||||
return base, p, iniconfig['pytest']
|
||||
elif inibasename == "pytest.ini":
|
||||
# allowed to be empty
|
||||
return base, p, {}
|
||||
return None, None, None
|
||||
|
||||
|
||||
def get_common_ancestor(args):
|
||||
# args are what we get after early command line parsing (usually
|
||||
# strings, but can be py.path.local objects as well)
|
||||
common_ancestor = None
|
||||
for arg in args:
|
||||
if str(arg)[0] == "-":
|
||||
continue
|
||||
p = py.path.local(arg)
|
||||
if common_ancestor is None:
|
||||
common_ancestor = p
|
||||
else:
|
||||
if p.relto(common_ancestor) or p == common_ancestor:
|
||||
continue
|
||||
elif common_ancestor.relto(p):
|
||||
common_ancestor = p
|
||||
else:
|
||||
shared = p.common(common_ancestor)
|
||||
if shared is not None:
|
||||
common_ancestor = shared
|
||||
if common_ancestor is None:
|
||||
common_ancestor = py.path.local()
|
||||
elif not common_ancestor.isdir():
|
||||
common_ancestor = common_ancestor.dirpath()
|
||||
return common_ancestor
|
||||
|
||||
|
||||
def determine_setup(inifile, args):
|
||||
if inifile:
|
||||
iniconfig = py.iniconfig.IniConfig(inifile)
|
||||
try:
|
||||
inicfg = iniconfig["pytest"]
|
||||
except KeyError:
|
||||
inicfg = None
|
||||
rootdir = get_common_ancestor(args)
|
||||
else:
|
||||
ancestor = get_common_ancestor(args)
|
||||
rootdir, inifile, inicfg = getcfg(
|
||||
[ancestor], ["pytest.ini", "tox.ini", "setup.cfg"])
|
||||
if rootdir is None:
|
||||
for rootdir in ancestor.parts(reverse=True):
|
||||
if rootdir.join("setup.py").exists():
|
||||
break
|
||||
else:
|
||||
rootdir = ancestor
|
||||
return rootdir, inifile, inicfg or {}
|
||||
|
||||
|
||||
def setns(obj, dic):
|
||||
|
||||
325
_pytest/core.py
325
_pytest/core.py
@@ -10,6 +10,8 @@ import py
|
||||
assert py.__version__.split(".")[:2] >= ['1', '4'], ("installation problem: "
|
||||
"%s is too old, remove or upgrade 'py'" % (py.__version__))
|
||||
|
||||
py3 = sys.version_info > (3,0)
|
||||
|
||||
class TagTracer:
|
||||
def __init__(self):
|
||||
self._tag2proc = {}
|
||||
@@ -67,16 +69,104 @@ class TagTracerSub:
|
||||
def get(self, name):
|
||||
return self.__class__(self.root, self.tags + (name,))
|
||||
|
||||
|
||||
def add_method_wrapper(cls, wrapper_func):
|
||||
""" Substitute the function named "wrapperfunc.__name__" at class
|
||||
"cls" with a function that wraps the call to the original function.
|
||||
Return an undo function which can be called to reset the class to use
|
||||
the old method again.
|
||||
|
||||
wrapper_func is called with the same arguments as the method
|
||||
it wraps and its result is used as a wrap_controller for
|
||||
calling the original function.
|
||||
"""
|
||||
name = wrapper_func.__name__
|
||||
oldcall = getattr(cls, name)
|
||||
def wrap_exec(*args, **kwargs):
|
||||
gen = wrapper_func(*args, **kwargs)
|
||||
return wrapped_call(gen, lambda: oldcall(*args, **kwargs))
|
||||
|
||||
setattr(cls, name, wrap_exec)
|
||||
return lambda: setattr(cls, name, oldcall)
|
||||
|
||||
def raise_wrapfail(wrap_controller, msg):
|
||||
co = wrap_controller.gi_code
|
||||
raise RuntimeError("wrap_controller at %r %s:%d %s" %
|
||||
(co.co_name, co.co_filename, co.co_firstlineno, msg))
|
||||
|
||||
def wrapped_call(wrap_controller, func):
|
||||
""" Wrap calling to a function with a generator which needs to yield
|
||||
exactly once. The yield point will trigger calling the wrapped function
|
||||
and return its CallOutcome to the yield point. The generator then needs
|
||||
to finish (raise StopIteration) in order for the wrapped call to complete.
|
||||
"""
|
||||
try:
|
||||
next(wrap_controller) # first yield
|
||||
except StopIteration:
|
||||
raise_wrapfail(wrap_controller, "did not yield")
|
||||
call_outcome = CallOutcome(func)
|
||||
try:
|
||||
wrap_controller.send(call_outcome)
|
||||
raise_wrapfail(wrap_controller, "has second yield")
|
||||
except StopIteration:
|
||||
pass
|
||||
return call_outcome.get_result()
|
||||
|
||||
|
||||
class CallOutcome:
|
||||
""" Outcome of a function call, either an exception or a proper result.
|
||||
Calling the ``get_result`` method will return the result or reraise
|
||||
the exception raised when the function was called. """
|
||||
excinfo = None
|
||||
def __init__(self, func):
|
||||
try:
|
||||
self.result = func()
|
||||
except Exception:
|
||||
self.excinfo = sys.exc_info()
|
||||
|
||||
def force_result(self, result):
|
||||
self.result = result
|
||||
self.excinfo = None
|
||||
|
||||
def get_result(self):
|
||||
if self.excinfo is None:
|
||||
return self.result
|
||||
else:
|
||||
ex = self.excinfo
|
||||
if py3:
|
||||
raise ex[1].with_traceback(ex[2])
|
||||
py.builtin._reraise(*ex)
|
||||
|
||||
|
||||
class PluginManager(object):
|
||||
def __init__(self, hookspecs=None):
|
||||
def __init__(self, hookspecs=None, prefix="pytest_"):
|
||||
self._name2plugin = {}
|
||||
self._listattrcache = {}
|
||||
self._plugins = []
|
||||
self._conftestplugins = []
|
||||
self._plugin2hookcallers = {}
|
||||
self._warnings = []
|
||||
self.trace = TagTracer().get("pluginmanage")
|
||||
self._plugin_distinfo = []
|
||||
self._shutdown = []
|
||||
self.hook = HookRelay(hookspecs or [], pm=self)
|
||||
self.hook = HookRelay(hookspecs or [], pm=self, prefix=prefix)
|
||||
|
||||
def set_tracing(self, writer):
|
||||
self.trace.root.setwriter(writer)
|
||||
# reconfigure HookCalling to perform tracing
|
||||
assert not hasattr(self, "_wrapping")
|
||||
self._wrapping = True
|
||||
|
||||
def _docall(self, methods, kwargs):
|
||||
trace = self.hookrelay.trace
|
||||
trace.root.indent += 1
|
||||
trace(self.name, kwargs)
|
||||
box = yield
|
||||
if box.excinfo is None:
|
||||
trace("finish", self.name, "-->", box.result)
|
||||
trace.root.indent -= 1
|
||||
|
||||
undo = add_method_wrapper(HookCaller, _docall)
|
||||
self.add_shutdown(undo)
|
||||
|
||||
def do_configure(self, config):
|
||||
# backward compatibility
|
||||
@@ -86,7 +176,7 @@ class PluginManager(object):
|
||||
assert not hasattr(self, "_registercallback")
|
||||
self._registercallback = callback
|
||||
|
||||
def register(self, plugin, name=None, prepend=False):
|
||||
def register(self, plugin, name=None, prepend=False, conftest=False):
|
||||
if self._name2plugin.get(name, None) == -1:
|
||||
return
|
||||
name = name or getattr(plugin, '__name__', str(id(plugin)))
|
||||
@@ -94,23 +184,35 @@ class PluginManager(object):
|
||||
raise ValueError("Plugin already registered: %s=%s\n%s" %(
|
||||
name, plugin, self._name2plugin))
|
||||
#self.trace("registering", name, plugin)
|
||||
self._name2plugin[name] = plugin
|
||||
reg = getattr(self, "_registercallback", None)
|
||||
if reg is not None:
|
||||
reg(plugin, name)
|
||||
if not prepend:
|
||||
self._plugins.append(plugin)
|
||||
reg(plugin, name) # may call addhooks
|
||||
hookcallers = list(self.hook._scan_plugin(plugin))
|
||||
self._plugin2hookcallers[plugin] = hookcallers
|
||||
self._name2plugin[name] = plugin
|
||||
if conftest:
|
||||
self._conftestplugins.append(plugin)
|
||||
else:
|
||||
self._plugins.insert(0, plugin)
|
||||
if not prepend:
|
||||
self._plugins.append(plugin)
|
||||
else:
|
||||
self._plugins.insert(0, plugin)
|
||||
# finally make sure that the methods of the new plugin take part
|
||||
for hookcaller in hookcallers:
|
||||
hookcaller.scan_methods()
|
||||
return True
|
||||
|
||||
def unregister(self, plugin=None, name=None):
|
||||
if plugin is None:
|
||||
plugin = self.getplugin(name=name)
|
||||
self._plugins.remove(plugin)
|
||||
def unregister(self, plugin):
|
||||
try:
|
||||
self._plugins.remove(plugin)
|
||||
except KeyError:
|
||||
self._conftestplugins.remove(plugin)
|
||||
for name, value in list(self._name2plugin.items()):
|
||||
if value == plugin:
|
||||
del self._name2plugin[name]
|
||||
hookcallers = self._plugin2hookcallers.pop(plugin)
|
||||
for hookcaller in hookcallers:
|
||||
hookcaller.scan_methods()
|
||||
|
||||
def add_shutdown(self, func):
|
||||
self._shutdown.append(func)
|
||||
@@ -119,22 +221,19 @@ class PluginManager(object):
|
||||
while self._shutdown:
|
||||
func = self._shutdown.pop()
|
||||
func()
|
||||
self._plugins = []
|
||||
self._plugins = self._conftestplugins = []
|
||||
self._name2plugin.clear()
|
||||
self._listattrcache.clear()
|
||||
|
||||
def isregistered(self, plugin, name=None):
|
||||
if self.getplugin(name) is not None:
|
||||
return True
|
||||
for val in self._name2plugin.values():
|
||||
if plugin == val:
|
||||
return True
|
||||
return plugin in self._plugins or plugin in self._conftestplugins
|
||||
|
||||
def addhooks(self, spec, prefix="pytest_"):
|
||||
self.hook._addhooks(spec, prefix=prefix)
|
||||
|
||||
def getplugins(self):
|
||||
return list(self._plugins)
|
||||
return self._plugins + self._conftestplugins
|
||||
|
||||
def skipifmissing(self, name):
|
||||
if not self.hasplugin(name):
|
||||
@@ -190,15 +289,17 @@ class PluginManager(object):
|
||||
def consider_pluginarg(self, arg):
|
||||
if arg.startswith("no:"):
|
||||
name = arg[3:]
|
||||
if self.getplugin(name) is not None:
|
||||
self.unregister(None, name=name)
|
||||
plugin = self.getplugin(name)
|
||||
if plugin is not None:
|
||||
self.unregister(plugin)
|
||||
self._name2plugin[name] = -1
|
||||
else:
|
||||
if self.getplugin(arg) is None:
|
||||
self.import_plugin(arg)
|
||||
|
||||
def consider_conftest(self, conftestmodule):
|
||||
if self.register(conftestmodule, name=conftestmodule.__file__):
|
||||
if self.register(conftestmodule, name=conftestmodule.__file__,
|
||||
conftest=True):
|
||||
self.consider_module(conftestmodule)
|
||||
|
||||
def consider_module(self, mod):
|
||||
@@ -233,12 +334,7 @@ class PluginManager(object):
|
||||
|
||||
def listattr(self, attrname, plugins=None):
|
||||
if plugins is None:
|
||||
plugins = self._plugins
|
||||
key = (attrname,) + tuple(plugins)
|
||||
try:
|
||||
return list(self._listattrcache[key])
|
||||
except KeyError:
|
||||
pass
|
||||
plugins = self._plugins + self._conftestplugins
|
||||
l = []
|
||||
last = []
|
||||
wrappers = []
|
||||
@@ -257,7 +353,6 @@ class PluginManager(object):
|
||||
l.append(meth)
|
||||
l.extend(last)
|
||||
l.extend(wrappers)
|
||||
self._listattrcache[key] = list(l)
|
||||
return l
|
||||
|
||||
def call_plugin(self, plugin, methname, kwargs):
|
||||
@@ -278,16 +373,10 @@ def importplugin(importspec):
|
||||
class MultiCall:
|
||||
""" execute a call into multiple python functions/methods. """
|
||||
|
||||
class WrongHookWrapper(Exception):
|
||||
""" a hook wrapper does not behave correctly. """
|
||||
def __init__(self, func, message):
|
||||
Exception.__init__(self, func, message)
|
||||
self.func = func
|
||||
self.message = message
|
||||
|
||||
def __init__(self, methods, kwargs, firstresult=False):
|
||||
self.methods = list(methods)
|
||||
self.kwargs = kwargs
|
||||
self.kwargs["__multicall__"] = self
|
||||
self.results = []
|
||||
self.firstresult = firstresult
|
||||
|
||||
@@ -296,51 +385,22 @@ class MultiCall:
|
||||
return "<MultiCall %s, kwargs=%r>" %(status, self.kwargs)
|
||||
|
||||
def execute(self):
|
||||
next_finalizers = []
|
||||
try:
|
||||
while self.methods:
|
||||
method = self.methods.pop()
|
||||
kwargs = self.getkwargs(method)
|
||||
if hasattr(method, "hookwrapper"):
|
||||
it = method(**kwargs)
|
||||
next = getattr(it, "next", None)
|
||||
if next is None:
|
||||
next = getattr(it, "__next__", None)
|
||||
if next is None:
|
||||
raise self.WrongHookWrapper(method,
|
||||
"wrapper does not contain a yield")
|
||||
res = next()
|
||||
next_finalizers.append((method, next))
|
||||
else:
|
||||
res = method(**kwargs)
|
||||
if res is not None:
|
||||
self.results.append(res)
|
||||
if self.firstresult:
|
||||
return res
|
||||
if not self.firstresult:
|
||||
return self.results
|
||||
finally:
|
||||
for method, fin in reversed(next_finalizers):
|
||||
try:
|
||||
fin()
|
||||
except StopIteration:
|
||||
pass
|
||||
else:
|
||||
raise self.WrongHookWrapper(method,
|
||||
"wrapper contain more than one yield")
|
||||
all_kwargs = self.kwargs
|
||||
while self.methods:
|
||||
method = self.methods.pop()
|
||||
args = [all_kwargs[argname] for argname in varnames(method)]
|
||||
if hasattr(method, "hookwrapper"):
|
||||
return wrapped_call(method(*args), self.execute)
|
||||
res = method(*args)
|
||||
if res is not None:
|
||||
self.results.append(res)
|
||||
if self.firstresult:
|
||||
return res
|
||||
if not self.firstresult:
|
||||
return self.results
|
||||
|
||||
|
||||
def getkwargs(self, method):
|
||||
kwargs = {}
|
||||
for argname in varnames(method):
|
||||
try:
|
||||
kwargs[argname] = self.kwargs[argname]
|
||||
except KeyError:
|
||||
if argname == "__multicall__":
|
||||
kwargs[argname] = self
|
||||
return kwargs
|
||||
|
||||
def varnames(func):
|
||||
def varnames(func, startindex=None):
|
||||
""" return argument name tuple for a function, method, class or callable.
|
||||
|
||||
In case of a class, its "__init__" method is considered.
|
||||
@@ -357,74 +417,127 @@ def varnames(func):
|
||||
func = func.__init__
|
||||
except AttributeError:
|
||||
return ()
|
||||
ismethod = True
|
||||
startindex = 1
|
||||
else:
|
||||
if not inspect.isfunction(func) and not inspect.ismethod(func):
|
||||
func = getattr(func, '__call__', func)
|
||||
ismethod = inspect.ismethod(func)
|
||||
if startindex is None:
|
||||
startindex = int(inspect.ismethod(func))
|
||||
|
||||
rawcode = py.code.getrawcode(func)
|
||||
try:
|
||||
x = rawcode.co_varnames[ismethod:rawcode.co_argcount]
|
||||
x = rawcode.co_varnames[startindex:rawcode.co_argcount]
|
||||
except AttributeError:
|
||||
x = ()
|
||||
else:
|
||||
defaults = func.__defaults__
|
||||
if defaults:
|
||||
x = x[:-len(defaults)]
|
||||
try:
|
||||
cache["_varnames"] = x
|
||||
except TypeError:
|
||||
pass
|
||||
return x
|
||||
|
||||
|
||||
class HookRelay:
|
||||
def __init__(self, hookspecs, pm, prefix="pytest_"):
|
||||
if not isinstance(hookspecs, list):
|
||||
hookspecs = [hookspecs]
|
||||
self._hookspecs = []
|
||||
self._pm = pm
|
||||
self.trace = pm.trace.root.get("hook")
|
||||
self.prefix = prefix
|
||||
for hookspec in hookspecs:
|
||||
self._addhooks(hookspec, prefix)
|
||||
|
||||
def _addhooks(self, hookspecs, prefix):
|
||||
self._hookspecs.append(hookspecs)
|
||||
def _addhooks(self, hookspec, prefix):
|
||||
added = False
|
||||
for name, method in vars(hookspecs).items():
|
||||
isclass = int(inspect.isclass(hookspec))
|
||||
for name, method in vars(hookspec).items():
|
||||
if name.startswith(prefix):
|
||||
firstresult = getattr(method, 'firstresult', False)
|
||||
hc = HookCaller(self, name, firstresult=firstresult)
|
||||
hc = HookCaller(self, name, firstresult=firstresult,
|
||||
argnames=varnames(method, startindex=isclass))
|
||||
setattr(self, name, hc)
|
||||
added = True
|
||||
#print ("setting new hook", name)
|
||||
if not added:
|
||||
raise ValueError("did not find new %r hooks in %r" %(
|
||||
prefix, hookspecs,))
|
||||
prefix, hookspec,))
|
||||
|
||||
def _getcaller(self, name, plugins):
|
||||
caller = getattr(self, name)
|
||||
methods = self._pm.listattr(name, plugins=plugins)
|
||||
if methods:
|
||||
return caller.new_cached_caller(methods)
|
||||
return caller
|
||||
|
||||
def _scan_plugin(self, plugin):
|
||||
def fail(msg, *args):
|
||||
name = getattr(plugin, '__name__', plugin)
|
||||
raise PluginValidationError("plugin %r\n%s" %(name, msg % args))
|
||||
|
||||
for name in dir(plugin):
|
||||
if not name.startswith(self.prefix):
|
||||
continue
|
||||
hook = getattr(self, name, None)
|
||||
method = getattr(plugin, name)
|
||||
if hook is None:
|
||||
is_optional = getattr(method, 'optionalhook', False)
|
||||
if not isgenerichook(name) and not is_optional:
|
||||
fail("found unknown hook: %r", name)
|
||||
continue
|
||||
for arg in varnames(method):
|
||||
if arg not in hook.argnames:
|
||||
fail("argument %r not available\n"
|
||||
"actual definition: %s\n"
|
||||
"available hookargs: %s",
|
||||
arg, formatdef(method),
|
||||
", ".join(hook.argnames))
|
||||
yield hook
|
||||
|
||||
|
||||
class HookCaller:
|
||||
def __init__(self, hookrelay, name, firstresult):
|
||||
def __init__(self, hookrelay, name, firstresult, argnames, methods=()):
|
||||
self.hookrelay = hookrelay
|
||||
self.name = name
|
||||
self.firstresult = firstresult
|
||||
self.trace = self.hookrelay.trace
|
||||
self.argnames = ["__multicall__"]
|
||||
self.argnames.extend(argnames)
|
||||
assert "self" not in argnames # sanity check
|
||||
self.methods = methods
|
||||
|
||||
def new_cached_caller(self, methods):
|
||||
return HookCaller(self.hookrelay, self.name, self.firstresult,
|
||||
argnames=self.argnames, methods=methods)
|
||||
|
||||
def __repr__(self):
|
||||
return "<HookCaller %r>" %(self.name,)
|
||||
|
||||
def __call__(self, **kwargs):
|
||||
methods = self.hookrelay._pm.listattr(self.name)
|
||||
return self._docall(methods, kwargs)
|
||||
def scan_methods(self):
|
||||
self.methods = self.hookrelay._pm.listattr(self.name)
|
||||
|
||||
def pcall(self, plugins, **kwargs):
|
||||
methods = self.hookrelay._pm.listattr(self.name, plugins=plugins)
|
||||
return self._docall(methods, kwargs)
|
||||
def __call__(self, **kwargs):
|
||||
return self._docall(self.methods, kwargs)
|
||||
|
||||
def callextra(self, methods, **kwargs):
|
||||
return self._docall(self.methods + methods, kwargs)
|
||||
|
||||
def _docall(self, methods, kwargs):
|
||||
self.trace(self.name, kwargs)
|
||||
self.trace.root.indent += 1
|
||||
mc = MultiCall(methods, kwargs, firstresult=self.firstresult)
|
||||
try:
|
||||
res = mc.execute()
|
||||
if res:
|
||||
self.trace("finish", self.name, "-->", res)
|
||||
finally:
|
||||
self.trace.root.indent -= 1
|
||||
return res
|
||||
return MultiCall(methods, kwargs,
|
||||
firstresult=self.firstresult).execute()
|
||||
|
||||
|
||||
class PluginValidationError(Exception):
|
||||
""" plugin failed validation. """
|
||||
|
||||
def isgenerichook(name):
|
||||
return name == "pytest_plugins" or \
|
||||
name.startswith("pytest_funcarg__")
|
||||
|
||||
def formatdef(func):
|
||||
return "%s%s" % (
|
||||
func.__name__,
|
||||
inspect.formatargspec(*inspect.getargspec(func))
|
||||
)
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ from _pytest.python import FixtureRequest, FuncFixtureInfo
|
||||
from py._code.code import TerminalRepr, ReprFileLocation
|
||||
|
||||
def pytest_addoption(parser):
|
||||
parser.addini('doctest_optionflags', 'option flags for doctests',
|
||||
type="args", default=["ELLIPSIS"])
|
||||
group = parser.getgroup("collect")
|
||||
group.addoption("--doctest-modules",
|
||||
action="store_true", default=False,
|
||||
@@ -15,6 +17,10 @@ def pytest_addoption(parser):
|
||||
action="store", default="test*.txt", metavar="pat",
|
||||
help="doctests file matching pattern, default: test*.txt",
|
||||
dest="doctestglob")
|
||||
group.addoption("--doctest-ignore-import-errors",
|
||||
action="store_true", default=False,
|
||||
help="ignore doctest ImportErrors",
|
||||
dest="doctest_ignore_import_errors")
|
||||
|
||||
def pytest_collect_file(path, parent):
|
||||
config = parent.config
|
||||
@@ -87,6 +93,23 @@ class DoctestItem(pytest.Item):
|
||||
def reportinfo(self):
|
||||
return self.fspath, None, "[doctest] %s" % self.name
|
||||
|
||||
def _get_flag_lookup():
|
||||
import doctest
|
||||
return dict(DONT_ACCEPT_TRUE_FOR_1=doctest.DONT_ACCEPT_TRUE_FOR_1,
|
||||
DONT_ACCEPT_BLANKLINE=doctest.DONT_ACCEPT_BLANKLINE,
|
||||
NORMALIZE_WHITESPACE=doctest.NORMALIZE_WHITESPACE,
|
||||
ELLIPSIS=doctest.ELLIPSIS,
|
||||
IGNORE_EXCEPTION_DETAIL=doctest.IGNORE_EXCEPTION_DETAIL,
|
||||
COMPARISON_FLAGS=doctest.COMPARISON_FLAGS)
|
||||
|
||||
def get_optionflags(parent):
|
||||
optionflags_str = parent.config.getini("doctest_optionflags")
|
||||
flag_lookup_table = _get_flag_lookup()
|
||||
flag_acc = 0
|
||||
for flag in optionflags_str:
|
||||
flag_acc |= flag_lookup_table[flag]
|
||||
return flag_acc
|
||||
|
||||
class DoctestTextfile(DoctestItem, pytest.File):
|
||||
def runtest(self):
|
||||
import doctest
|
||||
@@ -101,7 +124,7 @@ class DoctestTextfile(DoctestItem, pytest.File):
|
||||
fixture_request._fillfixtures()
|
||||
failed, tot = doctest.testfile(
|
||||
str(self.fspath), module_relative=False,
|
||||
optionflags=doctest.ELLIPSIS,
|
||||
optionflags=get_optionflags(self),
|
||||
extraglobs=dict(getfixture=fixture_request.getfuncargvalue),
|
||||
raise_on_error=True, verbose=0)
|
||||
|
||||
@@ -111,7 +134,13 @@ class DoctestModule(pytest.File):
|
||||
if self.fspath.basename == "conftest.py":
|
||||
module = self.config._conftest.importconftest(self.fspath)
|
||||
else:
|
||||
module = self.fspath.pyimport()
|
||||
try:
|
||||
module = self.fspath.pyimport()
|
||||
except ImportError:
|
||||
if self.config.getvalue('doctest_ignore_import_errors'):
|
||||
pytest.skip('unable to import module %r' % self.fspath)
|
||||
else:
|
||||
raise
|
||||
# satisfy `FixtureRequest` constructor...
|
||||
self.funcargs = {}
|
||||
self._fixtureinfo = FuncFixtureInfo((), [], {})
|
||||
@@ -119,8 +148,9 @@ class DoctestModule(pytest.File):
|
||||
doctest_globals = dict(getfixture=fixture_request.getfuncargvalue)
|
||||
# uses internal doctest module parsing mechanism
|
||||
finder = doctest.DocTestFinder()
|
||||
runner = doctest.DebugRunner(verbose=0, optionflags=doctest.ELLIPSIS)
|
||||
optionflags = get_optionflags(self)
|
||||
runner = doctest.DebugRunner(verbose=0, optionflags=optionflags)
|
||||
for test in finder.find(module, module.__name__,
|
||||
extraglobs=doctest_globals):
|
||||
if test.examples: # skip empty doctests
|
||||
if test.examples: # skip empty doctests
|
||||
yield DoctestItem(test.name, self, runner, test)
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
""" version info, help messages, tracing configuration. """
|
||||
import py
|
||||
import pytest
|
||||
import os, inspect, sys
|
||||
from _pytest.core import varnames
|
||||
import os, sys
|
||||
|
||||
def pytest_addoption(parser):
|
||||
group = parser.getgroup('debugconfig')
|
||||
@@ -23,18 +22,21 @@ def pytest_addoption(parser):
|
||||
help="store internal tracing debug information in 'pytestdebug.log'.")
|
||||
|
||||
|
||||
def pytest_cmdline_parse(__multicall__):
|
||||
config = __multicall__.execute()
|
||||
@pytest.mark.hookwrapper
|
||||
def pytest_cmdline_parse():
|
||||
outcome = yield
|
||||
config = outcome.get_result()
|
||||
if config.option.debug:
|
||||
path = os.path.abspath("pytestdebug.log")
|
||||
f = open(path, 'w')
|
||||
config._debugfile = f
|
||||
f.write("versions pytest-%s, py-%s, python-%s\ncwd=%s\nargs=%s\n\n" %(
|
||||
pytest.__version__, py.__version__, ".".join(map(str, sys.version_info)),
|
||||
f.write("versions pytest-%s, py-%s, "
|
||||
"python-%s\ncwd=%s\nargs=%s\n\n" %(
|
||||
pytest.__version__, py.__version__,
|
||||
".".join(map(str, sys.version_info)),
|
||||
os.getcwd(), config._origargs))
|
||||
config.trace.root.setwriter(f.write)
|
||||
config.pluginmanager.set_tracing(f.write)
|
||||
sys.stderr.write("writing pytestdebug information to %s\n" % path)
|
||||
return config
|
||||
|
||||
@pytest.mark.trylast
|
||||
def pytest_unconfigure(config):
|
||||
@@ -127,70 +129,3 @@ def pytest_report_header(config):
|
||||
return lines
|
||||
|
||||
|
||||
# =====================================================
|
||||
# validate plugin syntax and hooks
|
||||
# =====================================================
|
||||
|
||||
def pytest_plugin_registered(manager, plugin):
|
||||
methods = collectattr(plugin)
|
||||
hooks = {}
|
||||
for hookspec in manager.hook._hookspecs:
|
||||
hooks.update(collectattr(hookspec))
|
||||
|
||||
stringio = py.io.TextIO()
|
||||
def Print(*args):
|
||||
if args:
|
||||
stringio.write(" ".join(map(str, args)))
|
||||
stringio.write("\n")
|
||||
|
||||
fail = False
|
||||
while methods:
|
||||
name, method = methods.popitem()
|
||||
#print "checking", name
|
||||
if isgenerichook(name):
|
||||
continue
|
||||
if name not in hooks:
|
||||
if not getattr(method, 'optionalhook', False):
|
||||
Print("found unknown hook:", name)
|
||||
fail = True
|
||||
else:
|
||||
#print "checking", method
|
||||
method_args = list(varnames(method))
|
||||
if '__multicall__' in method_args:
|
||||
method_args.remove('__multicall__')
|
||||
hook = hooks[name]
|
||||
hookargs = varnames(hook)
|
||||
for arg in method_args:
|
||||
if arg not in hookargs:
|
||||
Print("argument %r not available" %(arg, ))
|
||||
Print("actual definition: %s" %(formatdef(method)))
|
||||
Print("available hook arguments: %s" %
|
||||
", ".join(hookargs))
|
||||
fail = True
|
||||
break
|
||||
#if not fail:
|
||||
# print "matching hook:", formatdef(method)
|
||||
if fail:
|
||||
name = getattr(plugin, '__name__', plugin)
|
||||
raise PluginValidationError("%s:\n%s" % (name, stringio.getvalue()))
|
||||
|
||||
class PluginValidationError(Exception):
|
||||
""" plugin failed validation. """
|
||||
|
||||
def isgenerichook(name):
|
||||
return name == "pytest_plugins" or \
|
||||
name.startswith("pytest_funcarg__")
|
||||
|
||||
def collectattr(obj):
|
||||
methods = {}
|
||||
for apiname in dir(obj):
|
||||
if apiname.startswith("pytest_"):
|
||||
methods[apiname] = getattr(obj, apiname)
|
||||
return methods
|
||||
|
||||
def formatdef(func):
|
||||
return "%s%s" % (
|
||||
func.__name__,
|
||||
inspect.formatargspec(*inspect.getargspec(func))
|
||||
)
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ def pytest_generate_tests(metafunc):
|
||||
# -------------------------------------------------------------------------
|
||||
# generic runtest related hooks
|
||||
# -------------------------------------------------------------------------
|
||||
def pytest_itemstart(item, node=None):
|
||||
def pytest_itemstart(item, node):
|
||||
""" (deprecated, use pytest_runtest_logstart). """
|
||||
|
||||
def pytest_runtest_protocol(item, nextitem):
|
||||
|
||||
@@ -123,7 +123,12 @@ class LogXML(object):
|
||||
Junit.skipped(message="xfail-marked test passes unexpectedly"))
|
||||
self.skipped += 1
|
||||
else:
|
||||
fail = Junit.failure(message="test failure")
|
||||
if isinstance(report.longrepr, (unicode, str)):
|
||||
message = report.longrepr
|
||||
else:
|
||||
message = report.longrepr.reprcrash.message
|
||||
message = bin_xml_escape(message)
|
||||
fail = Junit.failure(message=message)
|
||||
fail.append(bin_xml_escape(report.longrepr))
|
||||
self.append(fail)
|
||||
self.failed += 1
|
||||
|
||||
@@ -153,19 +153,17 @@ def pytest_ignore_collect(path, config):
|
||||
ignore_paths.extend([py.path.local(x) for x in excludeopt])
|
||||
return path in ignore_paths
|
||||
|
||||
class HookProxy(object):
|
||||
class FSHookProxy(object):
|
||||
def __init__(self, fspath, config):
|
||||
self.fspath = fspath
|
||||
self.config = config
|
||||
|
||||
def __getattr__(self, name):
|
||||
config = object.__getattribute__(self, "config")
|
||||
hookmethod = getattr(config.hook, name)
|
||||
plugins = self.config._getmatchingplugins(self.fspath)
|
||||
x = self.config.hook._getcaller(name, plugins)
|
||||
self.__dict__[name] = x
|
||||
return x
|
||||
|
||||
def call_matching_hooks(**kwargs):
|
||||
plugins = self.config._getmatchingplugins(self.fspath)
|
||||
return hookmethod.pcall(plugins, **kwargs)
|
||||
return call_matching_hooks
|
||||
|
||||
def compatproperty(name):
|
||||
def fget(self):
|
||||
@@ -459,9 +457,7 @@ class FSCollector(Collector):
|
||||
self.fspath = fspath
|
||||
|
||||
def _makeid(self):
|
||||
if self == self.session:
|
||||
return "."
|
||||
relpath = self.session.fspath.bestrelpath(self.fspath)
|
||||
relpath = self.fspath.relto(self.config.rootdir)
|
||||
if os.sep != "/":
|
||||
relpath = relpath.replace(os.sep, "/")
|
||||
return relpath
|
||||
@@ -512,7 +508,7 @@ class Session(FSCollector):
|
||||
__module__ = 'builtins' # for py3
|
||||
|
||||
def __init__(self, config):
|
||||
FSCollector.__init__(self, py.path.local(), parent=None,
|
||||
FSCollector.__init__(self, config.rootdir, parent=None,
|
||||
config=config, session=self)
|
||||
self.config.pluginmanager.register(self, name="session", prepend=True)
|
||||
self._testsfailed = 0
|
||||
@@ -520,6 +516,10 @@ class Session(FSCollector):
|
||||
self.trace = config.trace.root.get("collection")
|
||||
self._norecursepatterns = config.getini("norecursedirs")
|
||||
self.startdir = py.path.local()
|
||||
self._fs2hookproxy = {}
|
||||
|
||||
def _makeid(self):
|
||||
return ""
|
||||
|
||||
def pytest_collectstart(self):
|
||||
if self.shouldstop:
|
||||
@@ -538,7 +538,11 @@ class Session(FSCollector):
|
||||
return path in self._initialpaths
|
||||
|
||||
def gethookproxy(self, fspath):
|
||||
return HookProxy(fspath, self.config)
|
||||
try:
|
||||
return self._fs2hookproxy[fspath]
|
||||
except KeyError:
|
||||
self._fs2hookproxy[fspath] = x = FSHookProxy(fspath, self.config)
|
||||
return x
|
||||
|
||||
def perform_collect(self, args=None, genitems=True):
|
||||
hook = self.config.hook
|
||||
@@ -660,7 +664,7 @@ class Session(FSCollector):
|
||||
arg = self._tryconvertpyarg(arg)
|
||||
parts = str(arg).split("::")
|
||||
relpath = parts[0].replace("/", os.sep)
|
||||
path = self.fspath.join(relpath, abs=True)
|
||||
path = self.config.invocation_dir.join(relpath, abs=True)
|
||||
if not path.check():
|
||||
if self.config.option.pyargs:
|
||||
msg = "file or package not found: "
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
import py
|
||||
|
||||
|
||||
class MarkerError(Exception):
|
||||
|
||||
"""Error in use of a pytest marker/attribute."""
|
||||
|
||||
|
||||
def pytest_namespace():
|
||||
return {'mark': MarkGenerator()}
|
||||
|
||||
|
||||
@@ -66,14 +66,14 @@ class Notset:
|
||||
notset = Notset()
|
||||
|
||||
class monkeypatch:
|
||||
""" object keeping a record of setattr/item/env/syspath changes. """
|
||||
""" Object keeping a record of setattr/item/env/syspath changes. """
|
||||
def __init__(self):
|
||||
self._setattr = []
|
||||
self._setitem = []
|
||||
self._cwd = None
|
||||
|
||||
def setattr(self, target, name, value=notset, raising=True):
|
||||
""" set attribute value on target, memorizing the old value.
|
||||
""" Set attribute value on target, memorizing the old value.
|
||||
By default raise AttributeError if the attribute did not exist.
|
||||
|
||||
For convenience you can specify a string as ``target`` which
|
||||
@@ -108,15 +108,15 @@ class monkeypatch:
|
||||
setattr(target, name, value)
|
||||
|
||||
def delattr(self, target, name=notset, raising=True):
|
||||
""" delete attribute ``name`` from ``target``, by default raise
|
||||
""" Delete attribute ``name`` from ``target``, by default raise
|
||||
AttributeError it the attribute did not previously exist.
|
||||
|
||||
If no ``name`` is specified and ``target`` is a string
|
||||
it will be interpreted as a dotted import path with the
|
||||
last part being the attribute name.
|
||||
|
||||
If raising is set to false, the attribute is allowed to not
|
||||
pre-exist.
|
||||
If ``raising`` is set to False, no exception will be raised if the
|
||||
attribute is missing.
|
||||
"""
|
||||
__tracebackhide__ = True
|
||||
if name is notset:
|
||||
@@ -135,12 +135,16 @@ class monkeypatch:
|
||||
delattr(target, name)
|
||||
|
||||
def setitem(self, dic, name, value):
|
||||
""" set dictionary entry ``name`` to value. """
|
||||
""" Set dictionary entry ``name`` to value. """
|
||||
self._setitem.insert(0, (dic, name, dic.get(name, notset)))
|
||||
dic[name] = value
|
||||
|
||||
def delitem(self, dic, name, raising=True):
|
||||
""" delete ``name`` from dict, raise KeyError if it doesn't exist."""
|
||||
""" Delete ``name`` from dict. Raise KeyError if it doesn't exist.
|
||||
|
||||
If ``raising`` is set to False, no exception will be raised if the
|
||||
key is missing.
|
||||
"""
|
||||
if name not in dic:
|
||||
if raising:
|
||||
raise KeyError(name)
|
||||
@@ -149,7 +153,7 @@ class monkeypatch:
|
||||
del dic[name]
|
||||
|
||||
def setenv(self, name, value, prepend=None):
|
||||
""" set environment variable ``name`` to ``value``. if ``prepend``
|
||||
""" Set environment variable ``name`` to ``value``. If ``prepend``
|
||||
is a character, read the current environment variable value
|
||||
and prepend the ``value`` adjoined with the ``prepend`` character."""
|
||||
value = str(value)
|
||||
@@ -158,17 +162,22 @@ class monkeypatch:
|
||||
self.setitem(os.environ, name, value)
|
||||
|
||||
def delenv(self, name, raising=True):
|
||||
""" delete ``name`` from environment, raise KeyError it not exists."""
|
||||
""" Delete ``name`` from the environment. Raise KeyError it does not
|
||||
exist.
|
||||
|
||||
If ``raising`` is set to False, no exception will be raised if the
|
||||
environment variable is missing.
|
||||
"""
|
||||
self.delitem(os.environ, name, raising=raising)
|
||||
|
||||
def syspath_prepend(self, path):
|
||||
""" prepend ``path`` to ``sys.path`` list of import locations. """
|
||||
""" Prepend ``path`` to ``sys.path`` list of import locations. """
|
||||
if not hasattr(self, '_savesyspath'):
|
||||
self._savesyspath = sys.path[:]
|
||||
sys.path.insert(0, str(path))
|
||||
|
||||
def chdir(self, path):
|
||||
""" change the current working directory to the specified path
|
||||
""" Change the current working directory to the specified path
|
||||
path can be a string or a py.path.local object
|
||||
"""
|
||||
if self._cwd is None:
|
||||
@@ -179,9 +188,9 @@ class monkeypatch:
|
||||
os.chdir(path)
|
||||
|
||||
def undo(self):
|
||||
""" undo previous changes. This call consumes the
|
||||
undo stack. Calling it a second time has no effect unless
|
||||
you do more monkeypatching after the undo call."""
|
||||
""" Undo previous changes. This call consumes the
|
||||
undo stack. Calling it a second time has no effect unless
|
||||
you do more monkeypatching after the undo call."""
|
||||
for obj, name, value in self._setattr:
|
||||
if value is not notset:
|
||||
setattr(obj, name, value)
|
||||
|
||||
@@ -16,7 +16,7 @@ def get_skip_exceptions():
|
||||
return tuple(skip_classes)
|
||||
|
||||
|
||||
def pytest_runtest_makereport(__multicall__, item, call):
|
||||
def pytest_runtest_makereport(item, call):
|
||||
if call.excinfo and call.excinfo.errisinstance(get_skip_exceptions()):
|
||||
# let's substitute the excinfo with a pytest.skip one
|
||||
call2 = call.__class__(lambda:
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
""" submit failure or test session information to a pastebin service. """
|
||||
import pytest
|
||||
import py, sys
|
||||
import tempfile
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
@@ -9,17 +11,20 @@ def pytest_addoption(parser):
|
||||
choices=['failed', 'all'],
|
||||
help="send failed|all info to bpaste.net pastebin service.")
|
||||
|
||||
def pytest_configure(__multicall__, config):
|
||||
import tempfile
|
||||
__multicall__.execute()
|
||||
@pytest.mark.trylast
|
||||
def pytest_configure(config):
|
||||
if config.option.pastebin == "all":
|
||||
config._pastebinfile = tempfile.TemporaryFile('w+')
|
||||
tr = config.pluginmanager.getplugin('terminalreporter')
|
||||
oldwrite = tr._tw.write
|
||||
def tee_write(s, **kwargs):
|
||||
oldwrite(s, **kwargs)
|
||||
config._pastebinfile.write(str(s))
|
||||
tr._tw.write = tee_write
|
||||
# if no terminal reporter plugin is present, nothing we can do here;
|
||||
# this can happen when this function executes in a slave node
|
||||
# when using pytest-xdist, for example
|
||||
if tr is not None:
|
||||
config._pastebinfile = tempfile.TemporaryFile('w+')
|
||||
oldwrite = tr._tw.write
|
||||
def tee_write(s, **kwargs):
|
||||
oldwrite(s, **kwargs)
|
||||
config._pastebinfile.write(str(s))
|
||||
tr._tw.write = tee_write
|
||||
|
||||
def pytest_unconfigure(config):
|
||||
if hasattr(config, '_pastebinfile'):
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
""" (disabled by default) support for testing pytest and pytest plugins. """
|
||||
import inspect
|
||||
import sys
|
||||
import os
|
||||
import codecs
|
||||
@@ -12,7 +11,7 @@ import subprocess
|
||||
import py
|
||||
import pytest
|
||||
from py.builtin import print_
|
||||
from _pytest.core import HookRelay
|
||||
from _pytest.core import HookCaller, add_method_wrapper
|
||||
|
||||
from _pytest.main import Session, EXIT_OK
|
||||
|
||||
@@ -38,24 +37,10 @@ def pytest_configure(config):
|
||||
_pytest_fullpath = os.path.abspath(pytest.__file__.rstrip("oc"))
|
||||
_pytest_fullpath = _pytest_fullpath.replace("$py.class", ".py")
|
||||
|
||||
def pytest_funcarg___pytest(request):
|
||||
return PytestArg(request)
|
||||
|
||||
class PytestArg:
|
||||
def __init__(self, request):
|
||||
self.request = request
|
||||
|
||||
def gethookrecorder(self, hook):
|
||||
hookrecorder = HookRecorder(hook._pm)
|
||||
hookrecorder.start_recording(hook._hookspecs)
|
||||
self.request.addfinalizer(hookrecorder.finish_recording)
|
||||
return hookrecorder
|
||||
|
||||
class ParsedCall:
|
||||
def __init__(self, name, locals):
|
||||
assert '_name' not in locals
|
||||
self.__dict__.update(locals)
|
||||
self.__dict__.pop('self')
|
||||
def __init__(self, name, kwargs):
|
||||
self.__dict__.update(kwargs)
|
||||
self._name = name
|
||||
|
||||
def __repr__(self):
|
||||
@@ -63,68 +48,27 @@ class ParsedCall:
|
||||
del d['_name']
|
||||
return "<ParsedCall %r(**%r)>" %(self._name, d)
|
||||
|
||||
|
||||
class HookRecorder:
|
||||
def __init__(self, pluginmanager):
|
||||
self._pluginmanager = pluginmanager
|
||||
self.calls = []
|
||||
self._recorders = {}
|
||||
|
||||
def start_recording(self, hookspecs):
|
||||
if not isinstance(hookspecs, (list, tuple)):
|
||||
hookspecs = [hookspecs]
|
||||
for hookspec in hookspecs:
|
||||
assert hookspec not in self._recorders
|
||||
class RecordCalls:
|
||||
_recorder = self
|
||||
for name, method in vars(hookspec).items():
|
||||
if name[0] != "_":
|
||||
setattr(RecordCalls, name, self._makecallparser(method))
|
||||
recorder = RecordCalls()
|
||||
self._recorders[hookspec] = recorder
|
||||
self._pluginmanager.register(recorder)
|
||||
self.hook = HookRelay(hookspecs, pm=self._pluginmanager,
|
||||
prefix="pytest_")
|
||||
def _docall(hookcaller, methods, kwargs):
|
||||
self.calls.append(ParsedCall(hookcaller.name, kwargs))
|
||||
yield
|
||||
self._undo_wrapping = add_method_wrapper(HookCaller, _docall)
|
||||
pluginmanager.add_shutdown(self._undo_wrapping)
|
||||
|
||||
def finish_recording(self):
|
||||
for recorder in self._recorders.values():
|
||||
if self._pluginmanager.isregistered(recorder):
|
||||
self._pluginmanager.unregister(recorder)
|
||||
self._recorders.clear()
|
||||
|
||||
def _makecallparser(self, method):
|
||||
name = method.__name__
|
||||
args, varargs, varkw, default = inspect.getargspec(method)
|
||||
if not args or args[0] != "self":
|
||||
args.insert(0, 'self')
|
||||
fspec = inspect.formatargspec(args, varargs, varkw, default)
|
||||
# we use exec because we want to have early type
|
||||
# errors on wrong input arguments, using
|
||||
# *args/**kwargs delays this and gives errors
|
||||
# elsewhere
|
||||
exec (py.code.compile("""
|
||||
def %(name)s%(fspec)s:
|
||||
self._recorder.calls.append(
|
||||
ParsedCall(%(name)r, locals()))
|
||||
""" % locals()))
|
||||
return locals()[name]
|
||||
self._undo_wrapping()
|
||||
|
||||
def getcalls(self, names):
|
||||
if isinstance(names, str):
|
||||
names = names.split()
|
||||
for name in names:
|
||||
for cls in self._recorders:
|
||||
if name in vars(cls):
|
||||
break
|
||||
else:
|
||||
raise ValueError("callname %r not found in %r" %(
|
||||
name, self._recorders.keys()))
|
||||
l = []
|
||||
for call in self.calls:
|
||||
if call._name in names:
|
||||
l.append(call)
|
||||
return l
|
||||
return [call for call in self.calls if call._name in names]
|
||||
|
||||
def contains(self, entries):
|
||||
def assert_contains(self, entries):
|
||||
__tracebackhide__ = True
|
||||
i = 0
|
||||
entries = list(entries)
|
||||
@@ -160,6 +104,69 @@ class HookRecorder:
|
||||
assert len(l) == 1, (name, l)
|
||||
return l[0]
|
||||
|
||||
# functionality for test reports
|
||||
|
||||
def getreports(self,
|
||||
names="pytest_runtest_logreport pytest_collectreport"):
|
||||
return [x.report for x in self.getcalls(names)]
|
||||
|
||||
def matchreport(self, inamepart="",
|
||||
names="pytest_runtest_logreport pytest_collectreport", when=None):
|
||||
""" return a testreport whose dotted import path matches """
|
||||
l = []
|
||||
for rep in self.getreports(names=names):
|
||||
try:
|
||||
if not when and rep.when != "call" and rep.passed:
|
||||
# setup/teardown passing reports - let's ignore those
|
||||
continue
|
||||
except AttributeError:
|
||||
pass
|
||||
if when and getattr(rep, 'when', None) != when:
|
||||
continue
|
||||
if not inamepart or inamepart in rep.nodeid.split("::"):
|
||||
l.append(rep)
|
||||
if not l:
|
||||
raise ValueError("could not find test report matching %r: "
|
||||
"no test reports at all!" % (inamepart,))
|
||||
if len(l) > 1:
|
||||
raise ValueError(
|
||||
"found 2 or more testreports matching %r: %s" %(inamepart, l))
|
||||
return l[0]
|
||||
|
||||
def getfailures(self,
|
||||
names='pytest_runtest_logreport pytest_collectreport'):
|
||||
return [rep for rep in self.getreports(names) if rep.failed]
|
||||
|
||||
def getfailedcollections(self):
|
||||
return self.getfailures('pytest_collectreport')
|
||||
|
||||
def listoutcomes(self):
|
||||
passed = []
|
||||
skipped = []
|
||||
failed = []
|
||||
for rep in self.getreports(
|
||||
"pytest_collectreport pytest_runtest_logreport"):
|
||||
if rep.passed:
|
||||
if getattr(rep, "when", None) == "call":
|
||||
passed.append(rep)
|
||||
elif rep.skipped:
|
||||
skipped.append(rep)
|
||||
elif rep.failed:
|
||||
failed.append(rep)
|
||||
return passed, skipped, failed
|
||||
|
||||
def countoutcomes(self):
|
||||
return [len(x) for x in self.listoutcomes()]
|
||||
|
||||
def assertoutcome(self, passed=0, skipped=0, failed=0):
|
||||
realpassed, realskipped, realfailed = self.listoutcomes()
|
||||
assert passed == len(realpassed)
|
||||
assert skipped == len(realskipped)
|
||||
assert failed == len(realfailed)
|
||||
|
||||
def clear(self):
|
||||
self.calls[:] = []
|
||||
|
||||
|
||||
def pytest_funcarg__linecomp(request):
|
||||
return LineComp()
|
||||
@@ -195,7 +202,6 @@ class TmpTestdir:
|
||||
def __init__(self, request):
|
||||
self.request = request
|
||||
self.Config = request.config.__class__
|
||||
self._pytest = request.getfuncargvalue("_pytest")
|
||||
# XXX remove duplication with tmpdir plugin
|
||||
basetmp = request.config._tmpdirhandler.ensuretemp("testdir")
|
||||
name = request.function.__name__
|
||||
@@ -226,15 +232,10 @@ class TmpTestdir:
|
||||
if fn and fn.startswith(str(self.tmpdir)):
|
||||
del sys.modules[name]
|
||||
|
||||
def getreportrecorder(self, obj):
|
||||
if hasattr(obj, 'config'):
|
||||
obj = obj.config
|
||||
if hasattr(obj, 'hook'):
|
||||
obj = obj.hook
|
||||
assert hasattr(obj, '_hookspecs'), obj
|
||||
reprec = ReportRecorder(obj)
|
||||
reprec.hookrecorder = self._pytest.gethookrecorder(obj)
|
||||
reprec.hook = reprec.hookrecorder.hook
|
||||
def make_hook_recorder(self, pluginmanager):
|
||||
assert not hasattr(pluginmanager, "reprec")
|
||||
pluginmanager.reprec = reprec = HookRecorder(pluginmanager)
|
||||
self.request.addfinalizer(reprec.finish_recording)
|
||||
return reprec
|
||||
|
||||
def chdir(self):
|
||||
@@ -305,9 +306,8 @@ class TmpTestdir:
|
||||
session = Session(config)
|
||||
assert '::' not in str(arg)
|
||||
p = py.path.local(arg)
|
||||
x = session.fspath.bestrelpath(p)
|
||||
config.hook.pytest_sessionstart(session=session)
|
||||
res = session.perform_collect([x], genitems=False)[0]
|
||||
res = session.perform_collect([str(p)], genitems=False)[0]
|
||||
config.hook.pytest_sessionfinish(session=session, exitstatus=EXIT_OK)
|
||||
return res
|
||||
|
||||
@@ -353,26 +353,23 @@ class TmpTestdir:
|
||||
def inline_genitems(self, *args):
|
||||
return self.inprocess_run(list(args) + ['--collectonly'])
|
||||
|
||||
def inline_run(self, *args):
|
||||
items, rec = self.inprocess_run(args)
|
||||
return rec
|
||||
def inprocess_run(self, args, plugins=()):
|
||||
rec = self.inline_run(*args, plugins=plugins)
|
||||
items = [x.item for x in rec.getcalls("pytest_itemcollected")]
|
||||
return items, rec
|
||||
|
||||
def inprocess_run(self, args, plugins=None):
|
||||
def inline_run(self, *args, **kwargs):
|
||||
rec = []
|
||||
items = []
|
||||
class Collect:
|
||||
def pytest_configure(x, config):
|
||||
rec.append(self.getreportrecorder(config))
|
||||
def pytest_itemcollected(self, item):
|
||||
items.append(item)
|
||||
if not plugins:
|
||||
plugins = []
|
||||
rec.append(self.make_hook_recorder(config.pluginmanager))
|
||||
plugins = kwargs.get("plugins") or []
|
||||
plugins.append(Collect())
|
||||
ret = pytest.main(list(args), plugins=plugins)
|
||||
assert len(rec) == 1
|
||||
reprec = rec[0]
|
||||
reprec.ret = ret
|
||||
assert len(rec) == 1
|
||||
return items, reprec
|
||||
return reprec
|
||||
|
||||
def parseconfig(self, *args):
|
||||
args = [str(x) for x in args]
|
||||
@@ -397,8 +394,7 @@ class TmpTestdir:
|
||||
def parseconfigure(self, *args):
|
||||
config = self.parseconfig(*args)
|
||||
config.do_configure()
|
||||
self.request.addfinalizer(lambda:
|
||||
config.do_unconfigure())
|
||||
self.request.addfinalizer(config.do_unconfigure)
|
||||
return config
|
||||
|
||||
def getitem(self, source, funcname="test_func"):
|
||||
@@ -547,86 +543,6 @@ def getdecoded(out):
|
||||
return "INTERNAL not-utf8-decodeable, truncated string:\n%s" % (
|
||||
py.io.saferepr(out),)
|
||||
|
||||
class ReportRecorder(object):
|
||||
def __init__(self, hook):
|
||||
self.hook = hook
|
||||
self.pluginmanager = hook._pm
|
||||
self.pluginmanager.register(self)
|
||||
|
||||
def getcall(self, name):
|
||||
return self.hookrecorder.getcall(name)
|
||||
|
||||
def popcall(self, name):
|
||||
return self.hookrecorder.popcall(name)
|
||||
|
||||
def getcalls(self, names):
|
||||
""" return list of ParsedCall instances matching the given eventname. """
|
||||
return self.hookrecorder.getcalls(names)
|
||||
|
||||
# functionality for test reports
|
||||
|
||||
def getreports(self, names="pytest_runtest_logreport pytest_collectreport"):
|
||||
return [x.report for x in self.getcalls(names)]
|
||||
|
||||
def matchreport(self, inamepart="",
|
||||
names="pytest_runtest_logreport pytest_collectreport", when=None):
|
||||
""" return a testreport whose dotted import path matches """
|
||||
l = []
|
||||
for rep in self.getreports(names=names):
|
||||
try:
|
||||
if not when and rep.when != "call" and rep.passed:
|
||||
# setup/teardown passing reports - let's ignore those
|
||||
continue
|
||||
except AttributeError:
|
||||
pass
|
||||
if when and getattr(rep, 'when', None) != when:
|
||||
continue
|
||||
if not inamepart or inamepart in rep.nodeid.split("::"):
|
||||
l.append(rep)
|
||||
if not l:
|
||||
raise ValueError("could not find test report matching %r: no test reports at all!" %
|
||||
(inamepart,))
|
||||
if len(l) > 1:
|
||||
raise ValueError("found more than one testreport matching %r: %s" %(
|
||||
inamepart, l))
|
||||
return l[0]
|
||||
|
||||
def getfailures(self, names='pytest_runtest_logreport pytest_collectreport'):
|
||||
return [rep for rep in self.getreports(names) if rep.failed]
|
||||
|
||||
def getfailedcollections(self):
|
||||
return self.getfailures('pytest_collectreport')
|
||||
|
||||
def listoutcomes(self):
|
||||
passed = []
|
||||
skipped = []
|
||||
failed = []
|
||||
for rep in self.getreports(
|
||||
"pytest_collectreport pytest_runtest_logreport"):
|
||||
if rep.passed:
|
||||
if getattr(rep, "when", None) == "call":
|
||||
passed.append(rep)
|
||||
elif rep.skipped:
|
||||
skipped.append(rep)
|
||||
elif rep.failed:
|
||||
failed.append(rep)
|
||||
return passed, skipped, failed
|
||||
|
||||
def countoutcomes(self):
|
||||
return [len(x) for x in self.listoutcomes()]
|
||||
|
||||
def assertoutcome(self, passed=0, skipped=0, failed=0):
|
||||
realpassed, realskipped, realfailed = self.listoutcomes()
|
||||
assert passed == len(realpassed)
|
||||
assert skipped == len(realskipped)
|
||||
assert failed == len(realfailed)
|
||||
|
||||
def clear(self):
|
||||
self.hookrecorder.calls[:] = []
|
||||
|
||||
def unregister(self):
|
||||
self.pluginmanager.unregister(self)
|
||||
self.hookrecorder.finish_recording()
|
||||
|
||||
class LineComp:
|
||||
def __init__(self):
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
""" Python test discovery, setup and run of test functions. """
|
||||
import fnmatch
|
||||
import py
|
||||
import inspect
|
||||
import sys
|
||||
import pytest
|
||||
from _pytest.mark import MarkDecorator
|
||||
from _pytest.mark import MarkDecorator, MarkerError
|
||||
from py._code.code import TerminalRepr
|
||||
|
||||
import _pytest
|
||||
@@ -14,6 +15,8 @@ NOTSET = object()
|
||||
isfunction = inspect.isfunction
|
||||
isclass = inspect.isclass
|
||||
callable = py.builtin.callable
|
||||
# used to work around a python2 exception info leak
|
||||
exc_clear = getattr(sys, 'exc_clear', lambda: None)
|
||||
|
||||
def getfslineno(obj):
|
||||
# xxx let decorators etc specify a sane ordering
|
||||
@@ -127,9 +130,10 @@ def pytest_addoption(parser):
|
||||
default=['test_*.py', '*_test.py'],
|
||||
help="glob-style file patterns for Python test module discovery")
|
||||
parser.addini("python_classes", type="args", default=["Test",],
|
||||
help="prefixes for Python test class discovery")
|
||||
help="prefixes or glob names for Python test class discovery")
|
||||
parser.addini("python_functions", type="args", default=["test",],
|
||||
help="prefixes for Python test function and method discovery")
|
||||
help="prefixes or glob names for Python test function and "
|
||||
"method discovery")
|
||||
|
||||
def pytest_cmdline_main(config):
|
||||
if config.option.showfixtures:
|
||||
@@ -138,6 +142,10 @@ def pytest_cmdline_main(config):
|
||||
|
||||
|
||||
def pytest_generate_tests(metafunc):
|
||||
# this misspelling is common - raise a specific error to alert the user
|
||||
if hasattr(metafunc.function, 'parameterize'):
|
||||
msg = "{0} has 'parameterize', spelling should be 'parametrize'"
|
||||
raise MarkerError(msg.format(metafunc.function.__name__))
|
||||
try:
|
||||
markers = metafunc.function.parametrize
|
||||
except AttributeError:
|
||||
@@ -183,17 +191,18 @@ def pytestconfig(request):
|
||||
return request.config
|
||||
|
||||
|
||||
def pytest_pyfunc_call(__multicall__, pyfuncitem):
|
||||
if not __multicall__.execute():
|
||||
testfunction = pyfuncitem.obj
|
||||
if pyfuncitem._isyieldedfunction():
|
||||
testfunction(*pyfuncitem._args)
|
||||
else:
|
||||
funcargs = pyfuncitem.funcargs
|
||||
testargs = {}
|
||||
for arg in pyfuncitem._fixtureinfo.argnames:
|
||||
testargs[arg] = funcargs[arg]
|
||||
testfunction(**testargs)
|
||||
@pytest.mark.trylast
|
||||
def pytest_pyfunc_call(pyfuncitem):
|
||||
testfunction = pyfuncitem.obj
|
||||
if pyfuncitem._isyieldedfunction():
|
||||
testfunction(*pyfuncitem._args)
|
||||
else:
|
||||
funcargs = pyfuncitem.funcargs
|
||||
testargs = {}
|
||||
for arg in pyfuncitem._fixtureinfo.argnames:
|
||||
testargs[arg] = funcargs[arg]
|
||||
testfunction(**testargs)
|
||||
return True
|
||||
|
||||
def pytest_collect_file(path, parent):
|
||||
ext = path.ext
|
||||
@@ -210,30 +219,31 @@ def pytest_collect_file(path, parent):
|
||||
def pytest_pycollect_makemodule(path, parent):
|
||||
return Module(path, parent)
|
||||
|
||||
def pytest_pycollect_makeitem(__multicall__, collector, name, obj):
|
||||
res = __multicall__.execute()
|
||||
@pytest.mark.hookwrapper
|
||||
def pytest_pycollect_makeitem(collector, name, obj):
|
||||
outcome = yield
|
||||
res = outcome.get_result()
|
||||
if res is not None:
|
||||
return res
|
||||
raise StopIteration
|
||||
# nothing was collected elsewhere, let's do it here
|
||||
if isclass(obj):
|
||||
#if hasattr(collector.obj, 'unittest'):
|
||||
# return # we assume it's a mixin class for a TestCase derived one
|
||||
if collector.classnamefilter(name):
|
||||
Class = collector._getcustomclass("Class")
|
||||
return Class(name, parent=collector)
|
||||
elif collector.funcnamefilter(name) and hasattr(obj, "__call__") and \
|
||||
outcome.force_result(Class(name, parent=collector))
|
||||
elif collector.funcnamefilter(name) and hasattr(obj, "__call__") and\
|
||||
getfixturemarker(obj) is None:
|
||||
# mock seems to store unbound methods (issue473), let's normalize it
|
||||
# mock seems to store unbound methods (issue473), normalize it
|
||||
obj = getattr(obj, "__func__", obj)
|
||||
if not isfunction(obj):
|
||||
collector.warn(code="C2", message=
|
||||
"cannot collect %r because it is not a function."
|
||||
% name, )
|
||||
return
|
||||
if getattr(obj, "__test__", True):
|
||||
if is_generator(obj):
|
||||
return Generator(name, parent=collector)
|
||||
res = Generator(name, parent=collector)
|
||||
else:
|
||||
return list(collector._genfunctions(name, obj))
|
||||
res = list(collector._genfunctions(name, obj))
|
||||
outcome.force_result(res)
|
||||
|
||||
def is_generator(func):
|
||||
try:
|
||||
@@ -305,14 +315,26 @@ class PyobjMixin(PyobjContext):
|
||||
class PyCollector(PyobjMixin, pytest.Collector):
|
||||
|
||||
def funcnamefilter(self, name):
|
||||
for prefix in self.config.getini("python_functions"):
|
||||
if name.startswith(prefix):
|
||||
return True
|
||||
return self._matches_prefix_or_glob_option('python_functions', name)
|
||||
|
||||
def classnamefilter(self, name):
|
||||
for prefix in self.config.getini("python_classes"):
|
||||
if name.startswith(prefix):
|
||||
return self._matches_prefix_or_glob_option('python_classes', name)
|
||||
|
||||
def _matches_prefix_or_glob_option(self, option_name, name):
|
||||
"""
|
||||
checks if the given name matches the prefix or glob-pattern defined
|
||||
in ini configuration.
|
||||
"""
|
||||
for option in self.config.getini(option_name):
|
||||
if name.startswith(option):
|
||||
return True
|
||||
# check that name looks like a glob-string before calling fnmatch
|
||||
# because this is called for every name in each collected module,
|
||||
# and fnmatch is somewhat expensive to call
|
||||
elif ('*' in option or '?' in option or '[' in option) and \
|
||||
fnmatch.fnmatch(name, option):
|
||||
return True
|
||||
return False
|
||||
|
||||
def collect(self):
|
||||
if not getattr(self.obj, "__test__", True):
|
||||
@@ -353,15 +375,17 @@ class PyCollector(PyobjMixin, pytest.Collector):
|
||||
fixtureinfo = fm.getfixtureinfo(self, funcobj, cls)
|
||||
metafunc = Metafunc(funcobj, fixtureinfo, self.config,
|
||||
cls=cls, module=module)
|
||||
gentesthook = self.config.hook.pytest_generate_tests
|
||||
extra = [module]
|
||||
if cls is not None:
|
||||
extra.append(cls())
|
||||
plugins = self.getplugins() + extra
|
||||
gentesthook.pcall(plugins, metafunc=metafunc)
|
||||
try:
|
||||
methods = [module.pytest_generate_tests]
|
||||
except AttributeError:
|
||||
methods = []
|
||||
if hasattr(cls, "pytest_generate_tests"):
|
||||
methods.append(cls().pytest_generate_tests)
|
||||
self.ihook.pytest_generate_tests.callextra(methods, metafunc=metafunc)
|
||||
|
||||
Function = self._getcustomclass("Function")
|
||||
if not metafunc._calls:
|
||||
yield Function(name, parent=self)
|
||||
yield Function(name, parent=self, fixtureinfo=fixtureinfo)
|
||||
else:
|
||||
# add funcargs() as fixturedefs to fixtureinfo.arg2fixturedefs
|
||||
add_funcarg_pseudo_fixture_def(self, metafunc, fm)
|
||||
@@ -370,6 +394,7 @@ class PyCollector(PyobjMixin, pytest.Collector):
|
||||
subname = "%s[%s]" %(name, callspec.id)
|
||||
yield Function(name=subname, parent=self,
|
||||
callspec=callspec, callobj=funcobj,
|
||||
fixtureinfo=fixtureinfo,
|
||||
keywords={callspec.id:True})
|
||||
|
||||
def add_funcarg_pseudo_fixture_def(collector, metafunc, fixturemanager):
|
||||
@@ -753,7 +778,6 @@ class Metafunc(FuncargnamesCompatAttr):
|
||||
self.fixturenames = fixtureinfo.names_closure
|
||||
self._arg2fixturedefs = fixtureinfo.name2fixturedefs
|
||||
self.cls = cls
|
||||
self.module = module
|
||||
self._calls = []
|
||||
self._ids = py.builtin.set()
|
||||
|
||||
@@ -779,9 +803,14 @@ class Metafunc(FuncargnamesCompatAttr):
|
||||
function so that it can perform more expensive setups during the
|
||||
setup phase of a test rather than at collection time.
|
||||
|
||||
:arg ids: list of string ids each corresponding to the argvalues so
|
||||
that they are part of the test id. If no ids are provided they will
|
||||
be generated automatically from the argvalues.
|
||||
:arg ids: list of string ids, or a callable.
|
||||
If strings, each is corresponding to the argvalues so that they are
|
||||
part of the test id.
|
||||
If callable, it should take one argument (a single argvalue) and return
|
||||
a string or return None. If None, the automatically generated id for that
|
||||
argument will be used.
|
||||
If no ids are provided they will be generated automatically from
|
||||
the argvalues.
|
||||
|
||||
:arg scope: if specified it denotes the scope of the parameters.
|
||||
The scope is used for grouping tests by parameter instances.
|
||||
@@ -821,11 +850,15 @@ class Metafunc(FuncargnamesCompatAttr):
|
||||
raise ValueError("%r uses no fixture %r" %(
|
||||
self.function, arg))
|
||||
valtype = indirect and "params" or "funcargs"
|
||||
idfn = None
|
||||
if callable(ids):
|
||||
idfn = ids
|
||||
ids = None
|
||||
if ids and len(ids) != len(argvalues):
|
||||
raise ValueError('%d tests specified with %d ids' %(
|
||||
len(argvalues), len(ids)))
|
||||
if not ids:
|
||||
ids = idmaker(argnames, argvalues)
|
||||
ids = idmaker(argnames, argvalues, idfn)
|
||||
newcalls = []
|
||||
for callspec in self._calls or [CallSpec2(self)]:
|
||||
for param_index, valset in enumerate(argvalues):
|
||||
@@ -873,17 +906,31 @@ class Metafunc(FuncargnamesCompatAttr):
|
||||
cs.setall(funcargs, id, param)
|
||||
self._calls.append(cs)
|
||||
|
||||
def idmaker(argnames, argvalues):
|
||||
idlist = []
|
||||
for valindex, valset in enumerate(argvalues):
|
||||
this_id = []
|
||||
for nameindex, val in enumerate(valset):
|
||||
if not isinstance(val, (float, int, str, bool, NoneType)):
|
||||
this_id.append(str(argnames[nameindex])+str(valindex))
|
||||
else:
|
||||
this_id.append(str(val))
|
||||
idlist.append("-".join(this_id))
|
||||
return idlist
|
||||
|
||||
def _idval(val, argname, idx, idfn):
|
||||
if idfn:
|
||||
try:
|
||||
s = idfn(val)
|
||||
if s:
|
||||
return s
|
||||
except Exception:
|
||||
pass
|
||||
if isinstance(val, (float, int, str, bool, NoneType)):
|
||||
return str(val)
|
||||
return str(argname)+str(idx)
|
||||
|
||||
def _idvalset(idx, valset, argnames, idfn):
|
||||
this_id = [_idval(val, argname, idx, idfn)
|
||||
for val, argname in zip(valset, argnames)]
|
||||
return "-".join(this_id)
|
||||
|
||||
def idmaker(argnames, argvalues, idfn=None):
|
||||
ids = [_idvalset(valindex, valset, argnames, idfn)
|
||||
for valindex, valset in enumerate(argvalues)]
|
||||
if len(set(ids)) < len(ids):
|
||||
# user may have provided a bad idfn which means the ids are not unique
|
||||
ids = [str(i) + testid for i, testid in enumerate(ids)]
|
||||
return ids
|
||||
|
||||
def showfixtures(config):
|
||||
from _pytest.main import wrap_session
|
||||
@@ -935,7 +982,7 @@ def _showfixtures_main(config, session):
|
||||
loc = getlocation(fixturedef.func, curdir)
|
||||
doc = fixturedef.func.__doc__ or ""
|
||||
if doc:
|
||||
for line in doc.split("\n"):
|
||||
for line in doc.strip().split("\n"):
|
||||
tw.line(" " + line.strip())
|
||||
else:
|
||||
tw.line(" %s: no docstring available" %(loc,),
|
||||
@@ -1003,7 +1050,7 @@ def raises(ExpectedException, *args, **kwargs):
|
||||
if ExpectedException is AssertionError:
|
||||
# we want to catch a AssertionError
|
||||
# replace our subclass with the builtin one
|
||||
# see https://bitbucket.org/hpk42/pytest/issue/176/pytestraises
|
||||
# see https://bitbucket.org/pytest-dev/pytest/issue/176/pytestraises
|
||||
from _pytest.assertion.util import BuiltinAssertionError \
|
||||
as ExpectedException
|
||||
msg = ("exceptions must be old-style classes or"
|
||||
@@ -1065,28 +1112,27 @@ class Function(FunctionMixin, pytest.Item, FuncargnamesCompatAttr):
|
||||
"""
|
||||
_genid = None
|
||||
def __init__(self, name, parent, args=None, config=None,
|
||||
callspec=None, callobj=NOTSET, keywords=None, session=None):
|
||||
callspec=None, callobj=NOTSET, keywords=None, session=None,
|
||||
fixtureinfo=None):
|
||||
super(Function, self).__init__(name, parent, config=config,
|
||||
session=session)
|
||||
self._args = args
|
||||
if callobj is not NOTSET:
|
||||
self.obj = callobj
|
||||
|
||||
for name, val in (py.builtin._getfuncdict(self.obj) or {}).items():
|
||||
self.keywords[name] = val
|
||||
self.keywords.update(self.obj.__dict__)
|
||||
if callspec:
|
||||
for name, val in callspec.keywords.items():
|
||||
self.keywords[name] = val
|
||||
if keywords:
|
||||
for name, val in keywords.items():
|
||||
self.keywords[name] = val
|
||||
|
||||
isyield = self._isyieldedfunction()
|
||||
self._fixtureinfo = fi = self.session._fixturemanager.getfixtureinfo(
|
||||
self.parent, self.obj, self.cls, funcargs=not isyield)
|
||||
self.fixturenames = fi.names_closure
|
||||
if callspec is not None:
|
||||
self.callspec = callspec
|
||||
self.keywords.update(callspec.keywords)
|
||||
if keywords:
|
||||
self.keywords.update(keywords)
|
||||
|
||||
if fixtureinfo is None:
|
||||
fixtureinfo = self.session._fixturemanager.getfixtureinfo(
|
||||
self.parent, self.obj, self.cls,
|
||||
funcargs=not self._isyieldedfunction())
|
||||
self._fixtureinfo = fixtureinfo
|
||||
self.fixturenames = fixtureinfo.names_closure
|
||||
self._initrequest()
|
||||
|
||||
def _initrequest(self):
|
||||
@@ -1348,10 +1394,12 @@ class FixtureRequest(FuncargnamesCompatAttr):
|
||||
cached_result = (self, [0], None)
|
||||
return PseudoFixtureDef
|
||||
raise
|
||||
result = self._getfuncargvalue(fixturedef)
|
||||
self._funcargs[argname] = result
|
||||
self._fixturedefs[argname] = fixturedef
|
||||
return fixturedef
|
||||
# remove indent to prevent the python3 exception
|
||||
# from leaking into the call
|
||||
result = self._getfuncargvalue(fixturedef)
|
||||
self._funcargs[argname] = result
|
||||
self._fixturedefs[argname] = fixturedef
|
||||
return fixturedef
|
||||
|
||||
def _get_fixturestack(self):
|
||||
current = self
|
||||
@@ -1398,6 +1446,9 @@ class FixtureRequest(FuncargnamesCompatAttr):
|
||||
(scope, argname, self.scope, "\n".join(lines))))
|
||||
__tracebackhide__ = False
|
||||
|
||||
# clear sys.exc_info before invoking the fixture (python bug?)
|
||||
# if its not explicitly cleared it will leak into the call
|
||||
exc_clear()
|
||||
try:
|
||||
# call the fixture function
|
||||
val = fixturedef.execute(request=subrequest)
|
||||
@@ -1571,15 +1622,8 @@ class FixtureManager:
|
||||
self._nodeid_and_autousenames = [("", self.config.getini("usefixtures"))]
|
||||
session.config.pluginmanager.register(self, "funcmanage")
|
||||
|
||||
self._nodename2fixtureinfo = {}
|
||||
|
||||
def getfixtureinfo(self, node, func, cls, funcargs=True):
|
||||
# node is the "collection node" for "func"
|
||||
key = (node, func)
|
||||
try:
|
||||
return self._nodename2fixtureinfo[key]
|
||||
except KeyError:
|
||||
pass
|
||||
if funcargs and not hasattr(node, "nofuncargs"):
|
||||
if cls is not None:
|
||||
startindex = 1
|
||||
@@ -1595,10 +1639,7 @@ class FixtureManager:
|
||||
fm = node.session._fixturemanager
|
||||
names_closure, arg2fixturedefs = fm.getfixtureclosure(initialnames,
|
||||
node)
|
||||
fixtureinfo = FuncFixtureInfo(argnames, names_closure,
|
||||
arg2fixturedefs)
|
||||
self._nodename2fixtureinfo[key] = fixtureinfo
|
||||
return fixtureinfo
|
||||
return FuncFixtureInfo(argnames, names_closure, arg2fixturedefs)
|
||||
|
||||
### XXX this hook should be called for historic events like pytest_configure
|
||||
### so that we don't have to do the below pytest_configure hook
|
||||
@@ -1615,11 +1656,9 @@ class FixtureManager:
|
||||
# what fixtures are visible for particular tests (as denoted
|
||||
# by their test id)
|
||||
if p.basename.startswith("conftest.py"):
|
||||
nodeid = self.session.fspath.bestrelpath(p.dirpath())
|
||||
nodeid = p.dirpath().relto(self.config.rootdir)
|
||||
if p.sep != "/":
|
||||
nodeid = nodeid.replace(p.sep, "/")
|
||||
if nodeid == ".":
|
||||
nodeid = ""
|
||||
self.parsefactories(plugin, nodeid)
|
||||
self._seenplugins.add(plugin)
|
||||
|
||||
@@ -1676,13 +1715,17 @@ class FixtureManager:
|
||||
def pytest_generate_tests(self, metafunc):
|
||||
for argname in metafunc.fixturenames:
|
||||
faclist = metafunc._arg2fixturedefs.get(argname)
|
||||
if faclist is None:
|
||||
continue # will raise FixtureLookupError at setup time
|
||||
for fixturedef in faclist:
|
||||
if faclist:
|
||||
fixturedef = faclist[-1]
|
||||
if fixturedef.params is not None:
|
||||
metafunc.parametrize(argname, fixturedef.params,
|
||||
indirect=True, scope=fixturedef.scope,
|
||||
ids=fixturedef.ids)
|
||||
func_params = getattr(getattr(metafunc.function, 'parametrize', None), 'args', [[None]])
|
||||
# skip directly parametrized arguments
|
||||
if argname not in func_params and argname not in func_params[0]:
|
||||
metafunc.parametrize(argname, fixturedef.params,
|
||||
indirect=True, scope=fixturedef.scope,
|
||||
ids=fixturedef.ids)
|
||||
else:
|
||||
continue # will raise FixtureLookupError at setup time
|
||||
|
||||
def pytest_collection_modifyitems(self, items):
|
||||
# separate parametrized setups
|
||||
|
||||
@@ -86,7 +86,17 @@ def pytest_runtest_setup(item):
|
||||
item.session._setupstate.prepare(item)
|
||||
|
||||
def pytest_runtest_call(item):
|
||||
item.runtest()
|
||||
try:
|
||||
item.runtest()
|
||||
except Exception:
|
||||
# Store trace info to allow postmortem debugging
|
||||
type, value, tb = sys.exc_info()
|
||||
tb = tb.tb_next # Skip *this* frame
|
||||
sys.last_type = type
|
||||
sys.last_value = value
|
||||
sys.last_traceback = tb
|
||||
del tb # Get rid of it in this namespace
|
||||
raise
|
||||
|
||||
def pytest_runtest_teardown(item, nextitem):
|
||||
item.session._setupstate.teardown_exact(item, nextitem)
|
||||
|
||||
@@ -57,7 +57,7 @@ class MarkEvaluator:
|
||||
|
||||
@property
|
||||
def holder(self):
|
||||
return self.item.keywords.get(self.name, None)
|
||||
return self.item.keywords.get(self.name)
|
||||
|
||||
def __bool__(self):
|
||||
return bool(self.holder)
|
||||
@@ -75,9 +75,7 @@ class MarkEvaluator:
|
||||
def istrue(self):
|
||||
try:
|
||||
return self._istrue()
|
||||
except KeyboardInterrupt:
|
||||
raise
|
||||
except:
|
||||
except Exception:
|
||||
self.exc = sys.exc_info()
|
||||
if isinstance(self.exc[1], SyntaxError):
|
||||
msg = [" " * (self.exc[1].offset + 4) + "^",]
|
||||
@@ -153,44 +151,32 @@ def check_xfail_no_run(item):
|
||||
if not evalxfail.get('run', True):
|
||||
pytest.xfail("[NOTRUN] " + evalxfail.getexplanation())
|
||||
|
||||
def pytest_runtest_makereport(__multicall__, item, call):
|
||||
@pytest.mark.hookwrapper
|
||||
def pytest_runtest_makereport(item, call):
|
||||
outcome = yield
|
||||
rep = outcome.get_result()
|
||||
evalxfail = getattr(item, '_evalxfail', None)
|
||||
# unitttest special case, see setting of _unexpectedsuccess
|
||||
if hasattr(item, '_unexpectedsuccess'):
|
||||
rep = __multicall__.execute()
|
||||
if rep.when == "call":
|
||||
# we need to translate into how pytest encodes xpass
|
||||
rep.wasxfail = "reason: " + repr(item._unexpectedsuccess)
|
||||
rep.outcome = "failed"
|
||||
return rep
|
||||
if not (call.excinfo and
|
||||
call.excinfo.errisinstance(pytest.xfail.Exception)):
|
||||
evalxfail = getattr(item, '_evalxfail', None)
|
||||
if not evalxfail:
|
||||
return
|
||||
if call.excinfo and call.excinfo.errisinstance(pytest.xfail.Exception):
|
||||
if not item.config.getvalue("runxfail"):
|
||||
rep = __multicall__.execute()
|
||||
rep.wasxfail = "reason: " + call.excinfo.value.msg
|
||||
rep.outcome = "skipped"
|
||||
return rep
|
||||
rep = __multicall__.execute()
|
||||
evalxfail = item._evalxfail
|
||||
if not rep.skipped:
|
||||
if not item.config.option.runxfail:
|
||||
if evalxfail.wasvalid() and evalxfail.istrue():
|
||||
if call.excinfo:
|
||||
if evalxfail.invalidraise(call.excinfo.value):
|
||||
rep.outcome = "failed"
|
||||
return rep
|
||||
else:
|
||||
rep.outcome = "skipped"
|
||||
elif call.when == "call":
|
||||
rep.outcome = "failed"
|
||||
else:
|
||||
return rep
|
||||
if hasattr(item, '_unexpectedsuccess') and rep.when == "call":
|
||||
# we need to translate into how pytest encodes xpass
|
||||
rep.wasxfail = "reason: " + repr(item._unexpectedsuccess)
|
||||
rep.outcome = "failed"
|
||||
elif item.config.option.runxfail:
|
||||
pass # don't interefere
|
||||
elif call.excinfo and call.excinfo.errisinstance(pytest.xfail.Exception):
|
||||
rep.wasxfail = "reason: " + call.excinfo.value.msg
|
||||
rep.outcome = "skipped"
|
||||
elif evalxfail and not rep.skipped and evalxfail.wasvalid() and \
|
||||
evalxfail.istrue():
|
||||
if call.excinfo:
|
||||
if evalxfail.invalidraise(call.excinfo.value):
|
||||
rep.outcome = "failed"
|
||||
else:
|
||||
rep.outcome = "skipped"
|
||||
rep.wasxfail = evalxfail.getexplanation()
|
||||
return rep
|
||||
return rep
|
||||
elif call.when == "call":
|
||||
rep.outcome = "failed" # xpass outcome
|
||||
rep.wasxfail = evalxfail.getexplanation()
|
||||
|
||||
# called by terminalreporter progress reporting
|
||||
def pytest_report_teststatus(report):
|
||||
@@ -232,14 +218,14 @@ def show_simple(terminalreporter, lines, stat, format):
|
||||
failed = terminalreporter.stats.get(stat)
|
||||
if failed:
|
||||
for rep in failed:
|
||||
pos = rep.nodeid
|
||||
lines.append(format %(pos, ))
|
||||
pos = terminalreporter.config.cwd_relative_nodeid(rep.nodeid)
|
||||
lines.append(format %(pos,))
|
||||
|
||||
def show_xfailed(terminalreporter, lines):
|
||||
xfailed = terminalreporter.stats.get("xfailed")
|
||||
if xfailed:
|
||||
for rep in xfailed:
|
||||
pos = rep.nodeid
|
||||
pos = terminalreporter.config.cwd_relative_nodeid(rep.nodeid)
|
||||
reason = rep.wasxfail
|
||||
lines.append("XFAIL %s" % (pos,))
|
||||
if reason:
|
||||
@@ -249,7 +235,7 @@ def show_xpassed(terminalreporter, lines):
|
||||
xpassed = terminalreporter.stats.get("xpassed")
|
||||
if xpassed:
|
||||
for rep in xpassed:
|
||||
pos = rep.nodeid
|
||||
pos = terminalreporter.config.cwd_relative_nodeid(rep.nodeid)
|
||||
reason = rep.wasxfail
|
||||
lines.append("XPASS %s %s" %(pos, reason))
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ def pytest_addoption(parser):
|
||||
group._addoption('--tb', metavar="style",
|
||||
action="store", dest="tbstyle", default='auto',
|
||||
choices=['auto', 'long', 'short', 'no', 'line', 'native'],
|
||||
help="traceback print mode (long/short/line/native/no).")
|
||||
help="traceback print mode (auto/long/short/line/native/no).")
|
||||
group._addoption('--fulltrace', '--full-trace',
|
||||
action="store_true", default=False,
|
||||
help="don't cut any tracebacks (default is to cut).")
|
||||
@@ -95,7 +95,7 @@ class TerminalReporter:
|
||||
self._numcollected = 0
|
||||
|
||||
self.stats = {}
|
||||
self.startdir = self.curdir = py.path.local()
|
||||
self.startdir = py.path.local()
|
||||
if file is None:
|
||||
file = sys.stdout
|
||||
self._tw = self.writer = py.io.TerminalWriter(file)
|
||||
@@ -111,12 +111,12 @@ class TerminalReporter:
|
||||
char = {'xfailed': 'x', 'skipped': 's'}.get(char, char)
|
||||
return char in self.reportchars
|
||||
|
||||
def write_fspath_result(self, fspath, res):
|
||||
def write_fspath_result(self, nodeid, res):
|
||||
fspath = self.config.rootdir.join(nodeid.split("::")[0])
|
||||
if fspath != self.currentfspath:
|
||||
self.currentfspath = fspath
|
||||
#fspath = self.startdir.bestrelpath(fspath)
|
||||
fspath = self.startdir.bestrelpath(fspath)
|
||||
self._tw.line()
|
||||
#relpath = self.startdir.bestrelpath(fspath)
|
||||
self._tw.write(fspath + " ")
|
||||
self._tw.write(res)
|
||||
|
||||
@@ -182,12 +182,12 @@ class TerminalReporter:
|
||||
def pytest_runtest_logstart(self, nodeid, location):
|
||||
# ensure that the path is printed before the
|
||||
# 1st test of a module starts running
|
||||
fspath = nodeid.split("::")[0]
|
||||
if self.showlongtestinfo:
|
||||
line = self._locationline(fspath, *location)
|
||||
line = self._locationline(nodeid, *location)
|
||||
self.write_ensure_prefix(line, "")
|
||||
elif self.showfspath:
|
||||
self.write_fspath_result(fspath, "")
|
||||
fsid = nodeid.split("::")[0]
|
||||
self.write_fspath_result(fsid, "")
|
||||
|
||||
def pytest_runtest_logreport(self, report):
|
||||
rep = report
|
||||
@@ -200,7 +200,7 @@ class TerminalReporter:
|
||||
return
|
||||
if self.verbosity <= 0:
|
||||
if not hasattr(rep, 'node') and self.showfspath:
|
||||
self.write_fspath_result(rep.fspath, letter)
|
||||
self.write_fspath_result(rep.nodeid, letter)
|
||||
else:
|
||||
self._tw.write(letter)
|
||||
else:
|
||||
@@ -213,7 +213,7 @@ class TerminalReporter:
|
||||
markup = {'red':True}
|
||||
elif rep.skipped:
|
||||
markup = {'yellow':True}
|
||||
line = self._locationline(str(rep.fspath), *rep.location)
|
||||
line = self._locationline(rep.nodeid, *rep.location)
|
||||
if not hasattr(rep, 'node'):
|
||||
self.write_ensure_prefix(line, word, **markup)
|
||||
#self._tw.write(word, **markup)
|
||||
@@ -237,7 +237,7 @@ class TerminalReporter:
|
||||
items = [x for x in report.result if isinstance(x, pytest.Item)]
|
||||
self._numcollected += len(items)
|
||||
if self.hasmarkup:
|
||||
#self.write_fspath_result(report.fspath, 'E')
|
||||
#self.write_fspath_result(report.nodeid, 'E')
|
||||
self.report_collect()
|
||||
|
||||
def report_collect(self, final=False):
|
||||
@@ -288,6 +288,10 @@ class TerminalReporter:
|
||||
self.write_line(line)
|
||||
|
||||
def pytest_report_header(self, config):
|
||||
inifile = ""
|
||||
if config.inifile:
|
||||
inifile = config.rootdir.bestrelpath(config.inifile)
|
||||
lines = ["rootdir: %s, inifile: %s" %(config.rootdir, inifile)]
|
||||
plugininfo = config.pluginmanager._plugin_distinfo
|
||||
if plugininfo:
|
||||
l = []
|
||||
@@ -296,7 +300,8 @@ class TerminalReporter:
|
||||
if name.startswith("pytest-"):
|
||||
name = name[7:]
|
||||
l.append(name)
|
||||
return "plugins: %s" % ", ".join(l)
|
||||
lines.append("plugins: %s" % ", ".join(l))
|
||||
return lines
|
||||
|
||||
def pytest_collection_finish(self, session):
|
||||
if self.config.option.collectonly:
|
||||
@@ -345,8 +350,10 @@ class TerminalReporter:
|
||||
indent = (len(stack) - 1) * " "
|
||||
self._tw.line("%s%s" % (indent, col))
|
||||
|
||||
def pytest_sessionfinish(self, exitstatus, __multicall__):
|
||||
__multicall__.execute()
|
||||
@pytest.mark.hookwrapper
|
||||
def pytest_sessionfinish(self, exitstatus):
|
||||
outcome = yield
|
||||
outcome.get_result()
|
||||
self._tw.line("")
|
||||
if exitstatus in (0, 1, 2, 4):
|
||||
self.summary_errors()
|
||||
@@ -376,19 +383,24 @@ class TerminalReporter:
|
||||
else:
|
||||
excrepr.reprcrash.toterminal(self._tw)
|
||||
|
||||
def _locationline(self, collect_fspath, fspath, lineno, domain):
|
||||
def _locationline(self, nodeid, fspath, lineno, domain):
|
||||
def mkrel(nodeid):
|
||||
line = self.config.cwd_relative_nodeid(nodeid)
|
||||
if domain and line.endswith(domain):
|
||||
line = line[:-len(domain)]
|
||||
l = domain.split("[")
|
||||
l[0] = l[0].replace('.', '::') # don't replace '.' in params
|
||||
line += "[".join(l)
|
||||
return line
|
||||
# collect_fspath comes from testid which has a "/"-normalized path
|
||||
if fspath and fspath.replace("\\", "/") != collect_fspath:
|
||||
fspath = "%s <- %s" % (collect_fspath, fspath)
|
||||
|
||||
if fspath:
|
||||
line = str(fspath)
|
||||
if domain:
|
||||
split = str(domain).split('[')
|
||||
split[0] = split[0].replace('.', '::') # don't replace '.' in params
|
||||
line += "::" + '['.join(split)
|
||||
res = mkrel(nodeid).replace("::()", "") # parens-normalization
|
||||
if nodeid.split("::")[0] != fspath.replace("\\", "/"):
|
||||
res += " <- " + self.startdir.bestrelpath(fspath)
|
||||
else:
|
||||
line = "[location]"
|
||||
return line + " "
|
||||
res = "[location]"
|
||||
return res + " "
|
||||
|
||||
def _getfailureheadline(self, rep):
|
||||
if hasattr(rep, 'location'):
|
||||
|
||||
@@ -151,30 +151,33 @@ def pytest_runtest_makereport(item, call):
|
||||
pass
|
||||
|
||||
# twisted trial support
|
||||
def pytest_runtest_protocol(item, __multicall__):
|
||||
if isinstance(item, TestCaseFunction):
|
||||
if 'twisted.trial.unittest' in sys.modules:
|
||||
ut = sys.modules['twisted.python.failure']
|
||||
Failure__init__ = ut.Failure.__init__
|
||||
check_testcase_implements_trial_reporter()
|
||||
def excstore(self, exc_value=None, exc_type=None, exc_tb=None,
|
||||
captureVars=None):
|
||||
if exc_value is None:
|
||||
self._rawexcinfo = sys.exc_info()
|
||||
else:
|
||||
if exc_type is None:
|
||||
exc_type = type(exc_value)
|
||||
self._rawexcinfo = (exc_type, exc_value, exc_tb)
|
||||
try:
|
||||
Failure__init__(self, exc_value, exc_type, exc_tb,
|
||||
captureVars=captureVars)
|
||||
except TypeError:
|
||||
Failure__init__(self, exc_value, exc_type, exc_tb)
|
||||
ut.Failure.__init__ = excstore
|
||||
|
||||
@pytest.mark.hookwrapper
|
||||
def pytest_runtest_protocol(item):
|
||||
if isinstance(item, TestCaseFunction) and \
|
||||
'twisted.trial.unittest' in sys.modules:
|
||||
ut = sys.modules['twisted.python.failure']
|
||||
Failure__init__ = ut.Failure.__init__
|
||||
check_testcase_implements_trial_reporter()
|
||||
def excstore(self, exc_value=None, exc_type=None, exc_tb=None,
|
||||
captureVars=None):
|
||||
if exc_value is None:
|
||||
self._rawexcinfo = sys.exc_info()
|
||||
else:
|
||||
if exc_type is None:
|
||||
exc_type = type(exc_value)
|
||||
self._rawexcinfo = (exc_type, exc_value, exc_tb)
|
||||
try:
|
||||
return __multicall__.execute()
|
||||
finally:
|
||||
ut.Failure.__init__ = Failure__init__
|
||||
Failure__init__(self, exc_value, exc_type, exc_tb,
|
||||
captureVars=captureVars)
|
||||
except TypeError:
|
||||
Failure__init__(self, exc_value, exc_type, exc_tb)
|
||||
ut.Failure.__init__ = excstore
|
||||
yield
|
||||
ut.Failure.__init__ = Failure__init__
|
||||
else:
|
||||
yield
|
||||
|
||||
|
||||
def check_testcase_implements_trial_reporter(done=[]):
|
||||
if done:
|
||||
|
||||
@@ -9,4 +9,4 @@ if __name__ == '__main__':
|
||||
p = pstats.Stats("prof")
|
||||
p.strip_dirs()
|
||||
p.sort_stats('cumulative')
|
||||
print(p.print_stats(250))
|
||||
print(p.print_stats(500))
|
||||
|
||||
@@ -12,7 +12,6 @@ PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
|
||||
SITETARGET=latest
|
||||
|
||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
|
||||
|
||||
@@ -43,11 +42,15 @@ help:
|
||||
clean:
|
||||
-rm -rf $(BUILDDIR)/*
|
||||
|
||||
SITETARGET=latest
|
||||
|
||||
install: html
|
||||
rsync -avz _build/html/ pytest.org:/www/pytest.org/$(SITETARGET)
|
||||
# for access talk to someone with login rights to
|
||||
# pytest-dev@pytest.org to add your ssh key
|
||||
rsync -avz _build/html/ pytest-dev@pytest.org:/www/pytest.org/$(SITETARGET)
|
||||
|
||||
installpdf: latexpdf
|
||||
@scp $(BUILDDIR)/latex/pytest.pdf pytest.org:/www/pytest.org/$(SITETARGET)
|
||||
@scp $(BUILDDIR)/latex/pytest.pdf pytest-dev@pytest.org:/www/pytest.org/$(SITETARGET)
|
||||
|
||||
installall: clean install installpdf
|
||||
@echo "done"
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
<li><a href="{{ pathto('index') }}">The pytest Website</a></li>
|
||||
<li><a href="{{ pathto('contributing') }}">Contribution Guide</a></li>
|
||||
<li><a href="https://pypi.python.org/pypi/pytest">pytest @ PyPI</a></li>
|
||||
<li><a href="https://bitbucket.org/hpk42/pytest/">pytest @ Bitbucket</a></li>
|
||||
<li><a href="https://bitbucket.org/pytest-dev/pytest/">pytest @ Bitbucket</a></li>
|
||||
<li><a href="http://pytest.org/latest/plugins_index/index.html">3rd party plugins</a></li>
|
||||
<li><a href="https://bitbucket.org/hpk42/pytest/issues?status=new&status=open">Issue Tracker</a></li>
|
||||
<li><a href="https://bitbucket.org/pytest-dev/pytest/issues?status=new&status=open">Issue Tracker</a></li>
|
||||
<li><a href="http://pytest.org/latest/pytest.pdf">PDF Documentation</a>
|
||||
</ul>
|
||||
|
||||
|
||||
79
doc/en/adopt.txt
Normal file
79
doc/en/adopt.txt
Normal file
@@ -0,0 +1,79 @@
|
||||
|
||||
April 2015 is "adopt pytest month"
|
||||
=============================================
|
||||
|
||||
Are you an enthusiastic pytest user, the local testing guru in your workplace? Or are you considering using pytest for your open source project, but not sure how to get started? Then you may be interested in "adopt pytest month"!
|
||||
|
||||
We will pair experienced pytest users with open source projects, for a month's effort of getting new development teams started with pytest.
|
||||
|
||||
In 2015 we are trying this for the first time. In February and March 2015 we will gather volunteers on both sides, in April we will do the work, and in May we will evaluate how it went. This effort is being coordinated by Brianna Laugher. If you have any questions or comments, you can raise them on the `@pytestdotorg twitter account <https://twitter.com/pytestdotorg>`_ the `issue tracker`_ or the `pytest-dev mailing list`_.
|
||||
|
||||
|
||||
.. _`issue tracker`: https://bitbucket.org/pytest-dev/pytest/issue/676/adopt-pytest-month-2015
|
||||
.. _`pytest-dev mailing list`: https://mail.python.org/mailman/listinfo/pytest-dev
|
||||
.. _``:
|
||||
|
||||
|
||||
The ideal pytest helper
|
||||
-----------------------------------------
|
||||
|
||||
- will be able to commit 2-4 hours a week to working with their particular project (this might involve joining their mailing list, installing the software and exploring any existing tests, offering advice, writing some example tests)
|
||||
- feels confident in using pytest (e.g. has explored command line options, knows how to write parametrized tests, has an idea about conftest contents)
|
||||
- does not need to be an expert in every aspect!
|
||||
|
||||
`Pytest helpers, sign up here`_! (preferably in February, hard deadline 22 March)
|
||||
|
||||
|
||||
.. _`Pytest helpers, sign up here`: http://goo.gl/forms/nxqAhqWt1P
|
||||
|
||||
|
||||
The ideal partner project
|
||||
-----------------------------------------
|
||||
|
||||
- is open source, and predominantly written in Python
|
||||
- has an automated/documented install process for developers
|
||||
- has more than one core developer
|
||||
- has at least one official release (e.g. is available on pypi)
|
||||
- has the support of the core development team, in trying out pytest adoption
|
||||
- has no tests... or 100% test coverage... or somewhere in between!
|
||||
|
||||
`Partner projects, sign up here`_! (by 22 March)
|
||||
|
||||
|
||||
.. _`Partner projects, sign up here`: http://goo.gl/forms/ZGyqlHiwk3
|
||||
|
||||
|
||||
What does it mean to "adopt pytest"?
|
||||
-----------------------------------------
|
||||
|
||||
There can be many different definitions of "success". Pytest can run many `nose and unittest`_ tests by default, so using pytest as your testrunner may be possible from day 1. Job done, right?
|
||||
|
||||
Progressive success might look like:
|
||||
|
||||
- tests can be run (by pytest) without errors (there may be failures)
|
||||
- tests can be run (by pytest) without failures
|
||||
- test runner is integrated into CI server
|
||||
- existing tests are rewritten to take advantage of pytest features - this can happen in several iterations, for example:
|
||||
- changing to native assert_ statements (pycmd_ has a script to help with that, ``pyconvert_unittest.py``)
|
||||
- changing `setUp/tearDown methods`_ to fixtures_
|
||||
- adding markers_
|
||||
- other changes to reduce boilerplate
|
||||
- assess needs for future tests to be written, e.g. new fixtures, distributed_ testing tweaks
|
||||
|
||||
"Success" should also include that the development team feels comfortable with their knowledge of how to use pytest. In fact this is probably more important than anything else. So spending a lot of time on communication, giving examples, etc will probably be important - both in running the tests, and in writing them.
|
||||
|
||||
It may be after the month is up, the partner project decides that pytest is not right for it. That's okay - hopefully the pytest team will also learn something about its weaknesses or deficiencies.
|
||||
|
||||
.. _`nose and unittest`: faq.html#how-does-pytest-relate-to-nose-and-unittest
|
||||
.. _assert: asserts.html
|
||||
.. _pycmd: https://bitbucket.org/hpk42/pycmd/overview
|
||||
.. _`setUp/tearDown methods`: xunit_setup.html
|
||||
.. _fixtures: fixture.html
|
||||
.. _markers: markers.html
|
||||
.. _distributed: xdist.html
|
||||
|
||||
|
||||
Other ways to help
|
||||
-----------------------------------------
|
||||
|
||||
Promote! Do your favourite open source Python projects use pytest? If not, why not tell them about this page?
|
||||
@@ -34,7 +34,7 @@ a full list of details. A few feature highlights:
|
||||
influence the environment before conftest files import ``django``.
|
||||
|
||||
- reporting: color the last line red or green depending if
|
||||
failures/errors occured or everything passed.
|
||||
failures/errors occurred or everything passed.
|
||||
|
||||
The documentation has been updated to accomodate the changes,
|
||||
see `http://pytest.org <http://pytest.org>`_
|
||||
@@ -95,7 +95,7 @@ new features:
|
||||
as strings will remain fully supported.
|
||||
|
||||
- reporting: color the last line red or green depending if
|
||||
failures/errors occured or everything passed. thanks Christian
|
||||
failures/errors occurred or everything passed. thanks Christian
|
||||
Theunert.
|
||||
|
||||
- make "import pdb ; pdb.set_trace()" work natively wrt capturing (no
|
||||
|
||||
@@ -21,7 +21,7 @@ pytest-2.4.2 is another bug-fixing release:
|
||||
|
||||
- introduce node.get_marker/node.add_marker API for plugins
|
||||
like pytest-pep8 and pytest-flakes to avoid the messy
|
||||
details of the node.keywords pseudo-dicts. Adapated
|
||||
details of the node.keywords pseudo-dicts. Adapted
|
||||
docs.
|
||||
|
||||
- remove attempt to "dup" stdout at startup as it's icky.
|
||||
|
||||
@@ -21,7 +21,7 @@ fixes a number of bugs and brings some new features, mainly:
|
||||
Note also that 2.6.0 departs with the "zero reported bugs" policy
|
||||
because it has been too hard to keep up with it, unfortunately.
|
||||
Instead we are for now rather bound to work on "upvoted" issues in
|
||||
the https://bitbucket.org/hpk42/pytest/issues?status=new&status=open&sort=-votes
|
||||
the https://bitbucket.org/pytest-dev/pytest/issues?status=new&status=open&sort=-votes
|
||||
issue tracker.
|
||||
|
||||
See docs at:
|
||||
|
||||
101
doc/en/announce/release-2.7.0.txt
Normal file
101
doc/en/announce/release-2.7.0.txt
Normal file
@@ -0,0 +1,101 @@
|
||||
pytest-2.7.0: fixes, features, speed improvements
|
||||
===========================================================================
|
||||
|
||||
pytest is a mature Python testing tool with more than a 1100 tests
|
||||
against itself, passing on many different interpreters and platforms.
|
||||
This release is supposed to be drop-in compatible to 2.6.X.
|
||||
|
||||
See below for the changes and see docs at:
|
||||
|
||||
http://pytest.org
|
||||
|
||||
As usual, you can upgrade from pypi via::
|
||||
|
||||
pip install -U pytest
|
||||
|
||||
Thanks to all who contributed, among them:
|
||||
|
||||
Anatoly Bubenkoff
|
||||
Floris Bruynooghe
|
||||
Brianna Laugher
|
||||
Eric Siegerman
|
||||
Daniel Hahler
|
||||
Charles Cloud
|
||||
Tom Viner
|
||||
Holger Peters
|
||||
Ldiary Translations
|
||||
almarklein
|
||||
|
||||
have fun,
|
||||
holger krekel
|
||||
|
||||
2.7.0 (compared to 2.6.4)
|
||||
-----------------------------
|
||||
|
||||
- fix issue435: make reload() work when assert rewriting is active.
|
||||
Thanks Daniel Hahler.
|
||||
|
||||
- fix issue616: conftest.py files and their contained fixutres are now
|
||||
properly considered for visibility, independently from the exact
|
||||
current working directory and test arguments that are used.
|
||||
Many thanks to Eric Siegerman and his PR235 which contains
|
||||
systematic tests for conftest visibility and now passes.
|
||||
This change also introduces the concept of a ``rootdir`` which
|
||||
is printed as a new pytest header and documented in the pytest
|
||||
customize web page.
|
||||
|
||||
- change reporting of "diverted" tests, i.e. tests that are collected
|
||||
in one file but actually come from another (e.g. when tests in a test class
|
||||
come from a base class in a different file). We now show the nodeid
|
||||
and indicate via a postfix the other file.
|
||||
|
||||
- add ability to set command line options by environment variable PYTEST_ADDOPTS.
|
||||
|
||||
- added documentation on the new pytest-dev teams on bitbucket and
|
||||
github. See https://pytest.org/latest/contributing.html .
|
||||
Thanks to Anatoly for pushing and initial work on this.
|
||||
|
||||
- fix issue650: new option ``--docttest-ignore-import-errors`` which
|
||||
will turn import errors in doctests into skips. Thanks Charles Cloud
|
||||
for the complete PR.
|
||||
|
||||
- fix issue655: work around different ways that cause python2/3
|
||||
to leak sys.exc_info into fixtures/tests causing failures in 3rd party code
|
||||
|
||||
- fix issue615: assertion re-writing did not correctly escape % signs
|
||||
when formatting boolean operations, which tripped over mixing
|
||||
booleans with modulo operators. Thanks to Tom Viner for the report,
|
||||
triaging and fix.
|
||||
|
||||
- implement issue351: add ability to specify parametrize ids as a callable
|
||||
to generate custom test ids. Thanks Brianna Laugher for the idea and
|
||||
implementation.
|
||||
|
||||
- introduce and document new hookwrapper mechanism useful for plugins
|
||||
which want to wrap the execution of certain hooks for their purposes.
|
||||
This supersedes the undocumented ``__multicall__`` protocol which
|
||||
pytest itself and some external plugins use. Note that pytest-2.8
|
||||
is scheduled to drop supporting the old ``__multicall__``
|
||||
and only support the hookwrapper protocol.
|
||||
|
||||
- majorly speed up invocation of plugin hooks
|
||||
|
||||
- use hookwrapper mechanism in builtin pytest plugins.
|
||||
|
||||
- add a doctest ini option for doctest flags, thanks Holger Peters.
|
||||
|
||||
- add note to docs that if you want to mark a parameter and the
|
||||
parameter is a callable, you also need to pass in a reason to disambiguate
|
||||
it from the "decorator" case. Thanks Tom Viner.
|
||||
|
||||
- "python_classes" and "python_functions" options now support glob-patterns
|
||||
for test discovery, as discussed in issue600. Thanks Ldiary Translations.
|
||||
|
||||
- allow to override parametrized fixtures with non-parametrized ones and vice versa (bubenkoff).
|
||||
|
||||
- fix issue463: raise specific error for 'parameterize' misspelling (pfctdayelise).
|
||||
|
||||
- On failure, the ``sys.last_value``, ``sys.last_type`` and
|
||||
``sys.last_traceback`` are set, so that a user can inspect the error
|
||||
via postmortem debugging (almarklein).
|
||||
|
||||
@@ -26,7 +26,8 @@ you will see the return value of the function call::
|
||||
|
||||
$ py.test test_assert1.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-98, inifile:
|
||||
collected 1 items
|
||||
|
||||
test_assert1.py F
|
||||
@@ -135,7 +136,8 @@ if you run this module::
|
||||
|
||||
$ py.test test_assert2.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-98, inifile:
|
||||
collected 1 items
|
||||
|
||||
test_assert2.py F
|
||||
@@ -202,16 +204,16 @@ the conftest file::
|
||||
F
|
||||
================================= FAILURES =================================
|
||||
_______________________________ test_compare _______________________________
|
||||
|
||||
|
||||
def test_compare():
|
||||
f1 = Foo(1)
|
||||
f2 = Foo(2)
|
||||
> assert f1 == f2
|
||||
E assert Comparing Foo instances:
|
||||
E vals: 1 != 2
|
||||
|
||||
|
||||
test_foocompare.py:8: AssertionError
|
||||
1 failed in 0.01 seconds
|
||||
1 failed in 0.00 seconds
|
||||
|
||||
.. _assert-details:
|
||||
.. _`assert introspection`:
|
||||
|
||||
@@ -77,12 +77,10 @@ You can ask for available builtin or project-custom
|
||||
enables capturing of writes to sys.stdout/sys.stderr and makes
|
||||
captured output available via ``capsys.readouterr()`` method calls
|
||||
which return a ``(out, err)`` tuple.
|
||||
|
||||
capfd
|
||||
enables capturing of writes to file descriptors 1 and 2 and makes
|
||||
captured output available via ``capfd.readouterr()`` method calls
|
||||
which return a ``(out, err)`` tuple.
|
||||
|
||||
monkeypatch
|
||||
The returned ``monkeypatch`` funcarg provides these
|
||||
helper methods to modify objects, dictionaries or os.environ::
|
||||
@@ -100,7 +98,6 @@ You can ask for available builtin or project-custom
|
||||
test function has finished. The ``raising``
|
||||
parameter determines if a KeyError or AttributeError
|
||||
will be raised if the set/deletion operation has no target.
|
||||
|
||||
pytestconfig
|
||||
the pytest config object with access to command line opts.
|
||||
recwarn
|
||||
@@ -111,13 +108,11 @@ You can ask for available builtin or project-custom
|
||||
|
||||
See http://docs.python.org/library/warnings.html for information
|
||||
on warning categories.
|
||||
|
||||
tmpdir
|
||||
return a temporary directory path object
|
||||
which is unique to each test function invocation,
|
||||
created as a sub directory of the base temporary
|
||||
directory. The returned object is a `py.path.local`_
|
||||
path object.
|
||||
|
||||
|
||||
in 0.00 seconds
|
||||
|
||||
@@ -64,7 +64,8 @@ of the failing function and hide the other one::
|
||||
|
||||
$ py.test
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-101, inifile:
|
||||
collected 2 items
|
||||
|
||||
test_module.py .F
|
||||
@@ -78,7 +79,7 @@ of the failing function and hide the other one::
|
||||
|
||||
test_module.py:9: AssertionError
|
||||
-------------------------- Captured stdout setup ---------------------------
|
||||
setting up <function test_func2 at 0x2af94bea1d08>
|
||||
setting up <function test_func2 at 0x2b24d5259158>
|
||||
==================== 1 failed, 1 passed in 0.01 seconds ====================
|
||||
|
||||
Accessing captured output from a test function
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
#
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
# The short X.Y version.
|
||||
version = "2.6"
|
||||
release = "2.6.4"
|
||||
version = "2.7"
|
||||
release = "2.7.0"
|
||||
|
||||
import sys, os
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ Contact channels
|
||||
- `merlinux.eu`_ offers pytest and tox-related professional teaching and
|
||||
consulting.
|
||||
|
||||
.. _`pytest issue tracker`: http://bitbucket.org/hpk42/pytest/issues/
|
||||
.. _`pytest issue tracker`: http://bitbucket.org/pytest-dev/pytest/issues/
|
||||
.. _`old issue tracker`: http://bitbucket.org/hpk42/py-trunk/issues/
|
||||
|
||||
.. _`merlinux.eu`: http://merlinux.eu
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
|
||||
.. note::
|
||||
|
||||
`improving your automated testing with pytest <https://ep2014.europython.eu/en/schedule/sessions/92/>`_, July 25th 2014, Berlin, Germany
|
||||
|
||||
`professional testing with pytest and tox <http://www.python-academy.com/courses/specialtopics/python_course_testing.html>`_, 24-26th November 2014, Freiburg, Germany
|
||||
|
||||
.. _toc:
|
||||
|
||||
Full pytest documentation
|
||||
|
||||
@@ -12,37 +12,73 @@ configurations files by using the general help option::
|
||||
This will display command line and configuration file settings
|
||||
which were registered by installed plugins.
|
||||
|
||||
.. _rootdir:
|
||||
.. _inifiles:
|
||||
|
||||
How test configuration is read from configuration INI-files
|
||||
-------------------------------------------------------------
|
||||
initialization: determining rootdir and inifile
|
||||
-----------------------------------------------
|
||||
|
||||
``pytest`` searches for the first matching ini-style configuration file
|
||||
in the directories of command line argument and the directories above.
|
||||
It looks for file basenames in this order::
|
||||
.. versionadded:: 2.7
|
||||
|
||||
pytest determines a "rootdir" for each test run which depends on
|
||||
the command line arguments (specified test files, paths) and on
|
||||
the existence of inifiles. The determined rootdir and ini-file are
|
||||
printed as part of the pytest header. The rootdir is used for constructing
|
||||
"nodeids" during collection and may also be used by plugins to store
|
||||
project/testrun-specific information.
|
||||
|
||||
Here is the algorithm which finds the rootdir from ``args``:
|
||||
|
||||
- determine the common ancestor directory for the specified ``args``.
|
||||
|
||||
- look for ``pytest.ini``, ``tox.ini`` and ``setup.cfg`` files in the
|
||||
ancestor directory and upwards. If one is matched, it becomes the
|
||||
ini-file and its directory becomes the rootdir. An existing
|
||||
``pytest.ini`` file will always be considered a match whereas
|
||||
``tox.ini`` and ``setup.cfg`` will only match if they contain
|
||||
a ``[pytest]`` section.
|
||||
|
||||
- if no ini-file was found, look for ``setup.py`` upwards from
|
||||
the common ancestor directory to determine the ``rootdir``.
|
||||
|
||||
- if no ini-file and no ``setup.py`` was found, use the already
|
||||
determined common ancestor as root directory. This allows to
|
||||
work with pytest in structures that are not part of a package
|
||||
and don't have any particular ini-file configuration.
|
||||
|
||||
Note that options from multiple ini-files candidates are never merged,
|
||||
the first one wins (``pytest.ini`` always wins even if it does not
|
||||
contain a ``[pytest]`` section).
|
||||
|
||||
The ``config`` object will subsequently carry these attributes:
|
||||
|
||||
- ``config.rootdir``: the determined root directory, guaranteed to exist.
|
||||
|
||||
- ``config.inifile``: the determined ini-file, may be ``None``.
|
||||
|
||||
The rootdir is used a reference directory for constructing test
|
||||
addresses ("nodeids") and can be used also by plugins for storing
|
||||
per-testrun information.
|
||||
|
||||
Example::
|
||||
|
||||
py.test path/to/testdir path/other/
|
||||
|
||||
will determine the common ancestor as ``path`` and then
|
||||
check for ini-files as follows::
|
||||
|
||||
# first look for pytest.ini files
|
||||
path/pytest.ini
|
||||
path/setup.cfg # must also contain [pytest] section to match
|
||||
path/tox.ini # must also contain [pytest] section to match
|
||||
pytest.ini
|
||||
tox.ini
|
||||
setup.cfg
|
||||
... # all the way down to the root
|
||||
|
||||
Searching stops when the first ``[pytest]`` section is found in any of
|
||||
these files. There is no merging of configuration values from multiple
|
||||
files. Example::
|
||||
# now look for setup.py
|
||||
path/setup.py
|
||||
setup.py
|
||||
... # all the way down to the root
|
||||
|
||||
py.test path/to/testdir
|
||||
|
||||
will look in the following dirs for a config file::
|
||||
|
||||
path/to/testdir/pytest.ini
|
||||
path/to/testdir/tox.ini
|
||||
path/to/testdir/setup.cfg
|
||||
path/to/pytest.ini
|
||||
path/to/tox.ini
|
||||
path/to/setup.cfg
|
||||
... # up until root of filesystem
|
||||
|
||||
If argument is provided to a ``pytest`` run, the current working directory
|
||||
is used to start the search.
|
||||
|
||||
.. _`how to change command line options defaults`:
|
||||
.. _`adding default options`:
|
||||
@@ -60,8 +96,15 @@ progress output, you can write it into a configuration file::
|
||||
[pytest]
|
||||
addopts = -rsxX -q
|
||||
|
||||
Alternatively, you can set a PYTEST_ADDOPTS environment variable to add command
|
||||
line options while the environment is in use::
|
||||
|
||||
export PYTEST_ADDOPTS="-rsxX -q"
|
||||
|
||||
From now on, running ``pytest`` will add the specified options.
|
||||
|
||||
|
||||
|
||||
Builtin configuration file options
|
||||
----------------------------------------------
|
||||
|
||||
@@ -115,14 +158,35 @@ Builtin configuration file options
|
||||
|
||||
.. confval:: python_classes
|
||||
|
||||
One or more name prefixes determining which test classes
|
||||
are considered as test modules.
|
||||
One or more name prefixes or glob-style patterns determining which classes
|
||||
are considered for test collection. Here is an example of how to collect
|
||||
tests from classes that end in ``Suite``::
|
||||
|
||||
# content of pytest.ini
|
||||
[pytest]
|
||||
python_classes = *Suite
|
||||
|
||||
Note that ``unittest.TestCase`` derived classes are always collected
|
||||
regardless of this option, as ``unittest``'s own collection framework is used
|
||||
to collect those tests.
|
||||
|
||||
.. confval:: python_functions
|
||||
|
||||
One or more name prefixes determining which test functions
|
||||
and methods are considered as test modules. Note that this
|
||||
has no effect on methods that live on a ``unittest.TestCase``
|
||||
derived class.
|
||||
One or more name prefixes or glob-patterns determining which test functions
|
||||
and methods are considered tests. Here is an example of how
|
||||
to collect test functions and methods that end in ``_test``::
|
||||
|
||||
See :ref:`change naming conventions` for examples.
|
||||
# content of pytest.ini
|
||||
[pytest]
|
||||
python_functions = *_test
|
||||
|
||||
Note that this has no effect on methods that live on a ``unittest
|
||||
.TestCase`` derived class, as ``unittest``'s own collection framework is used
|
||||
to collect those tests.
|
||||
|
||||
See :ref:`change naming conventions` for more detailed examples.
|
||||
|
||||
.. confval:: doctest_optionflags
|
||||
|
||||
One or more doctest flag names from the standard ``doctest`` module.
|
||||
:doc:`See how py.test handles doctests <doctest>`.
|
||||
|
||||
@@ -44,12 +44,13 @@ then you can just invoke ``py.test`` without command line options::
|
||||
|
||||
$ py.test
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-107, inifile: pytest.ini
|
||||
collected 1 items
|
||||
|
||||
mymodule.py .
|
||||
|
||||
========================= 1 passed in 0.06 seconds =========================
|
||||
========================= 1 passed in 0.05 seconds =========================
|
||||
|
||||
It is possible to use fixtures using the ``getfixture`` helper::
|
||||
|
||||
@@ -60,3 +61,12 @@ It is possible to use fixtures using the ``getfixture`` helper::
|
||||
|
||||
Also, :ref:`usefixtures` and :ref:`autouse` fixtures are supported
|
||||
when executing text doctest files.
|
||||
|
||||
The standard ``doctest`` module provides some setting flags to configure the
|
||||
strictness of doctest tests. In py.test You can enable those flags those flags
|
||||
using the configuration file. To make pytest ignore trailing whitespaces and
|
||||
ignore lengthy exception stack traces you can just write::
|
||||
|
||||
# content of pytest.ini
|
||||
[pytest]
|
||||
doctest_optionflags= NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL
|
||||
|
||||
@@ -31,7 +31,8 @@ You can then restrict a test run to only run tests marked with ``webtest``::
|
||||
|
||||
$ py.test -v -m webtest
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
rootdir: /tmp/doc-exec-167, inifile:
|
||||
collecting ... collected 4 items
|
||||
|
||||
test_server.py::test_send_http PASSED
|
||||
@@ -43,7 +44,8 @@ Or the inverse, running all tests except the webtest ones::
|
||||
|
||||
$ py.test -v -m "not webtest"
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
rootdir: /tmp/doc-exec-167, inifile:
|
||||
collecting ... collected 4 items
|
||||
|
||||
test_server.py::test_something_quick PASSED
|
||||
@@ -62,7 +64,8 @@ tests based on their module, class, method, or function name::
|
||||
|
||||
$ py.test -v test_server.py::TestClass::test_method
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
rootdir: /tmp/doc-exec-167, inifile:
|
||||
collecting ... collected 5 items
|
||||
|
||||
test_server.py::TestClass::test_method PASSED
|
||||
@@ -73,7 +76,8 @@ You can also select on the class::
|
||||
|
||||
$ py.test -v test_server.py::TestClass
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
rootdir: /tmp/doc-exec-167, inifile:
|
||||
collecting ... collected 4 items
|
||||
|
||||
test_server.py::TestClass::test_method PASSED
|
||||
@@ -84,7 +88,8 @@ Or select multiple nodes::
|
||||
|
||||
$ py.test -v test_server.py::TestClass test_server.py::test_send_http
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
rootdir: /tmp/doc-exec-167, inifile:
|
||||
collecting ... collected 8 items
|
||||
|
||||
test_server.py::TestClass::test_method PASSED
|
||||
@@ -120,7 +125,8 @@ select tests based on their names::
|
||||
|
||||
$ py.test -v -k http # running with the above defined example module
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
rootdir: /tmp/doc-exec-167, inifile:
|
||||
collecting ... collected 4 items
|
||||
|
||||
test_server.py::test_send_http PASSED
|
||||
@@ -132,7 +138,8 @@ And you can also run all tests except the ones that match the keyword::
|
||||
|
||||
$ py.test -k "not send_http" -v
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
rootdir: /tmp/doc-exec-167, inifile:
|
||||
collecting ... collected 4 items
|
||||
|
||||
test_server.py::test_something_quick PASSED
|
||||
@@ -146,7 +153,8 @@ Or to select "http" and "quick" tests::
|
||||
|
||||
$ py.test -k "http or quick" -v
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
rootdir: /tmp/doc-exec-167, inifile:
|
||||
collecting ... collected 4 items
|
||||
|
||||
test_server.py::test_send_http PASSED
|
||||
@@ -280,6 +288,14 @@ In this example the mark "foo" will apply to each of the three
|
||||
tests, whereas the "bar" mark is only applied to the second test.
|
||||
Skip and xfail marks can also be applied in this way, see :ref:`skip/xfail with parametrize`.
|
||||
|
||||
.. note::
|
||||
|
||||
If the data you are parametrizing happen to be single callables, you need to be careful
|
||||
when marking these items. `pytest.mark.xfail(my_func)` won't work because it's also the
|
||||
signature of a function being decorated. To resolve this ambiguity, you need to pass a
|
||||
reason argument:
|
||||
`pytest.mark.xfail(func_bar, reason="Issue#7")`.
|
||||
|
||||
|
||||
.. _`adding a custom marker from a plugin`:
|
||||
|
||||
@@ -326,23 +342,25 @@ the test needs::
|
||||
|
||||
$ py.test -E stage2
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-167, inifile:
|
||||
collected 1 items
|
||||
|
||||
test_someenv.py s
|
||||
|
||||
======================== 1 skipped in 0.01 seconds =========================
|
||||
======================== 1 skipped in 0.00 seconds =========================
|
||||
|
||||
and here is one that specifies exactly the environment needed::
|
||||
|
||||
$ py.test -E stage1
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-167, inifile:
|
||||
collected 1 items
|
||||
|
||||
test_someenv.py .
|
||||
|
||||
========================= 1 passed in 0.01 seconds =========================
|
||||
========================= 1 passed in 0.00 seconds =========================
|
||||
|
||||
The ``--markers`` option always gives you a list of available markers::
|
||||
|
||||
@@ -455,12 +473,13 @@ then you will see two test skipped and two executed tests as expected::
|
||||
|
||||
$ py.test -rs # this option reports skip reasons
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-167, inifile:
|
||||
collected 4 items
|
||||
|
||||
test_plat.py sss.
|
||||
========================= short test summary info ==========================
|
||||
SKIP [3] /tmp/doc-exec-68/conftest.py:12: cannot run on platform linux
|
||||
SKIP [3] /tmp/doc-exec-167/conftest.py:12: cannot run on platform linux
|
||||
|
||||
=================== 1 passed, 3 skipped in 0.01 seconds ====================
|
||||
|
||||
@@ -468,7 +487,8 @@ Note that if you specify a platform via the marker-command line option like this
|
||||
|
||||
$ py.test -m linux2
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-167, inifile:
|
||||
collected 4 items
|
||||
|
||||
test_plat.py s
|
||||
@@ -519,7 +539,8 @@ We can now use the ``-m option`` to select one set::
|
||||
|
||||
$ py.test -m interface --tb=short
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-167, inifile:
|
||||
collected 4 items
|
||||
|
||||
test_module.py FF
|
||||
@@ -540,7 +561,8 @@ or to select both "event" and "interface" tests::
|
||||
|
||||
$ py.test -m "interface or event" --tb=short
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-167, inifile:
|
||||
collected 4 items
|
||||
|
||||
test_module.py FFF
|
||||
|
||||
@@ -5,7 +5,7 @@ serialization via the pickle module.
|
||||
import py
|
||||
import pytest
|
||||
|
||||
pythonlist = ['python2.6', 'python2.7', 'python3.4']
|
||||
pythonlist = ['python2.6', 'python2.7', 'python3.3']
|
||||
@pytest.fixture(params=pythonlist)
|
||||
def python1(request, tmpdir):
|
||||
picklefile = tmpdir.join("data.pickle")
|
||||
@@ -26,7 +26,7 @@ class Python:
|
||||
dumpfile.write(py.code.Source("""
|
||||
import pickle
|
||||
f = open(%r, 'wb')
|
||||
s = pickle.dump(%r, f)
|
||||
s = pickle.dump(%r, f, protocol=2)
|
||||
f.close()
|
||||
""" % (str(self.picklefile), obj)))
|
||||
py.process.cmdexec("%s %s" %(self.pythonpath, dumpfile))
|
||||
|
||||
@@ -27,7 +27,8 @@ now execute the test specification::
|
||||
|
||||
nonpython $ py.test test_simple.yml
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /home/hpk/p/pytest/doc/en, inifile: pytest.ini
|
||||
collected 2 items
|
||||
|
||||
test_simple.yml F.
|
||||
@@ -56,11 +57,12 @@ consulted when reporting in ``verbose`` mode::
|
||||
|
||||
nonpython $ py.test -v
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
rootdir: /home/hpk/p/pytest/doc/en, inifile: pytest.ini
|
||||
collecting ... collected 2 items
|
||||
|
||||
test_simple.yml::usecase: hello FAILED
|
||||
test_simple.yml::usecase: ok PASSED
|
||||
test_simple.yml::hello FAILED
|
||||
test_simple.yml::ok PASSED
|
||||
|
||||
================================= FAILURES =================================
|
||||
______________________________ usecase: hello ______________________________
|
||||
@@ -74,9 +76,10 @@ interesting to just look at the collection tree::
|
||||
|
||||
nonpython $ py.test --collect-only
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /home/hpk/p/pytest/doc/en, inifile: pytest.ini
|
||||
collected 2 items
|
||||
<YamlFile 'test_simple.yml'>
|
||||
<YamlFile 'example/nonpython/test_simple.yml'>
|
||||
<YamlItem 'hello'>
|
||||
<YamlItem 'ok'>
|
||||
|
||||
|
||||
@@ -68,6 +68,71 @@ let's run the full monty::
|
||||
As expected when running the full range of ``param1`` values
|
||||
we'll get an error on the last one.
|
||||
|
||||
|
||||
Different options for test IDs
|
||||
------------------------------------
|
||||
|
||||
pytest will build a string that is the test ID for each set of values in a
|
||||
parametrized test. These IDs can be used with ``-k`` to select specific cases
|
||||
to run, and they will also identify the specific case when one is failing.
|
||||
Running pytest with ``--collect-only`` will show the generated IDs.
|
||||
|
||||
Numbers, strings, booleans and None will have their usual string representation
|
||||
used in the test ID. For other objects, pytest will make a string based on
|
||||
the argument name::
|
||||
|
||||
# contents of test_time.py
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
testdata = [(datetime(2001, 12, 12), datetime(2001, 12, 11), timedelta(1)),
|
||||
(datetime(2001, 12, 11), datetime(2001, 12, 12), timedelta(-1)),
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("a,b,expected", testdata)
|
||||
def test_timedistance_v0(a, b, expected):
|
||||
diff = a - b
|
||||
assert diff == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize("a,b,expected", testdata, ids=["forward", "backward"])
|
||||
def test_timedistance_v1(a, b, expected):
|
||||
diff = a - b
|
||||
assert diff == expected
|
||||
|
||||
|
||||
def idfn(val):
|
||||
if isinstance(val, (datetime,)):
|
||||
# note this wouldn't show any hours/minutes/seconds
|
||||
return val.strftime('%Y%m%d')
|
||||
|
||||
|
||||
@pytest.mark.parametrize("a,b,expected", testdata, ids=idfn)
|
||||
def test_timedistance_v2(a, b, expected):
|
||||
diff = a - b
|
||||
assert diff == expected
|
||||
|
||||
|
||||
In ``test_timedistance_v0``, we let pytest generate the test IDs.
|
||||
|
||||
In ``test_timedistance_v1``, we specified ``ids`` as a list of strings which were
|
||||
used as the test IDs. These are succinct, but can be a pain to maintain.
|
||||
|
||||
In ``test_timedistance_v2``, we specified ``ids`` as a function that can generate a
|
||||
string representation to make part of the test ID. So our ``datetime`` values use the
|
||||
label generated by ``idfn``, but because we didn't generate a label for ``timedelta``
|
||||
objects, they are still using the default pytest representation::
|
||||
|
||||
|
||||
$ py.test test_time.py --collect-only
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-169, inifile:
|
||||
|
||||
============================= in 0.00 seconds =============================
|
||||
ERROR: file not found: test_time.py
|
||||
|
||||
A quick port of "testscenarios"
|
||||
------------------------------------
|
||||
|
||||
@@ -106,7 +171,8 @@ this is a fully self-contained example which you can run with::
|
||||
|
||||
$ py.test test_scenarios.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-169, inifile:
|
||||
collected 4 items
|
||||
|
||||
test_scenarios.py ....
|
||||
@@ -118,7 +184,8 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as varia
|
||||
|
||||
$ py.test --collect-only test_scenarios.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-169, inifile:
|
||||
collected 4 items
|
||||
<Module 'test_scenarios.py'>
|
||||
<Class 'TestSampleWithScenarios'>
|
||||
@@ -182,7 +249,8 @@ Let's first see how it looks like at collection time::
|
||||
|
||||
$ py.test test_backends.py --collect-only
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-169, inifile:
|
||||
collected 2 items
|
||||
<Module 'test_backends.py'>
|
||||
<Function 'test_db_initialized[d1]'>
|
||||
@@ -197,7 +265,7 @@ And then when we run the test::
|
||||
================================= FAILURES =================================
|
||||
_________________________ test_db_initialized[d2] __________________________
|
||||
|
||||
db = <conftest.DB2 object at 0x2b04d7936be0>
|
||||
db = <conftest.DB2 object at 0x2b160a531f98>
|
||||
|
||||
def test_db_initialized(db):
|
||||
# a dummy test
|
||||
@@ -251,9 +319,9 @@ argument sets to use for each test function. Let's run it::
|
||||
$ py.test -q
|
||||
F..
|
||||
================================= FAILURES =================================
|
||||
________________________ TestClass.test_equals[2-1] ________________________
|
||||
________________________ TestClass.test_equals[1-2] ________________________
|
||||
|
||||
self = <test_parametrize.TestClass object at 0x2af4cdee0da0>, a = 1, b = 2
|
||||
self = <test_parametrize.TestClass object at 0x2ab66352a978>, a = 1, b = 2
|
||||
|
||||
def test_equals(self, a, b):
|
||||
> assert a == b
|
||||
@@ -279,345 +347,8 @@ is to be run with different sets of arguments for its three arguments:
|
||||
Running it results in some skips if we don't have all the python interpreters installed and otherwise runs all combinations (5 interpreters times 5 interpreters times 3 objects to serialize/deserialize)::
|
||||
|
||||
. $ py.test -rs -q multipython.py
|
||||
..................FFFFFF...
|
||||
================================= FAILURES =================================
|
||||
________________ test_basic_objects[python3.4-python2.6-42] ________________
|
||||
|
||||
python1 = <multipython.Python object at 0x2afc7d8c2828>
|
||||
python2 = <multipython.Python object at 0x2afc7d8c2588>, obj = 42
|
||||
|
||||
@pytest.mark.parametrize("obj", [42, {}, {1:3},])
|
||||
def test_basic_objects(python1, python2, obj):
|
||||
python1.dumps(obj)
|
||||
> python2.load_and_is_true("obj == %s" % obj)
|
||||
|
||||
multipython.py:51:
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
multipython.py:46: in load_and_is_true
|
||||
py.process.cmdexec("%s %s" %(self.pythonpath, loadfile))
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
|
||||
cmd = '/home/hpk/bin/python2.6 /tmp/pytest-111/test_basic_objects_python3_4_p0/load.py'
|
||||
|
||||
def cmdexec(cmd):
|
||||
""" return unicode output of executing 'cmd' in a separate process.
|
||||
|
||||
raise cmdexec.Error exeception if the command failed.
|
||||
the exception will provide an 'err' attribute containing
|
||||
the error-output from the command.
|
||||
if the subprocess module does not provide a proper encoding/unicode strings
|
||||
sys.getdefaultencoding() will be used, if that does not exist, 'UTF-8'.
|
||||
"""
|
||||
process = subprocess.Popen(cmd, shell=True,
|
||||
universal_newlines=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = process.communicate()
|
||||
if sys.version_info[0] < 3: # on py3 we get unicode strings, on py2 not
|
||||
try:
|
||||
default_encoding = sys.getdefaultencoding() # jython may not have it
|
||||
except AttributeError:
|
||||
default_encoding = sys.stdout.encoding or 'UTF-8'
|
||||
out = unicode(out, process.stdout.encoding or default_encoding)
|
||||
err = unicode(err, process.stderr.encoding or default_encoding)
|
||||
status = process.poll()
|
||||
if status:
|
||||
> raise ExecutionFailed(status, status, cmd, out, err)
|
||||
E py.process.cmdexec.Error: ExecutionFailed: 1 /home/hpk/bin/python2.6 /tmp/pytest-111/test_basic_objects_python3_4_p0/load.py
|
||||
E Traceback (most recent call last):
|
||||
E File "/tmp/pytest-111/test_basic_objects_python3_4_p0/load.py", line 4, in <module>
|
||||
E obj = pickle.load(f)
|
||||
E File "/usr/lib/python2.6/pickle.py", line 1370, in load
|
||||
E return Unpickler(file).load()
|
||||
E File "/usr/lib/python2.6/pickle.py", line 858, in load
|
||||
E dispatch[key](self)
|
||||
E File "/usr/lib/python2.6/pickle.py", line 886, in load_proto
|
||||
E raise ValueError, "unsupported pickle protocol: %d" % proto
|
||||
E ValueError: unsupported pickle protocol: 3
|
||||
|
||||
../../../.tox/regen/lib/python3.4/site-packages/py/_process/cmdexec.py:28: Error
|
||||
--------------------------- Captured stdout call ---------------------------
|
||||
/tmp/pytest-111/test_basic_objects_python3_4_p0/load.py
|
||||
_______________ test_basic_objects[python3.4-python2.6-obj1] _______________
|
||||
|
||||
python1 = <multipython.Python object at 0x2afc7d8b8c88>
|
||||
python2 = <multipython.Python object at 0x2afc7d8b8e48>, obj = {}
|
||||
|
||||
@pytest.mark.parametrize("obj", [42, {}, {1:3},])
|
||||
def test_basic_objects(python1, python2, obj):
|
||||
python1.dumps(obj)
|
||||
> python2.load_and_is_true("obj == %s" % obj)
|
||||
|
||||
multipython.py:51:
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
multipython.py:46: in load_and_is_true
|
||||
py.process.cmdexec("%s %s" %(self.pythonpath, loadfile))
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
|
||||
cmd = '/home/hpk/bin/python2.6 /tmp/pytest-111/test_basic_objects_python3_4_p1/load.py'
|
||||
|
||||
def cmdexec(cmd):
|
||||
""" return unicode output of executing 'cmd' in a separate process.
|
||||
|
||||
raise cmdexec.Error exeception if the command failed.
|
||||
the exception will provide an 'err' attribute containing
|
||||
the error-output from the command.
|
||||
if the subprocess module does not provide a proper encoding/unicode strings
|
||||
sys.getdefaultencoding() will be used, if that does not exist, 'UTF-8'.
|
||||
"""
|
||||
process = subprocess.Popen(cmd, shell=True,
|
||||
universal_newlines=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = process.communicate()
|
||||
if sys.version_info[0] < 3: # on py3 we get unicode strings, on py2 not
|
||||
try:
|
||||
default_encoding = sys.getdefaultencoding() # jython may not have it
|
||||
except AttributeError:
|
||||
default_encoding = sys.stdout.encoding or 'UTF-8'
|
||||
out = unicode(out, process.stdout.encoding or default_encoding)
|
||||
err = unicode(err, process.stderr.encoding or default_encoding)
|
||||
status = process.poll()
|
||||
if status:
|
||||
> raise ExecutionFailed(status, status, cmd, out, err)
|
||||
E py.process.cmdexec.Error: ExecutionFailed: 1 /home/hpk/bin/python2.6 /tmp/pytest-111/test_basic_objects_python3_4_p1/load.py
|
||||
E Traceback (most recent call last):
|
||||
E File "/tmp/pytest-111/test_basic_objects_python3_4_p1/load.py", line 4, in <module>
|
||||
E obj = pickle.load(f)
|
||||
E File "/usr/lib/python2.6/pickle.py", line 1370, in load
|
||||
E return Unpickler(file).load()
|
||||
E File "/usr/lib/python2.6/pickle.py", line 858, in load
|
||||
E dispatch[key](self)
|
||||
E File "/usr/lib/python2.6/pickle.py", line 886, in load_proto
|
||||
E raise ValueError, "unsupported pickle protocol: %d" % proto
|
||||
E ValueError: unsupported pickle protocol: 3
|
||||
|
||||
../../../.tox/regen/lib/python3.4/site-packages/py/_process/cmdexec.py:28: Error
|
||||
--------------------------- Captured stdout call ---------------------------
|
||||
/tmp/pytest-111/test_basic_objects_python3_4_p1/load.py
|
||||
_______________ test_basic_objects[python3.4-python2.6-obj2] _______________
|
||||
|
||||
python1 = <multipython.Python object at 0x2afc7d8bf6d8>
|
||||
python2 = <multipython.Python object at 0x2afc7d8bf860>, obj = {1: 3}
|
||||
|
||||
@pytest.mark.parametrize("obj", [42, {}, {1:3},])
|
||||
def test_basic_objects(python1, python2, obj):
|
||||
python1.dumps(obj)
|
||||
> python2.load_and_is_true("obj == %s" % obj)
|
||||
|
||||
multipython.py:51:
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
multipython.py:46: in load_and_is_true
|
||||
py.process.cmdexec("%s %s" %(self.pythonpath, loadfile))
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
|
||||
cmd = '/home/hpk/bin/python2.6 /tmp/pytest-111/test_basic_objects_python3_4_p2/load.py'
|
||||
|
||||
def cmdexec(cmd):
|
||||
""" return unicode output of executing 'cmd' in a separate process.
|
||||
|
||||
raise cmdexec.Error exeception if the command failed.
|
||||
the exception will provide an 'err' attribute containing
|
||||
the error-output from the command.
|
||||
if the subprocess module does not provide a proper encoding/unicode strings
|
||||
sys.getdefaultencoding() will be used, if that does not exist, 'UTF-8'.
|
||||
"""
|
||||
process = subprocess.Popen(cmd, shell=True,
|
||||
universal_newlines=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = process.communicate()
|
||||
if sys.version_info[0] < 3: # on py3 we get unicode strings, on py2 not
|
||||
try:
|
||||
default_encoding = sys.getdefaultencoding() # jython may not have it
|
||||
except AttributeError:
|
||||
default_encoding = sys.stdout.encoding or 'UTF-8'
|
||||
out = unicode(out, process.stdout.encoding or default_encoding)
|
||||
err = unicode(err, process.stderr.encoding or default_encoding)
|
||||
status = process.poll()
|
||||
if status:
|
||||
> raise ExecutionFailed(status, status, cmd, out, err)
|
||||
E py.process.cmdexec.Error: ExecutionFailed: 1 /home/hpk/bin/python2.6 /tmp/pytest-111/test_basic_objects_python3_4_p2/load.py
|
||||
E Traceback (most recent call last):
|
||||
E File "/tmp/pytest-111/test_basic_objects_python3_4_p2/load.py", line 4, in <module>
|
||||
E obj = pickle.load(f)
|
||||
E File "/usr/lib/python2.6/pickle.py", line 1370, in load
|
||||
E return Unpickler(file).load()
|
||||
E File "/usr/lib/python2.6/pickle.py", line 858, in load
|
||||
E dispatch[key](self)
|
||||
E File "/usr/lib/python2.6/pickle.py", line 886, in load_proto
|
||||
E raise ValueError, "unsupported pickle protocol: %d" % proto
|
||||
E ValueError: unsupported pickle protocol: 3
|
||||
|
||||
../../../.tox/regen/lib/python3.4/site-packages/py/_process/cmdexec.py:28: Error
|
||||
--------------------------- Captured stdout call ---------------------------
|
||||
/tmp/pytest-111/test_basic_objects_python3_4_p2/load.py
|
||||
________________ test_basic_objects[python3.4-python2.7-42] ________________
|
||||
|
||||
python1 = <multipython.Python object at 0x2afc7d8b8710>
|
||||
python2 = <multipython.Python object at 0x2afc7d8b8748>, obj = 42
|
||||
|
||||
@pytest.mark.parametrize("obj", [42, {}, {1:3},])
|
||||
def test_basic_objects(python1, python2, obj):
|
||||
python1.dumps(obj)
|
||||
> python2.load_and_is_true("obj == %s" % obj)
|
||||
|
||||
multipython.py:51:
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
multipython.py:46: in load_and_is_true
|
||||
py.process.cmdexec("%s %s" %(self.pythonpath, loadfile))
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
|
||||
cmd = '/home/hpk/venv/0/bin/python2.7 /tmp/pytest-111/test_basic_objects_python3_4_p3/load.py'
|
||||
|
||||
def cmdexec(cmd):
|
||||
""" return unicode output of executing 'cmd' in a separate process.
|
||||
|
||||
raise cmdexec.Error exeception if the command failed.
|
||||
the exception will provide an 'err' attribute containing
|
||||
the error-output from the command.
|
||||
if the subprocess module does not provide a proper encoding/unicode strings
|
||||
sys.getdefaultencoding() will be used, if that does not exist, 'UTF-8'.
|
||||
"""
|
||||
process = subprocess.Popen(cmd, shell=True,
|
||||
universal_newlines=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = process.communicate()
|
||||
if sys.version_info[0] < 3: # on py3 we get unicode strings, on py2 not
|
||||
try:
|
||||
default_encoding = sys.getdefaultencoding() # jython may not have it
|
||||
except AttributeError:
|
||||
default_encoding = sys.stdout.encoding or 'UTF-8'
|
||||
out = unicode(out, process.stdout.encoding or default_encoding)
|
||||
err = unicode(err, process.stderr.encoding or default_encoding)
|
||||
status = process.poll()
|
||||
if status:
|
||||
> raise ExecutionFailed(status, status, cmd, out, err)
|
||||
E py.process.cmdexec.Error: ExecutionFailed: 1 /home/hpk/venv/0/bin/python2.7 /tmp/pytest-111/test_basic_objects_python3_4_p3/load.py
|
||||
E Traceback (most recent call last):
|
||||
E File "/tmp/pytest-111/test_basic_objects_python3_4_p3/load.py", line 4, in <module>
|
||||
E obj = pickle.load(f)
|
||||
E File "/usr/lib/python2.7/pickle.py", line 1378, in load
|
||||
E return Unpickler(file).load()
|
||||
E File "/usr/lib/python2.7/pickle.py", line 858, in load
|
||||
E dispatch[key](self)
|
||||
E File "/usr/lib/python2.7/pickle.py", line 886, in load_proto
|
||||
E raise ValueError, "unsupported pickle protocol: %d" % proto
|
||||
E ValueError: unsupported pickle protocol: 3
|
||||
|
||||
../../../.tox/regen/lib/python3.4/site-packages/py/_process/cmdexec.py:28: Error
|
||||
--------------------------- Captured stdout call ---------------------------
|
||||
/tmp/pytest-111/test_basic_objects_python3_4_p3/load.py
|
||||
_______________ test_basic_objects[python3.4-python2.7-obj1] _______________
|
||||
|
||||
python1 = <multipython.Python object at 0x2afc7d8bfb38>
|
||||
python2 = <multipython.Python object at 0x2afc7d8bf3c8>, obj = {}
|
||||
|
||||
@pytest.mark.parametrize("obj", [42, {}, {1:3},])
|
||||
def test_basic_objects(python1, python2, obj):
|
||||
python1.dumps(obj)
|
||||
> python2.load_and_is_true("obj == %s" % obj)
|
||||
|
||||
multipython.py:51:
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
multipython.py:46: in load_and_is_true
|
||||
py.process.cmdexec("%s %s" %(self.pythonpath, loadfile))
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
|
||||
cmd = '/home/hpk/venv/0/bin/python2.7 /tmp/pytest-111/test_basic_objects_python3_4_p4/load.py'
|
||||
|
||||
def cmdexec(cmd):
|
||||
""" return unicode output of executing 'cmd' in a separate process.
|
||||
|
||||
raise cmdexec.Error exeception if the command failed.
|
||||
the exception will provide an 'err' attribute containing
|
||||
the error-output from the command.
|
||||
if the subprocess module does not provide a proper encoding/unicode strings
|
||||
sys.getdefaultencoding() will be used, if that does not exist, 'UTF-8'.
|
||||
"""
|
||||
process = subprocess.Popen(cmd, shell=True,
|
||||
universal_newlines=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = process.communicate()
|
||||
if sys.version_info[0] < 3: # on py3 we get unicode strings, on py2 not
|
||||
try:
|
||||
default_encoding = sys.getdefaultencoding() # jython may not have it
|
||||
except AttributeError:
|
||||
default_encoding = sys.stdout.encoding or 'UTF-8'
|
||||
out = unicode(out, process.stdout.encoding or default_encoding)
|
||||
err = unicode(err, process.stderr.encoding or default_encoding)
|
||||
status = process.poll()
|
||||
if status:
|
||||
> raise ExecutionFailed(status, status, cmd, out, err)
|
||||
E py.process.cmdexec.Error: ExecutionFailed: 1 /home/hpk/venv/0/bin/python2.7 /tmp/pytest-111/test_basic_objects_python3_4_p4/load.py
|
||||
E Traceback (most recent call last):
|
||||
E File "/tmp/pytest-111/test_basic_objects_python3_4_p4/load.py", line 4, in <module>
|
||||
E obj = pickle.load(f)
|
||||
E File "/usr/lib/python2.7/pickle.py", line 1378, in load
|
||||
E return Unpickler(file).load()
|
||||
E File "/usr/lib/python2.7/pickle.py", line 858, in load
|
||||
E dispatch[key](self)
|
||||
E File "/usr/lib/python2.7/pickle.py", line 886, in load_proto
|
||||
E raise ValueError, "unsupported pickle protocol: %d" % proto
|
||||
E ValueError: unsupported pickle protocol: 3
|
||||
|
||||
../../../.tox/regen/lib/python3.4/site-packages/py/_process/cmdexec.py:28: Error
|
||||
--------------------------- Captured stdout call ---------------------------
|
||||
/tmp/pytest-111/test_basic_objects_python3_4_p4/load.py
|
||||
_______________ test_basic_objects[python3.4-python2.7-obj2] _______________
|
||||
|
||||
python1 = <multipython.Python object at 0x2afc7d8b86a0>
|
||||
python2 = <multipython.Python object at 0x2afc7d8c2a90>, obj = {1: 3}
|
||||
|
||||
@pytest.mark.parametrize("obj", [42, {}, {1:3},])
|
||||
def test_basic_objects(python1, python2, obj):
|
||||
python1.dumps(obj)
|
||||
> python2.load_and_is_true("obj == %s" % obj)
|
||||
|
||||
multipython.py:51:
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
multipython.py:46: in load_and_is_true
|
||||
py.process.cmdexec("%s %s" %(self.pythonpath, loadfile))
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
|
||||
cmd = '/home/hpk/venv/0/bin/python2.7 /tmp/pytest-111/test_basic_objects_python3_4_p5/load.py'
|
||||
|
||||
def cmdexec(cmd):
|
||||
""" return unicode output of executing 'cmd' in a separate process.
|
||||
|
||||
raise cmdexec.Error exeception if the command failed.
|
||||
the exception will provide an 'err' attribute containing
|
||||
the error-output from the command.
|
||||
if the subprocess module does not provide a proper encoding/unicode strings
|
||||
sys.getdefaultencoding() will be used, if that does not exist, 'UTF-8'.
|
||||
"""
|
||||
process = subprocess.Popen(cmd, shell=True,
|
||||
universal_newlines=True,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = process.communicate()
|
||||
if sys.version_info[0] < 3: # on py3 we get unicode strings, on py2 not
|
||||
try:
|
||||
default_encoding = sys.getdefaultencoding() # jython may not have it
|
||||
except AttributeError:
|
||||
default_encoding = sys.stdout.encoding or 'UTF-8'
|
||||
out = unicode(out, process.stdout.encoding or default_encoding)
|
||||
err = unicode(err, process.stderr.encoding or default_encoding)
|
||||
status = process.poll()
|
||||
if status:
|
||||
> raise ExecutionFailed(status, status, cmd, out, err)
|
||||
E py.process.cmdexec.Error: ExecutionFailed: 1 /home/hpk/venv/0/bin/python2.7 /tmp/pytest-111/test_basic_objects_python3_4_p5/load.py
|
||||
E Traceback (most recent call last):
|
||||
E File "/tmp/pytest-111/test_basic_objects_python3_4_p5/load.py", line 4, in <module>
|
||||
E obj = pickle.load(f)
|
||||
E File "/usr/lib/python2.7/pickle.py", line 1378, in load
|
||||
E return Unpickler(file).load()
|
||||
E File "/usr/lib/python2.7/pickle.py", line 858, in load
|
||||
E dispatch[key](self)
|
||||
E File "/usr/lib/python2.7/pickle.py", line 886, in load_proto
|
||||
E raise ValueError, "unsupported pickle protocol: %d" % proto
|
||||
E ValueError: unsupported pickle protocol: 3
|
||||
|
||||
../../../.tox/regen/lib/python3.4/site-packages/py/_process/cmdexec.py:28: Error
|
||||
--------------------------- Captured stdout call ---------------------------
|
||||
/tmp/pytest-111/test_basic_objects_python3_4_p5/load.py
|
||||
6 failed, 21 passed in 1.66 seconds
|
||||
...........................
|
||||
27 passed in 1.70 seconds
|
||||
|
||||
Indirect parametrization of optional implementations/imports
|
||||
--------------------------------------------------------------------
|
||||
@@ -664,12 +395,13 @@ If you run this with reporting for skips enabled::
|
||||
|
||||
$ py.test -rs test_module.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-169, inifile:
|
||||
collected 2 items
|
||||
|
||||
test_module.py .s
|
||||
========================= short test summary info ==========================
|
||||
SKIP [1] /tmp/doc-exec-70/conftest.py:10: could not import 'opt2'
|
||||
SKIP [1] /tmp/doc-exec-169/conftest.py:10: could not import 'opt2'
|
||||
|
||||
=================== 1 passed, 1 skipped in 0.01 seconds ====================
|
||||
|
||||
|
||||
@@ -26,36 +26,37 @@ the :confval:`python_files`, :confval:`python_classes` and
|
||||
[pytest]
|
||||
python_files=check_*.py
|
||||
python_classes=Check
|
||||
python_functions=check
|
||||
python_functions=*_check
|
||||
|
||||
This would make ``pytest`` look for ``check_`` prefixes in
|
||||
Python filenames, ``Check`` prefixes in classes and ``check`` prefixes
|
||||
in functions and classes. For example, if we have::
|
||||
This would make ``pytest`` look for tests in files that match the ``check_*
|
||||
.py`` glob-pattern, ``Check`` prefixes in classes, and functions and methods
|
||||
that match ``*_check``. For example, if we have::
|
||||
|
||||
# content of check_myapp.py
|
||||
class CheckMyApp:
|
||||
def check_simple(self):
|
||||
def simple_check(self):
|
||||
pass
|
||||
def check_complex(self):
|
||||
def complex_check(self):
|
||||
pass
|
||||
|
||||
then the test collection looks like this::
|
||||
|
||||
$ py.test --collect-only
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-170, inifile: setup.cfg
|
||||
collected 2 items
|
||||
<Module 'check_myapp.py'>
|
||||
<Class 'CheckMyApp'>
|
||||
<Instance '()'>
|
||||
<Function 'check_simple'>
|
||||
<Function 'check_complex'>
|
||||
<Function 'simple_check'>
|
||||
<Function 'complex_check'>
|
||||
|
||||
============================= in 0.01 seconds =============================
|
||||
|
||||
.. note::
|
||||
|
||||
the ``python_functions`` and ``python_classes`` has no effect
|
||||
the ``python_functions`` and ``python_classes`` options has no effect
|
||||
for ``unittest.TestCase`` test discovery because pytest delegates
|
||||
detection of test case methods to unittest code.
|
||||
|
||||
@@ -88,9 +89,10 @@ You can always peek at the collection tree without running tests like this::
|
||||
|
||||
. $ py.test --collect-only pythoncollection.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /home/hpk/p/pytest/doc/en, inifile: pytest.ini
|
||||
collected 3 items
|
||||
<Module 'pythoncollection.py'>
|
||||
<Module 'example/pythoncollection.py'>
|
||||
<Function 'test_function'>
|
||||
<Class 'TestClass'>
|
||||
<Instance '()'>
|
||||
@@ -141,7 +143,8 @@ interpreters and will leave out the setup.py file::
|
||||
|
||||
$ py.test --collect-only
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-170, inifile: pytest.ini
|
||||
collected 0 items
|
||||
|
||||
============================= in 0.00 seconds =============================
|
||||
|
||||
@@ -13,7 +13,8 @@ get on the terminal - we are working on that):
|
||||
|
||||
assertion $ py.test failure_demo.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /home/hpk/p/pytest/doc/en, inifile: pytest.ini
|
||||
collected 42 items
|
||||
|
||||
failure_demo.py FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
@@ -30,7 +31,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:15: AssertionError
|
||||
_________________________ TestFailing.test_simple __________________________
|
||||
|
||||
self = <failure_demo.TestFailing object at 0x2b4436e4d390>
|
||||
self = <failure_demo.TestFailing object at 0x2b186edcf6a0>
|
||||
|
||||
def test_simple(self):
|
||||
def f():
|
||||
@@ -40,13 +41,13 @@ get on the terminal - we are working on that):
|
||||
|
||||
> assert f() == g()
|
||||
E assert 42 == 43
|
||||
E + where 42 = <function TestFailing.test_simple.<locals>.f at 0x2b4436f1e6a8>()
|
||||
E + and 43 = <function TestFailing.test_simple.<locals>.g at 0x2b4436f1e7b8>()
|
||||
E + where 42 = <function TestFailing.test_simple.<locals>.f at 0x2b186edd09d8>()
|
||||
E + and 43 = <function TestFailing.test_simple.<locals>.g at 0x2b186edd9950>()
|
||||
|
||||
failure_demo.py:28: AssertionError
|
||||
____________________ TestFailing.test_simple_multiline _____________________
|
||||
|
||||
self = <failure_demo.TestFailing object at 0x2b4436f167b8>
|
||||
self = <failure_demo.TestFailing object at 0x2b186e2942e8>
|
||||
|
||||
def test_simple_multiline(self):
|
||||
otherfunc_multi(
|
||||
@@ -66,19 +67,19 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:11: AssertionError
|
||||
___________________________ TestFailing.test_not ___________________________
|
||||
|
||||
self = <failure_demo.TestFailing object at 0x2b4436f12668>
|
||||
self = <failure_demo.TestFailing object at 0x2b186e270630>
|
||||
|
||||
def test_not(self):
|
||||
def f():
|
||||
return 42
|
||||
> assert not f()
|
||||
E assert not 42
|
||||
E + where 42 = <function TestFailing.test_not.<locals>.f at 0x2b4436f1ebf8>()
|
||||
E + where 42 = <function TestFailing.test_not.<locals>.f at 0x2b186edd99d8>()
|
||||
|
||||
failure_demo.py:38: AssertionError
|
||||
_________________ TestSpecialisedExplanations.test_eq_text _________________
|
||||
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b4436efaba8>
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b186eea7048>
|
||||
|
||||
def test_eq_text(self):
|
||||
> assert 'spam' == 'eggs'
|
||||
@@ -89,7 +90,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:42: AssertionError
|
||||
_____________ TestSpecialisedExplanations.test_eq_similar_text _____________
|
||||
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b4436ee02e8>
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b186ed9aa58>
|
||||
|
||||
def test_eq_similar_text(self):
|
||||
> assert 'foo 1 bar' == 'foo 2 bar'
|
||||
@@ -102,7 +103,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:45: AssertionError
|
||||
____________ TestSpecialisedExplanations.test_eq_multiline_text ____________
|
||||
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b4436ed5e48>
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b186ee904a8>
|
||||
|
||||
def test_eq_multiline_text(self):
|
||||
> assert 'foo\nspam\nbar' == 'foo\neggs\nbar'
|
||||
@@ -115,7 +116,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:48: AssertionError
|
||||
______________ TestSpecialisedExplanations.test_eq_long_text _______________
|
||||
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b4436ed2240>
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b186ee8d828>
|
||||
|
||||
def test_eq_long_text(self):
|
||||
a = '1'*100 + 'a' + '2'*100
|
||||
@@ -132,7 +133,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:53: AssertionError
|
||||
_________ TestSpecialisedExplanations.test_eq_long_text_multiline __________
|
||||
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b4436f18780>
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b186e28cb00>
|
||||
|
||||
def test_eq_long_text_multiline(self):
|
||||
a = '1\n'*100 + 'a' + '2\n'*100
|
||||
@@ -156,7 +157,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:58: AssertionError
|
||||
_________________ TestSpecialisedExplanations.test_eq_list _________________
|
||||
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b4436e42b00>
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b186ee879b0>
|
||||
|
||||
def test_eq_list(self):
|
||||
> assert [0, 1, 2] == [0, 1, 3]
|
||||
@@ -167,7 +168,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:61: AssertionError
|
||||
______________ TestSpecialisedExplanations.test_eq_list_long _______________
|
||||
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b4436f164e0>
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b186e28eb70>
|
||||
|
||||
def test_eq_list_long(self):
|
||||
a = [0]*100 + [1] + [3]*100
|
||||
@@ -180,7 +181,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:66: AssertionError
|
||||
_________________ TestSpecialisedExplanations.test_eq_dict _________________
|
||||
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b4436f12c50>
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b186ee78860>
|
||||
|
||||
def test_eq_dict(self):
|
||||
> assert {'a': 0, 'b': 1, 'c': 0} == {'a': 0, 'b': 2, 'd': 0}
|
||||
@@ -197,7 +198,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:69: AssertionError
|
||||
_________________ TestSpecialisedExplanations.test_eq_set __________________
|
||||
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b4436ec1208>
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b186eea6588>
|
||||
|
||||
def test_eq_set(self):
|
||||
> assert set([0, 10, 11, 12]) == set([0, 20, 21])
|
||||
@@ -214,7 +215,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:72: AssertionError
|
||||
_____________ TestSpecialisedExplanations.test_eq_longer_list ______________
|
||||
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b4436efab70>
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b186ecbdc50>
|
||||
|
||||
def test_eq_longer_list(self):
|
||||
> assert [1,2] == [1,2,3]
|
||||
@@ -225,7 +226,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:75: AssertionError
|
||||
_________________ TestSpecialisedExplanations.test_in_list _________________
|
||||
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b4436d73278>
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b186eeb0518>
|
||||
|
||||
def test_in_list(self):
|
||||
> assert 1 in [0, 2, 3, 4, 5]
|
||||
@@ -234,7 +235,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:78: AssertionError
|
||||
__________ TestSpecialisedExplanations.test_not_in_text_multiline __________
|
||||
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b4436ebfac8>
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b186eeb1860>
|
||||
|
||||
def test_not_in_text_multiline(self):
|
||||
text = 'some multiline\ntext\nwhich\nincludes foo\nand a\ntail'
|
||||
@@ -252,7 +253,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:82: AssertionError
|
||||
___________ TestSpecialisedExplanations.test_not_in_text_single ____________
|
||||
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b4436ee0898>
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b186ee9e4a8>
|
||||
|
||||
def test_not_in_text_single(self):
|
||||
text = 'single foo line'
|
||||
@@ -265,7 +266,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:86: AssertionError
|
||||
_________ TestSpecialisedExplanations.test_not_in_text_single_long _________
|
||||
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b4436ed5748>
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b186eea6908>
|
||||
|
||||
def test_not_in_text_single_long(self):
|
||||
text = 'head ' * 50 + 'foo ' + 'tail ' * 20
|
||||
@@ -278,7 +279,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:90: AssertionError
|
||||
______ TestSpecialisedExplanations.test_not_in_text_single_long_term _______
|
||||
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b4436e4db70>
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0x2b186ee908d0>
|
||||
|
||||
def test_not_in_text_single_long_term(self):
|
||||
text = 'head ' * 50 + 'f'*70 + 'tail ' * 20
|
||||
@@ -297,7 +298,7 @@ get on the terminal - we are working on that):
|
||||
i = Foo()
|
||||
> assert i.b == 2
|
||||
E assert 1 == 2
|
||||
E + where 1 = <failure_demo.test_attribute.<locals>.Foo object at 0x2b4436e42ac8>.b
|
||||
E + where 1 = <failure_demo.test_attribute.<locals>.Foo object at 0x2b186ee8d4e0>.b
|
||||
|
||||
failure_demo.py:101: AssertionError
|
||||
_________________________ test_attribute_instance __________________________
|
||||
@@ -307,8 +308,8 @@ get on the terminal - we are working on that):
|
||||
b = 1
|
||||
> assert Foo().b == 2
|
||||
E assert 1 == 2
|
||||
E + where 1 = <failure_demo.test_attribute_instance.<locals>.Foo object at 0x2b4436f185c0>.b
|
||||
E + where <failure_demo.test_attribute_instance.<locals>.Foo object at 0x2b4436f185c0> = <class 'failure_demo.test_attribute_instance.<locals>.Foo'>()
|
||||
E + where 1 = <failure_demo.test_attribute_instance.<locals>.Foo object at 0x2b186eea6240>.b
|
||||
E + where <failure_demo.test_attribute_instance.<locals>.Foo object at 0x2b186eea6240> = <class 'failure_demo.test_attribute_instance.<locals>.Foo'>()
|
||||
|
||||
failure_demo.py:107: AssertionError
|
||||
__________________________ test_attribute_failure __________________________
|
||||
@@ -324,7 +325,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:116:
|
||||
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
||||
|
||||
self = <failure_demo.test_attribute_failure.<locals>.Foo object at 0x2b4436f16a58>
|
||||
self = <failure_demo.test_attribute_failure.<locals>.Foo object at 0x2b186ed9a4e0>
|
||||
|
||||
def _get_b(self):
|
||||
> raise Exception('Failed to get attrib')
|
||||
@@ -340,15 +341,15 @@ get on the terminal - we are working on that):
|
||||
b = 2
|
||||
> assert Foo().b == Bar().b
|
||||
E assert 1 == 2
|
||||
E + where 1 = <failure_demo.test_attribute_multiple.<locals>.Foo object at 0x2b4436f12a90>.b
|
||||
E + where <failure_demo.test_attribute_multiple.<locals>.Foo object at 0x2b4436f12a90> = <class 'failure_demo.test_attribute_multiple.<locals>.Foo'>()
|
||||
E + and 2 = <failure_demo.test_attribute_multiple.<locals>.Bar object at 0x2b4436f12ac8>.b
|
||||
E + where <failure_demo.test_attribute_multiple.<locals>.Bar object at 0x2b4436f12ac8> = <class 'failure_demo.test_attribute_multiple.<locals>.Bar'>()
|
||||
E + where 1 = <failure_demo.test_attribute_multiple.<locals>.Foo object at 0x2b186ee78630>.b
|
||||
E + where <failure_demo.test_attribute_multiple.<locals>.Foo object at 0x2b186ee78630> = <class 'failure_demo.test_attribute_multiple.<locals>.Foo'>()
|
||||
E + and 2 = <failure_demo.test_attribute_multiple.<locals>.Bar object at 0x2b186ee78358>.b
|
||||
E + where <failure_demo.test_attribute_multiple.<locals>.Bar object at 0x2b186ee78358> = <class 'failure_demo.test_attribute_multiple.<locals>.Bar'>()
|
||||
|
||||
failure_demo.py:124: AssertionError
|
||||
__________________________ TestRaises.test_raises __________________________
|
||||
|
||||
self = <failure_demo.TestRaises object at 0x2b4436ec1d68>
|
||||
self = <failure_demo.TestRaises object at 0x2b186e270b38>
|
||||
|
||||
def test_raises(self):
|
||||
s = 'qwe'
|
||||
@@ -360,10 +361,10 @@ get on the terminal - we are working on that):
|
||||
> int(s)
|
||||
E ValueError: invalid literal for int() with base 10: 'qwe'
|
||||
|
||||
<0-codegen /home/hpk/p/pytest/.tox/regen/lib/python3.4/site-packages/_pytest/python.py:1028>:1: ValueError
|
||||
<0-codegen /home/hpk/p/pytest/.tox/regen/lib/python3.4/site-packages/_pytest/python.py:1075>:1: ValueError
|
||||
______________________ TestRaises.test_raises_doesnt _______________________
|
||||
|
||||
self = <failure_demo.TestRaises object at 0x2b4436ee9860>
|
||||
self = <failure_demo.TestRaises object at 0x2b186eeab2b0>
|
||||
|
||||
def test_raises_doesnt(self):
|
||||
> raises(IOError, "int('3')")
|
||||
@@ -372,7 +373,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:136: Failed
|
||||
__________________________ TestRaises.test_raise ___________________________
|
||||
|
||||
self = <failure_demo.TestRaises object at 0x2b4436ed5198>
|
||||
self = <failure_demo.TestRaises object at 0x2b186ee75358>
|
||||
|
||||
def test_raise(self):
|
||||
> raise ValueError("demo error")
|
||||
@@ -381,7 +382,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:139: ValueError
|
||||
________________________ TestRaises.test_tupleerror ________________________
|
||||
|
||||
self = <failure_demo.TestRaises object at 0x2b4436ebf320>
|
||||
self = <failure_demo.TestRaises object at 0x2b186e285978>
|
||||
|
||||
def test_tupleerror(self):
|
||||
> a,b = [1]
|
||||
@@ -390,7 +391,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:142: ValueError
|
||||
______ TestRaises.test_reinterpret_fails_with_print_for_the_fun_of_it ______
|
||||
|
||||
self = <failure_demo.TestRaises object at 0x2b4436f1c6d8>
|
||||
self = <failure_demo.TestRaises object at 0x2b186edcfe48>
|
||||
|
||||
def test_reinterpret_fails_with_print_for_the_fun_of_it(self):
|
||||
l = [1,2,3]
|
||||
@@ -403,7 +404,7 @@ get on the terminal - we are working on that):
|
||||
l is [1, 2, 3]
|
||||
________________________ TestRaises.test_some_error ________________________
|
||||
|
||||
self = <failure_demo.TestRaises object at 0x2b4436e6abe0>
|
||||
self = <failure_demo.TestRaises object at 0x2b186eeb1898>
|
||||
|
||||
def test_some_error(self):
|
||||
> if namenotexi:
|
||||
@@ -431,7 +432,7 @@ get on the terminal - we are working on that):
|
||||
<2-codegen 'abc-123' /home/hpk/p/pytest/doc/en/example/assertion/failure_demo.py:162>:2: AssertionError
|
||||
____________________ TestMoreErrors.test_complex_error _____________________
|
||||
|
||||
self = <failure_demo.TestMoreErrors object at 0x2b4436ee59e8>
|
||||
self = <failure_demo.TestMoreErrors object at 0x2b186e270358>
|
||||
|
||||
def test_complex_error(self):
|
||||
def f():
|
||||
@@ -455,7 +456,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:5: AssertionError
|
||||
___________________ TestMoreErrors.test_z1_unpack_error ____________________
|
||||
|
||||
self = <failure_demo.TestMoreErrors object at 0x2b4436f1a940>
|
||||
self = <failure_demo.TestMoreErrors object at 0x2b186ecbdba8>
|
||||
|
||||
def test_z1_unpack_error(self):
|
||||
l = []
|
||||
@@ -465,7 +466,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:179: ValueError
|
||||
____________________ TestMoreErrors.test_z2_type_error _____________________
|
||||
|
||||
self = <failure_demo.TestMoreErrors object at 0x2b4436ef1ef0>
|
||||
self = <failure_demo.TestMoreErrors object at 0x2b186ee78550>
|
||||
|
||||
def test_z2_type_error(self):
|
||||
l = 3
|
||||
@@ -475,19 +476,19 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:183: TypeError
|
||||
______________________ TestMoreErrors.test_startswith ______________________
|
||||
|
||||
self = <failure_demo.TestMoreErrors object at 0x2b4436f16710>
|
||||
self = <failure_demo.TestMoreErrors object at 0x2b186ee90978>
|
||||
|
||||
def test_startswith(self):
|
||||
s = "123"
|
||||
g = "456"
|
||||
> assert s.startswith(g)
|
||||
E assert <built-in method startswith of str object at 0x2b4436e42ea0>('456')
|
||||
E + where <built-in method startswith of str object at 0x2b4436e42ea0> = '123'.startswith
|
||||
E assert <built-in method startswith of str object at 0x2b186eea6500>('456')
|
||||
E + where <built-in method startswith of str object at 0x2b186eea6500> = '123'.startswith
|
||||
|
||||
failure_demo.py:188: AssertionError
|
||||
__________________ TestMoreErrors.test_startswith_nested ___________________
|
||||
|
||||
self = <failure_demo.TestMoreErrors object at 0x2b4436f18c88>
|
||||
self = <failure_demo.TestMoreErrors object at 0x2b186eeab358>
|
||||
|
||||
def test_startswith_nested(self):
|
||||
def f():
|
||||
@@ -495,15 +496,15 @@ get on the terminal - we are working on that):
|
||||
def g():
|
||||
return "456"
|
||||
> assert f().startswith(g())
|
||||
E assert <built-in method startswith of str object at 0x2b4436e42ea0>('456')
|
||||
E + where <built-in method startswith of str object at 0x2b4436e42ea0> = '123'.startswith
|
||||
E + where '123' = <function TestMoreErrors.test_startswith_nested.<locals>.f at 0x2b4436f1e950>()
|
||||
E + and '456' = <function TestMoreErrors.test_startswith_nested.<locals>.g at 0x2b4436f1e840>()
|
||||
E assert <built-in method startswith of str object at 0x2b186eea6500>('456')
|
||||
E + where <built-in method startswith of str object at 0x2b186eea6500> = '123'.startswith
|
||||
E + where '123' = <function TestMoreErrors.test_startswith_nested.<locals>.f at 0x2b186eea1510>()
|
||||
E + and '456' = <function TestMoreErrors.test_startswith_nested.<locals>.g at 0x2b186eea1268>()
|
||||
|
||||
failure_demo.py:195: AssertionError
|
||||
_____________________ TestMoreErrors.test_global_func ______________________
|
||||
|
||||
self = <failure_demo.TestMoreErrors object at 0x2b4436eed0f0>
|
||||
self = <failure_demo.TestMoreErrors object at 0x2b186e28c7f0>
|
||||
|
||||
def test_global_func(self):
|
||||
> assert isinstance(globf(42), float)
|
||||
@@ -513,18 +514,18 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:198: AssertionError
|
||||
_______________________ TestMoreErrors.test_instance _______________________
|
||||
|
||||
self = <failure_demo.TestMoreErrors object at 0x2b4436e67c50>
|
||||
self = <failure_demo.TestMoreErrors object at 0x2b186ee759b0>
|
||||
|
||||
def test_instance(self):
|
||||
self.x = 6*7
|
||||
> assert self.x != 42
|
||||
E assert 42 != 42
|
||||
E + where 42 = <failure_demo.TestMoreErrors object at 0x2b4436e67c50>.x
|
||||
E + where 42 = <failure_demo.TestMoreErrors object at 0x2b186ee759b0>.x
|
||||
|
||||
failure_demo.py:202: AssertionError
|
||||
_______________________ TestMoreErrors.test_compare ________________________
|
||||
|
||||
self = <failure_demo.TestMoreErrors object at 0x2b4436ebf668>
|
||||
self = <failure_demo.TestMoreErrors object at 0x2b186ecbdf60>
|
||||
|
||||
def test_compare(self):
|
||||
> assert globf(10) < 5
|
||||
@@ -534,7 +535,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:205: AssertionError
|
||||
_____________________ TestMoreErrors.test_try_finally ______________________
|
||||
|
||||
self = <failure_demo.TestMoreErrors object at 0x2b4436edf588>
|
||||
self = <failure_demo.TestMoreErrors object at 0x2b186eeb1e48>
|
||||
|
||||
def test_try_finally(self):
|
||||
x = 1
|
||||
@@ -545,7 +546,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:210: AssertionError
|
||||
___________________ TestCustomAssertMsg.test_single_line ___________________
|
||||
|
||||
self = <failure_demo.TestCustomAssertMsg object at 0x2b4436ed5128>
|
||||
self = <failure_demo.TestCustomAssertMsg object at 0x2b186ed9a748>
|
||||
|
||||
def test_single_line(self):
|
||||
class A:
|
||||
@@ -559,7 +560,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:221: AssertionError
|
||||
____________________ TestCustomAssertMsg.test_multiline ____________________
|
||||
|
||||
self = <failure_demo.TestCustomAssertMsg object at 0x2b4436e6ad30>
|
||||
self = <failure_demo.TestCustomAssertMsg object at 0x2b186ee8d630>
|
||||
|
||||
def test_multiline(self):
|
||||
class A:
|
||||
@@ -576,7 +577,7 @@ get on the terminal - we are working on that):
|
||||
failure_demo.py:227: AssertionError
|
||||
___________________ TestCustomAssertMsg.test_custom_repr ___________________
|
||||
|
||||
self = <failure_demo.TestCustomAssertMsg object at 0x2b4436ee92b0>
|
||||
self = <failure_demo.TestCustomAssertMsg object at 0x2b186e270e48>
|
||||
|
||||
def test_custom_repr(self):
|
||||
class JSON:
|
||||
@@ -594,4 +595,4 @@ get on the terminal - we are working on that):
|
||||
E + where 1 = This is JSON\n{\n 'foo': 'bar'\n}.a
|
||||
|
||||
failure_demo.py:237: AssertionError
|
||||
======================== 42 failed in 0.23 seconds =========================
|
||||
======================== 42 failed in 0.22 seconds =========================
|
||||
|
||||
@@ -108,7 +108,8 @@ directory with the above conftest.py::
|
||||
|
||||
$ py.test
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-172, inifile:
|
||||
collected 0 items
|
||||
|
||||
============================= in 0.00 seconds =============================
|
||||
@@ -152,12 +153,13 @@ and when running it will see a skipped "slow" test::
|
||||
|
||||
$ py.test -rs # "-rs" means report details on the little 's'
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-172, inifile:
|
||||
collected 2 items
|
||||
|
||||
test_module.py .s
|
||||
========================= short test summary info ==========================
|
||||
SKIP [1] /tmp/doc-exec-73/conftest.py:9: need --runslow option to run
|
||||
SKIP [1] /tmp/doc-exec-172/conftest.py:9: need --runslow option to run
|
||||
|
||||
=================== 1 passed, 1 skipped in 0.01 seconds ====================
|
||||
|
||||
@@ -165,7 +167,8 @@ Or run it including the ``slow`` marked test::
|
||||
|
||||
$ py.test --runslow
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-172, inifile:
|
||||
collected 2 items
|
||||
|
||||
test_module.py ..
|
||||
@@ -256,7 +259,8 @@ which will add the string to the test header accordingly::
|
||||
|
||||
$ py.test
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-172, inifile:
|
||||
project deps: mylib-1.1
|
||||
collected 0 items
|
||||
|
||||
@@ -279,7 +283,8 @@ which will add info only when run with "--v"::
|
||||
|
||||
$ py.test -v
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
rootdir: /tmp/doc-exec-172, inifile:
|
||||
info1: did you know that ...
|
||||
did you?
|
||||
collecting ... collected 0 items
|
||||
@@ -290,7 +295,8 @@ and nothing when run plainly::
|
||||
|
||||
$ py.test
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-172, inifile:
|
||||
collected 0 items
|
||||
|
||||
============================= in 0.00 seconds =============================
|
||||
@@ -322,7 +328,8 @@ Now we can profile which test functions execute the slowest::
|
||||
|
||||
$ py.test --durations=3
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-172, inifile:
|
||||
collected 3 items
|
||||
|
||||
test_some_are_slow.py ...
|
||||
@@ -383,7 +390,8 @@ If we run this::
|
||||
|
||||
$ py.test -rx
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-172, inifile:
|
||||
collected 4 items
|
||||
|
||||
test_step.py .Fx.
|
||||
@@ -391,7 +399,7 @@ If we run this::
|
||||
================================= FAILURES =================================
|
||||
____________________ TestUserHandling.test_modification ____________________
|
||||
|
||||
self = <test_step.TestUserHandling object at 0x2aad15c6d048>
|
||||
self = <test_step.TestUserHandling object at 0x2b9ab60ccfd0>
|
||||
|
||||
def test_modification(self):
|
||||
> assert 0
|
||||
@@ -453,7 +461,8 @@ We can run this::
|
||||
|
||||
$ py.test
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-172, inifile:
|
||||
collected 7 items
|
||||
|
||||
test_step.py .Fx.
|
||||
@@ -463,17 +472,17 @@ We can run this::
|
||||
|
||||
================================== ERRORS ==================================
|
||||
_______________________ ERROR at setup of test_root ________________________
|
||||
file /tmp/doc-exec-73/b/test_error.py, line 1
|
||||
file /tmp/doc-exec-172/b/test_error.py, line 1
|
||||
def test_root(db): # no db here, will error out
|
||||
fixture 'db' not found
|
||||
available fixtures: monkeypatch, pytestconfig, tmpdir, capfd, capsys, recwarn
|
||||
available fixtures: pytestconfig, tmpdir, monkeypatch, capfd, recwarn, capsys
|
||||
use 'py.test --fixtures [testpath]' for help on them.
|
||||
|
||||
/tmp/doc-exec-73/b/test_error.py:1
|
||||
/tmp/doc-exec-172/b/test_error.py:1
|
||||
================================= FAILURES =================================
|
||||
____________________ TestUserHandling.test_modification ____________________
|
||||
|
||||
self = <test_step.TestUserHandling object at 0x2b058dc29e10>
|
||||
self = <test_step.TestUserHandling object at 0x2aec569b87b8>
|
||||
|
||||
def test_modification(self):
|
||||
> assert 0
|
||||
@@ -482,21 +491,21 @@ We can run this::
|
||||
test_step.py:9: AssertionError
|
||||
_________________________________ test_a1 __________________________________
|
||||
|
||||
db = <conftest.DB object at 0x2b058db494a8>
|
||||
db = <conftest.DB object at 0x2aec569d1588>
|
||||
|
||||
def test_a1(db):
|
||||
> assert 0, db # to show value
|
||||
E AssertionError: <conftest.DB object at 0x2b058db494a8>
|
||||
E AssertionError: <conftest.DB object at 0x2aec569d1588>
|
||||
E assert 0
|
||||
|
||||
a/test_db.py:2: AssertionError
|
||||
_________________________________ test_a2 __________________________________
|
||||
|
||||
db = <conftest.DB object at 0x2b058db494a8>
|
||||
db = <conftest.DB object at 0x2aec569d1588>
|
||||
|
||||
def test_a2(db):
|
||||
> assert 0, db # to show value
|
||||
E AssertionError: <conftest.DB object at 0x2b058db494a8>
|
||||
E AssertionError: <conftest.DB object at 0x2aec569d1588>
|
||||
E assert 0
|
||||
|
||||
a/test_db2.py:2: AssertionError
|
||||
@@ -555,7 +564,8 @@ and run them::
|
||||
|
||||
$ py.test test_module.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-172, inifile:
|
||||
collected 2 items
|
||||
|
||||
test_module.py FF
|
||||
@@ -563,7 +573,7 @@ and run them::
|
||||
================================= FAILURES =================================
|
||||
________________________________ test_fail1 ________________________________
|
||||
|
||||
tmpdir = local('/tmp/pytest-112/test_fail10')
|
||||
tmpdir = local('/tmp/pytest-219/test_fail10')
|
||||
|
||||
def test_fail1(tmpdir):
|
||||
> assert 0
|
||||
@@ -577,12 +587,12 @@ and run them::
|
||||
E assert 0
|
||||
|
||||
test_module.py:4: AssertionError
|
||||
========================= 2 failed in 0.02 seconds =========================
|
||||
========================= 2 failed in 0.01 seconds =========================
|
||||
|
||||
you will have a "failures" file which contains the failing test ids::
|
||||
|
||||
$ cat failures
|
||||
test_module.py::test_fail1 (/tmp/pytest-112/test_fail10)
|
||||
test_module.py::test_fail1 (/tmp/pytest-219/test_fail10)
|
||||
test_module.py::test_fail2
|
||||
|
||||
Making test result information available in fixtures
|
||||
@@ -645,7 +655,8 @@ and run it::
|
||||
|
||||
$ py.test -s test_module.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-172, inifile:
|
||||
collected 3 items
|
||||
|
||||
test_module.py Esetting up a test failed! test_module.py::test_setup_fails
|
||||
|
||||
@@ -30,15 +30,15 @@ and does not handle Deferreds returned from a test in pytest style.
|
||||
If you are using trial's unittest.TestCase chances are that you can
|
||||
just run your tests even if you return Deferreds. In addition,
|
||||
there also is a dedicated `pytest-twisted
|
||||
<http://pypi.python.org/pypi/pytest-twisted>`_ plugin which allows to
|
||||
return deferreds from pytest-style tests, allowing to use
|
||||
<http://pypi.python.org/pypi/pytest-twisted>`_ plugin which allows you to
|
||||
return deferreds from pytest-style tests, allowing the use of
|
||||
:ref:`fixtures` and other features.
|
||||
|
||||
how does pytest work with Django?
|
||||
++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
In 2012, some work is going into the `pytest-django plugin <http://pypi.python.org/pypi/pytest-django>`_. It substitutes the usage of Django's
|
||||
``manage.py test`` and allows to use all pytest features_ most of which
|
||||
``manage.py test`` and allows the use of all pytest features_ most of which
|
||||
are not available from Django directly.
|
||||
|
||||
.. _features: features.html
|
||||
@@ -49,7 +49,7 @@ What's this "magic" with pytest? (historic notes)
|
||||
|
||||
Around 2007 (version ``0.8``) some people thought that ``pytest``
|
||||
was using too much "magic". It had been part of the `pylib`_ which
|
||||
contains a lot of unreleated python library code. Around 2010 there
|
||||
contains a lot of unrelated python library code. Around 2010 there
|
||||
was a major cleanup refactoring, which removed unused or deprecated code
|
||||
and resulted in the new ``pytest`` PyPI package which strictly contains
|
||||
only test-related code. This release also brought a complete pluginification
|
||||
@@ -63,7 +63,7 @@ A second "magic" issue was the assert statement debugging feature.
|
||||
Nowadays, ``pytest`` explicitely rewrites assert statements in test modules
|
||||
in order to provide more useful :ref:`assert feedback <assertfeedback>`.
|
||||
This completely avoids previous issues of confusing assertion-reporting.
|
||||
It also means, that you can use Python's ``-O`` optimization without loosing
|
||||
It also means, that you can use Python's ``-O`` optimization without losing
|
||||
assertions in test modules.
|
||||
|
||||
``pytest`` contains a second, mostly obsolete, assert debugging technique,
|
||||
@@ -152,13 +152,13 @@ pytest interaction with other packages
|
||||
Issues with pytest, multiprocess and setuptools?
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
On windows the multiprocess package will instantiate sub processes
|
||||
On Windows the multiprocess package will instantiate sub processes
|
||||
by pickling and thus implicitly re-import a lot of local modules.
|
||||
Unfortunately, setuptools-0.6.11 does not ``if __name__=='__main__'``
|
||||
protect its generated command line script. This leads to infinite
|
||||
recursion when running a test that instantiates Processes.
|
||||
|
||||
As of middle 2013, there shouldn't be a problem anymore when you
|
||||
As of mid-2013, there shouldn't be a problem anymore when you
|
||||
use the standard setuptools (note that distribute has been merged
|
||||
back into setuptools which is now shipped directly with virtualenv).
|
||||
|
||||
|
||||
@@ -67,7 +67,6 @@ using it::
|
||||
def test_ehlo(smtp):
|
||||
response, msg = smtp.ehlo()
|
||||
assert response == 250
|
||||
assert "merlinux" in msg
|
||||
assert 0 # for demo purposes
|
||||
|
||||
Here, the ``test_ehlo`` needs the ``smtp`` fixture value. pytest
|
||||
@@ -76,7 +75,8 @@ marked ``smtp`` fixture function. Running the test looks like this::
|
||||
|
||||
$ py.test test_smtpsimple.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-109, inifile:
|
||||
collected 1 items
|
||||
|
||||
test_smtpsimple.py F
|
||||
@@ -84,16 +84,16 @@ marked ``smtp`` fixture function. Running the test looks like this::
|
||||
================================= FAILURES =================================
|
||||
________________________________ test_ehlo _________________________________
|
||||
|
||||
smtp = <smtplib.SMTP object at 0x2b88f2d1b0b8>
|
||||
smtp = <smtplib.SMTP object at 0x2b058f0f53c8>
|
||||
|
||||
def test_ehlo(smtp):
|
||||
response, msg = smtp.ehlo()
|
||||
assert response == 250
|
||||
> assert "merlinux" in msg
|
||||
E TypeError: Type str doesn't support the buffer API
|
||||
> assert 0 # for demo purposes
|
||||
E assert 0
|
||||
|
||||
test_smtpsimple.py:11: TypeError
|
||||
========================= 1 failed in 0.28 seconds =========================
|
||||
test_smtpsimple.py:11: AssertionError
|
||||
========================= 1 failed in 0.17 seconds =========================
|
||||
|
||||
In the failure traceback we see that the test function was called with a
|
||||
``smtp`` argument, the ``smtplib.SMTP()`` instance created by the fixture
|
||||
@@ -193,7 +193,8 @@ inspect what is going on and can now run the tests::
|
||||
|
||||
$ py.test test_module.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-109, inifile:
|
||||
collected 2 items
|
||||
|
||||
test_module.py FF
|
||||
@@ -201,7 +202,7 @@ inspect what is going on and can now run the tests::
|
||||
================================= FAILURES =================================
|
||||
________________________________ test_ehlo _________________________________
|
||||
|
||||
smtp = <smtplib.SMTP object at 0x2b29b71bd8d0>
|
||||
smtp = <smtplib.SMTP object at 0x2aec79533a58>
|
||||
|
||||
def test_ehlo(smtp):
|
||||
response = smtp.ehlo()
|
||||
@@ -212,7 +213,7 @@ inspect what is going on and can now run the tests::
|
||||
test_module.py:5: TypeError
|
||||
________________________________ test_noop _________________________________
|
||||
|
||||
smtp = <smtplib.SMTP object at 0x2b29b71bd8d0>
|
||||
smtp = <smtplib.SMTP object at 0x2aec79533a58>
|
||||
|
||||
def test_noop(smtp):
|
||||
response = smtp.noop()
|
||||
@@ -221,7 +222,7 @@ inspect what is going on and can now run the tests::
|
||||
E assert 0
|
||||
|
||||
test_module.py:11: AssertionError
|
||||
========================= 2 failed in 0.28 seconds =========================
|
||||
========================= 2 failed in 0.20 seconds =========================
|
||||
|
||||
You see the two ``assert 0`` failing and more importantly you can also see
|
||||
that the same (module-scoped) ``smtp`` object was passed into the two
|
||||
@@ -269,7 +270,7 @@ Let's execute it::
|
||||
$ py.test -s -q --tb=no
|
||||
FFteardown smtp
|
||||
|
||||
2 failed in 0.21 seconds
|
||||
2 failed in 0.25 seconds
|
||||
|
||||
We see that the ``smtp`` instance is finalized after the two
|
||||
tests finished execution. Note that if we decorated our fixture
|
||||
@@ -310,7 +311,7 @@ again, nothing much has changed::
|
||||
|
||||
$ py.test -s -q --tb=no
|
||||
FF
|
||||
2 failed in 0.19 seconds
|
||||
2 failed in 0.17 seconds
|
||||
|
||||
Let's quickly create another test module that actually sets the
|
||||
server URL in its module namespace::
|
||||
@@ -378,7 +379,7 @@ So let's just do another run::
|
||||
================================= FAILURES =================================
|
||||
__________________________ test_ehlo[merlinux.eu] __________________________
|
||||
|
||||
smtp = <smtplib.SMTP object at 0x2b6b796568d0>
|
||||
smtp = <smtplib.SMTP object at 0x2b4ce634f828>
|
||||
|
||||
def test_ehlo(smtp):
|
||||
response = smtp.ehlo()
|
||||
@@ -389,7 +390,7 @@ So let's just do another run::
|
||||
test_module.py:5: TypeError
|
||||
__________________________ test_noop[merlinux.eu] __________________________
|
||||
|
||||
smtp = <smtplib.SMTP object at 0x2b6b796568d0>
|
||||
smtp = <smtplib.SMTP object at 0x2b4ce634f828>
|
||||
|
||||
def test_noop(smtp):
|
||||
response = smtp.noop()
|
||||
@@ -400,7 +401,7 @@ So let's just do another run::
|
||||
test_module.py:11: AssertionError
|
||||
________________________ test_ehlo[mail.python.org] ________________________
|
||||
|
||||
smtp = <smtplib.SMTP object at 0x2b6b79656780>
|
||||
smtp = <smtplib.SMTP object at 0x2b4ce634f7f0>
|
||||
|
||||
def test_ehlo(smtp):
|
||||
response = smtp.ehlo()
|
||||
@@ -410,10 +411,10 @@ So let's just do another run::
|
||||
|
||||
test_module.py:5: TypeError
|
||||
-------------------------- Captured stdout setup ---------------------------
|
||||
finalizing <smtplib.SMTP object at 0x2b6b796568d0>
|
||||
finalizing <smtplib.SMTP object at 0x2b4ce634f828>
|
||||
________________________ test_noop[mail.python.org] ________________________
|
||||
|
||||
smtp = <smtplib.SMTP object at 0x2b6b79656780>
|
||||
smtp = <smtplib.SMTP object at 0x2b4ce634f7f0>
|
||||
|
||||
def test_noop(smtp):
|
||||
response = smtp.noop()
|
||||
@@ -422,13 +423,70 @@ So let's just do another run::
|
||||
E assert 0
|
||||
|
||||
test_module.py:11: AssertionError
|
||||
4 failed in 7.02 seconds
|
||||
4 failed in 6.70 seconds
|
||||
|
||||
We see that our two test functions each ran twice, against the different
|
||||
``smtp`` instances. Note also, that with the ``mail.python.org``
|
||||
connection the second test fails in ``test_ehlo`` because a
|
||||
different server string is expected than what arrived.
|
||||
|
||||
pytest will build a string that is the test ID for each fixture value
|
||||
in a parametrized fixture, e.g. ``test_ehlo[merlinux.eu]`` and
|
||||
``test_ehlo[mail.python.org]`` in the above examples. These IDs can
|
||||
be used with ``-k`` to select specific cases to run, and they will
|
||||
also identify the specific case when one is failing. Running pytest
|
||||
with ``--collect-only`` will show the generated IDs.
|
||||
|
||||
Numbers, strings, booleans and None will have their usual string
|
||||
representation used in the test ID. For other objects, pytest will
|
||||
make a string based on the argument name. It is possible to customise
|
||||
the string used in a test ID for a certain fixture value by using the
|
||||
``ids`` keyword argument::
|
||||
|
||||
import pytest
|
||||
|
||||
@pytest.fixture(params=[0, 1], ids=["spam", "ham"])
|
||||
def a(request):
|
||||
return request.param
|
||||
|
||||
def test_a(a):
|
||||
pass
|
||||
|
||||
def idfn(fixture_value):
|
||||
if fixture_value == 0:
|
||||
return "eggs"
|
||||
else:
|
||||
return None
|
||||
|
||||
@pytest.fixture(params=[0, 1], ids=idfn)
|
||||
def b(request):
|
||||
return request.param
|
||||
|
||||
def test_b(b):
|
||||
pass
|
||||
|
||||
The above shows how ``ids`` can be either a list of strings to use or
|
||||
a function which will be called with the fixture value and then
|
||||
has to return a string to use. In the latter case if the function
|
||||
return ``None`` then pytest's auto-generated ID will be used.
|
||||
|
||||
Running the above tests results in the following test IDs being used::
|
||||
|
||||
$ py.test --collect-only
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-109, inifile:
|
||||
collected 6 items
|
||||
<Module 'test_anothersmtp.py'>
|
||||
<Function 'test_showhelo[merlinux.eu]'>
|
||||
<Function 'test_showhelo[mail.python.org]'>
|
||||
<Module 'test_module.py'>
|
||||
<Function 'test_ehlo[merlinux.eu]'>
|
||||
<Function 'test_noop[merlinux.eu]'>
|
||||
<Function 'test_ehlo[mail.python.org]'>
|
||||
<Function 'test_noop[mail.python.org]'>
|
||||
|
||||
============================= in 0.01 seconds =============================
|
||||
|
||||
.. _`interdependent fixtures`:
|
||||
|
||||
@@ -462,13 +520,14 @@ Here we declare an ``app`` fixture which receives the previously defined
|
||||
|
||||
$ py.test -v test_appsetup.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
rootdir: /tmp/doc-exec-109, inifile:
|
||||
collecting ... collected 2 items
|
||||
|
||||
test_appsetup.py::test_smtp_exists[merlinux.eu] PASSED
|
||||
test_appsetup.py::test_smtp_exists[mail.python.org] PASSED
|
||||
|
||||
========================= 2 passed in 6.63 seconds =========================
|
||||
========================= 2 passed in 6.53 seconds =========================
|
||||
|
||||
Due to the parametrization of ``smtp`` the test will run twice with two
|
||||
different ``App`` instances and respective smtp servers. There is no
|
||||
@@ -526,7 +585,8 @@ Let's run the tests in verbose mode and with looking at the print-output::
|
||||
|
||||
$ py.test -v -s test_module.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
|
||||
rootdir: /tmp/doc-exec-109, inifile:
|
||||
collecting ... collected 8 items
|
||||
|
||||
test_module.py::test_0[1] test0 1
|
||||
@@ -725,4 +785,182 @@ to a :ref:`conftest.py <conftest.py>` file or even separately installable
|
||||
fixtures functions starts at test classes, then test modules, then
|
||||
``conftest.py`` files and finally builtin and third party plugins.
|
||||
|
||||
Overriding fixtures on various levels
|
||||
-------------------------------------
|
||||
|
||||
In relatively large test suite, you most likely need to ``override`` a ``global`` or ``root`` fixture with a ``locally``
|
||||
defined one, keeping the test code readable and maintainable.
|
||||
|
||||
Override a fixture on a folder (conftest) level
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Given the tests file structure is:
|
||||
|
||||
::
|
||||
|
||||
tests/
|
||||
__init__.py
|
||||
|
||||
conftest.py
|
||||
# content of tests/conftest.py
|
||||
import pytest
|
||||
|
||||
@pytest.fixture
|
||||
def username():
|
||||
return 'username'
|
||||
|
||||
test_something.py
|
||||
# content of tests/test_something.py
|
||||
def test_username(username):
|
||||
assert username == 'username'
|
||||
|
||||
subfolder/
|
||||
__init__.py
|
||||
|
||||
conftest.py
|
||||
# content of tests/subfolder/conftest.py
|
||||
import pytest
|
||||
|
||||
@pytest.fixture
|
||||
def username(username):
|
||||
return 'overridden-' + username
|
||||
|
||||
test_something.py
|
||||
# content of tests/subfolder/test_something.py
|
||||
def test_username(username):
|
||||
assert username == 'overridden-username'
|
||||
|
||||
As you can see, a fixture with the same name can be overridden for certain test folder level.
|
||||
Note that the ``base`` or ``super`` fixture can be accessed from the ``overriding``
|
||||
fixture easily - used in the example above.
|
||||
|
||||
Override a fixture on a test module level
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Given the tests file structure is:
|
||||
|
||||
::
|
||||
|
||||
tests/
|
||||
__init__.py
|
||||
|
||||
conftest.py
|
||||
# content of tests/conftest.py
|
||||
@pytest.fixture
|
||||
def username():
|
||||
return 'username'
|
||||
|
||||
test_something.py
|
||||
# content of tests/test_something.py
|
||||
import pytest
|
||||
|
||||
@pytest.fixture
|
||||
def username(username):
|
||||
return 'overridden-' + username
|
||||
|
||||
def test_username(username):
|
||||
assert username == 'overridden-username'
|
||||
|
||||
test_something_else.py
|
||||
# content of tests/test_something_else.py
|
||||
import pytest
|
||||
|
||||
@pytest.fixture
|
||||
def username(username):
|
||||
return 'overridden-else-' + username
|
||||
|
||||
def test_username(username):
|
||||
assert username == 'overridden-else-username'
|
||||
|
||||
In the example above, a fixture with the same name can be overridden for certain test module.
|
||||
|
||||
|
||||
Override a fixture with direct test parametrization
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Given the tests file structure is:
|
||||
|
||||
::
|
||||
|
||||
tests/
|
||||
__init__.py
|
||||
|
||||
conftest.py
|
||||
# content of tests/conftest.py
|
||||
import pytest
|
||||
|
||||
@pytest.fixture
|
||||
def username():
|
||||
return 'username'
|
||||
|
||||
@pytest.fixture
|
||||
def other_username(username):
|
||||
return 'other-' + username
|
||||
|
||||
test_something.py
|
||||
# content of tests/test_something.py
|
||||
import pytest
|
||||
|
||||
@pytest.mark.parametrize('username', ['directly-overridden-username'])
|
||||
def test_username(username):
|
||||
assert username == 'directly-overridden-username'
|
||||
|
||||
@pytest.mark.parametrize('username', ['directly-overridden-username-other'])
|
||||
def test_username_other(other_username):
|
||||
assert username == 'other-directly-overridden-username-other'
|
||||
|
||||
In the example above, a fixture value is overridden by the test parameter value. Note that the value of the fixture
|
||||
can be overridden this way even if the test doesn't use it directly (doesn't mention it in the function prototype).
|
||||
|
||||
|
||||
Override a parametrized fixture with non-parametrized one and vice versa
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Given the tests file structure is:
|
||||
|
||||
::
|
||||
|
||||
tests/
|
||||
__init__.py
|
||||
|
||||
conftest.py
|
||||
# content of tests/conftest.py
|
||||
import pytest
|
||||
|
||||
@pytest.fixture(params=['one', 'two', 'three'])
|
||||
def parametrized_username(request):
|
||||
return request.param
|
||||
|
||||
@pytest.fixture
|
||||
def non_parametrized_username(request):
|
||||
return 'username'
|
||||
|
||||
test_something.py
|
||||
# content of tests/test_something.py
|
||||
import pytest
|
||||
|
||||
@pytest.fixture
|
||||
def parametrized_username():
|
||||
return 'overridden-username'
|
||||
|
||||
@pytest.fixture(params=['one', 'two', 'three'])
|
||||
def non_parametrized_username(request):
|
||||
return request.param
|
||||
|
||||
def test_username(parametrized_username):
|
||||
assert parametrized_username == 'overridden-username'
|
||||
|
||||
def test_parametrized_username(non_parametrized_username):
|
||||
assert non_parametrized_username in ['one', 'two', 'three']
|
||||
|
||||
test_something_else.py
|
||||
# content of tests/test_something_else.py
|
||||
def test_username(parametrized_username):
|
||||
assert parametrized_username in ['one', 'two', 'three']
|
||||
|
||||
def test_username(non_parametrized_username):
|
||||
assert non_parametrized_username == 'username'
|
||||
|
||||
In the example above, a parametrized fixture is overridden with a non-parametrized version, and
|
||||
a non-parametrized fixture is overridden with a parametrized version for certain test module.
|
||||
The same applies for the test folder level obviously.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Installation and Getting Started
|
||||
===================================
|
||||
|
||||
**Pythons**: Python 2.6-3.4, Jython, PyPy-2.3
|
||||
**Pythons**: Python 2.6,2.7,3.3,3.4, Jython, PyPy-2.3
|
||||
|
||||
**Platforms**: Unix/Posix and Windows
|
||||
|
||||
@@ -27,7 +27,7 @@ Installation options::
|
||||
To check your installation has installed the correct version::
|
||||
|
||||
$ py.test --version
|
||||
This is pytest version 2.6.4, imported from /home/hpk/p/pytest/.tox/regen/lib/python3.4/site-packages/pytest.py
|
||||
This is pytest version 2.7.0, imported from /home/hpk/p/pytest/.tox/regen/lib/python3.4/site-packages/pytest.py
|
||||
|
||||
If you get an error checkout :ref:`installation issues`.
|
||||
|
||||
@@ -49,7 +49,8 @@ That's it. You can execute the test function now::
|
||||
|
||||
$ py.test
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-112, inifile:
|
||||
collected 1 items
|
||||
|
||||
test_sample.py F
|
||||
@@ -127,7 +128,7 @@ run the module by passing its filename::
|
||||
================================= FAILURES =================================
|
||||
____________________________ TestClass.test_two ____________________________
|
||||
|
||||
self = <test_class.TestClass object at 0x2b9209071470>
|
||||
self = <test_class.TestClass object at 0x2ad6b3a6f278>
|
||||
|
||||
def test_two(self):
|
||||
x = "hello"
|
||||
@@ -163,7 +164,7 @@ before performing the test function call. Let's just run it::
|
||||
================================= FAILURES =================================
|
||||
_____________________________ test_needsfiles ______________________________
|
||||
|
||||
tmpdir = local('/tmp/pytest-108/test_needsfiles0')
|
||||
tmpdir = local('/tmp/pytest-215/test_needsfiles0')
|
||||
|
||||
def test_needsfiles(tmpdir):
|
||||
print (tmpdir)
|
||||
@@ -172,8 +173,8 @@ before performing the test function call. Let's just run it::
|
||||
|
||||
test_tmpdir.py:3: AssertionError
|
||||
--------------------------- Captured stdout call ---------------------------
|
||||
/tmp/pytest-108/test_needsfiles0
|
||||
1 failed in 0.02 seconds
|
||||
/tmp/pytest-215/test_needsfiles0
|
||||
1 failed in 0.01 seconds
|
||||
|
||||
Before the test runs, a unique-per-test-invocation temporary directory
|
||||
was created. More info at :ref:`tmpdir handling`.
|
||||
|
||||
@@ -194,7 +194,8 @@ this to your ``setup.py`` file::
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
import sys,subprocess
|
||||
import subprocess
|
||||
import sys
|
||||
errno = subprocess.call([sys.executable, 'runtests.py'])
|
||||
raise SystemExit(errno)
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
|
||||
.. _features:
|
||||
.. note::
|
||||
|
||||
Are you an experienced pytest user, or an open source project that needs some help getting started with pytest? **April 2015** is `adopt pytest month`_!
|
||||
|
||||
|
||||
.. _`adopt pytest month`: adopt.html
|
||||
pytest: helps you write better programs
|
||||
=============================================
|
||||
|
||||
@@ -26,7 +31,7 @@ pytest: helps you write better programs
|
||||
**scales from simple unit to complex functional testing**
|
||||
|
||||
- :ref:`modular parametrizeable fixtures <fixture>` (new in 2.3,
|
||||
continously improved)
|
||||
continuously improved)
|
||||
- :ref:`parametrized test functions <parametrized test functions>`
|
||||
- :ref:`mark`
|
||||
- :ref:`skipping` (improved in 2.4)
|
||||
|
||||
@@ -57,7 +57,7 @@ so that any attempts within tests to create http requests will fail.
|
||||
example: setting an attribute on some class
|
||||
------------------------------------------------------
|
||||
|
||||
If you need to patch out ``os.getcwd()`` to return an artifical
|
||||
If you need to patch out ``os.getcwd()`` to return an artificial
|
||||
value::
|
||||
|
||||
def test_some_interaction(monkeypatch):
|
||||
|
||||
@@ -39,13 +39,13 @@ Unsupported idioms / known issues
|
||||
it doesn't seem useful to duplicate the unittest-API like nose does.
|
||||
If you however rather think pytest should support the unittest-spelling on
|
||||
plain classes please post `to this issue
|
||||
<https://bitbucket.org/hpk42/pytest/issue/377/>`_.
|
||||
<https://bitbucket.org/pytest-dev/pytest/issue/377/>`_.
|
||||
|
||||
- nose imports test modules with the same import path (e.g.
|
||||
``tests.test_mod``) but different file system paths
|
||||
(e.g. ``tests/test_mode.py`` and ``other/tests/test_mode.py``)
|
||||
by extending sys.path/import semantics. pytest does not do that
|
||||
but there is discussion in `issue268 <https://bitbucket.org/hpk42/pytest/issue/268>`_ for adding some support. Note that
|
||||
but there is discussion in `issue268 <https://bitbucket.org/pytest-dev/pytest/issue/268>`_ for adding some support. Note that
|
||||
`nose2 choose to avoid this sys.path/import hackery <https://nose2.readthedocs.org/en/latest/differences.html#test-discovery-and-loading>`_.
|
||||
|
||||
- nose-style doctests are not collected and executed correctly,
|
||||
|
||||
@@ -53,7 +53,8 @@ them in turn::
|
||||
|
||||
$ py.test
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-120, inifile:
|
||||
collected 3 items
|
||||
|
||||
test_expectation.py ..F
|
||||
@@ -100,7 +101,8 @@ Let's run this::
|
||||
|
||||
$ py.test
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-120, inifile:
|
||||
collected 3 items
|
||||
|
||||
test_expectation.py ..x
|
||||
@@ -170,8 +172,8 @@ Let's also run with a stringinput that will lead to a failing test::
|
||||
|
||||
def test_valid_string(stringinput):
|
||||
> assert stringinput.isalpha()
|
||||
E assert <built-in method isalpha of str object at 0x2ae3eb376c00>()
|
||||
E + where <built-in method isalpha of str object at 0x2ae3eb376c00> = '!'.isalpha
|
||||
E assert <built-in method isalpha of str object at 0x2ae1375d9810>()
|
||||
E + where <built-in method isalpha of str object at 0x2ae1375d9810> = '!'.isalpha
|
||||
|
||||
test_strings.py:3: AssertionError
|
||||
1 failed in 0.01 seconds
|
||||
@@ -185,8 +187,8 @@ listlist::
|
||||
$ py.test -q -rs test_strings.py
|
||||
s
|
||||
========================= short test summary info ==========================
|
||||
SKIP [1] /home/hpk/p/pytest/.tox/regen/lib/python3.4/site-packages/_pytest/python.py:1139: got empty parameter set, function test_valid_string at /tmp/doc-exec-23/test_strings.py:1
|
||||
1 skipped in 0.01 seconds
|
||||
SKIP [1] /home/hpk/p/pytest/.tox/regen/lib/python3.4/site-packages/_pytest/python.py:1185: got empty parameter set, function test_valid_string at /tmp/doc-exec-120/test_strings.py:1
|
||||
1 skipped in 0.00 seconds
|
||||
|
||||
For further examples, you might want to look at :ref:`more
|
||||
parametrization examples <paramexamples>`.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.. _plugins:
|
||||
|
||||
Working with plugins and conftest files
|
||||
=============================================
|
||||
=======================================
|
||||
|
||||
``pytest`` implements all aspects of configuration, collection, running and reporting by calling `well specified hooks`_. Virtually any Python module can be registered as a plugin. It can implement any number of hook functions (usually two or three) which all have a ``pytest_`` prefix, making hook functions easy to distinguish and find. There are three basic location types:
|
||||
|
||||
@@ -9,14 +9,14 @@ Working with plugins and conftest files
|
||||
* `external plugins`_: modules discovered through `setuptools entry points`_
|
||||
* `conftest.py plugins`_: modules auto-discovered in test directories
|
||||
|
||||
.. _`pytest/plugin`: http://bitbucket.org/hpk42/pytest/src/tip/pytest/plugin/
|
||||
.. _`pytest/plugin`: http://bitbucket.org/pytest-dev/pytest/src/tip/pytest/plugin/
|
||||
.. _`conftest.py plugins`:
|
||||
.. _`conftest.py`:
|
||||
.. _`localplugin`:
|
||||
.. _`conftest`:
|
||||
|
||||
conftest.py: local per-directory plugins
|
||||
--------------------------------------------------------------
|
||||
----------------------------------------
|
||||
|
||||
local ``conftest.py`` plugins contain directory-specific hook
|
||||
implementations. Session and test running activities will
|
||||
@@ -55,7 +55,7 @@ Here is how you might run it::
|
||||
.. _`extplugins`:
|
||||
|
||||
Installing External Plugins / Searching
|
||||
------------------------------------------------------
|
||||
---------------------------------------
|
||||
|
||||
Installing a plugin happens through any usual Python installation
|
||||
tool, for example::
|
||||
@@ -112,17 +112,17 @@ for some popular plugins:
|
||||
|
||||
To see a complete list of all plugins with their latest testing
|
||||
status against different py.test and Python versions, please visit
|
||||
`pytest-plugs <http://pytest-plugs.herokuapp.com/>`_.
|
||||
`plugincompat <http://plugincompat.herokuapp.com/>`_.
|
||||
|
||||
You may also discover more plugins through a `pytest- pypi.python.org search`_.
|
||||
|
||||
.. _`available installable plugins`:
|
||||
.. _`pytest- pypi.python.org search`: http://pypi.python.org/pypi?%3Aaction=search&term=pytest-&submit=search
|
||||
|
||||
Writing a plugin by looking at examples
|
||||
------------------------------------------------------
|
||||
|
||||
.. _`Distribute`: http://pypi.python.org/pypi/distribute
|
||||
Writing a plugin by looking at examples
|
||||
---------------------------------------
|
||||
|
||||
.. _`setuptools`: http://pypi.python.org/pypi/setuptools
|
||||
|
||||
If you want to write a plugin, there are many real-life examples
|
||||
@@ -135,18 +135,22 @@ you can copy from:
|
||||
All of these plugins implement the documented `well specified hooks`_
|
||||
to extend and add functionality.
|
||||
|
||||
You can also :ref:`contribute your plugin to pytest-dev<submitplugin>`
|
||||
once it has some happy users other than yourself.
|
||||
|
||||
|
||||
.. _`setuptools entry points`:
|
||||
|
||||
Making your plugin installable by others
|
||||
-----------------------------------------------
|
||||
----------------------------------------
|
||||
|
||||
If you want to make your plugin externally available, you
|
||||
may define a so-called entry point for your distribution so
|
||||
that ``pytest`` finds your plugin module. Entry points are
|
||||
a feature that is provided by `setuptools`_ or `Distribute`_.
|
||||
pytest looks up the ``pytest11`` entrypoint to discover its
|
||||
a feature that is provided by `setuptools`_. pytest looks up
|
||||
the ``pytest11`` entrypoint to discover its
|
||||
plugins and you can thus make your plugin available by defining
|
||||
it in your setuptools/distribute-based setup-invocation:
|
||||
it in your setuptools-invocation:
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
@@ -169,10 +173,11 @@ If a package is installed this way, ``pytest`` will load
|
||||
``myproject.pluginmodule`` as a plugin which can define
|
||||
`well specified hooks`_.
|
||||
|
||||
|
||||
.. _`pluginorder`:
|
||||
|
||||
Plugin discovery order at tool startup
|
||||
--------------------------------------------
|
||||
--------------------------------------
|
||||
|
||||
``pytest`` loads plugin modules at tool startup in the following way:
|
||||
|
||||
@@ -187,8 +192,8 @@ Plugin discovery order at tool startup
|
||||
invocation:
|
||||
|
||||
- if no test paths are specified use current dir as a test path
|
||||
- if exists, load ``conftest.py`` and ``test*/conftest.py`` relative
|
||||
to the directory part of the first test path.
|
||||
- if exists, load ``conftest.py`` and ``test*/conftest.py`` relative
|
||||
to the directory part of the first test path.
|
||||
|
||||
Note that pytest does not find ``conftest.py`` files in deeper nested
|
||||
sub directories at tool startup. It is usually a good idea to keep
|
||||
@@ -199,7 +204,7 @@ Plugin discovery order at tool startup
|
||||
|
||||
|
||||
Requiring/Loading plugins in a test module or conftest file
|
||||
-------------------------------------------------------------
|
||||
-----------------------------------------------------------
|
||||
|
||||
You can require plugins in a test module or a conftest file like this::
|
||||
|
||||
@@ -214,7 +219,7 @@ which will import the specified module as a ``pytest`` plugin.
|
||||
|
||||
|
||||
Accessing another plugin by name
|
||||
--------------------------------------------
|
||||
--------------------------------
|
||||
|
||||
If a plugin wants to collaborate with code from
|
||||
another plugin it can obtain a reference through
|
||||
@@ -230,7 +235,7 @@ the ``--traceconfig`` option.
|
||||
.. _`findpluginname`:
|
||||
|
||||
Finding out which plugins are active
|
||||
----------------------------------------------------------------------------
|
||||
------------------------------------
|
||||
|
||||
If you want to find out which plugins are active in your
|
||||
environment you can type::
|
||||
@@ -244,7 +249,7 @@ and their names. It will also print local plugins aka
|
||||
.. _`cmdunregister`:
|
||||
|
||||
Deactivating / unregistering a plugin by name
|
||||
----------------------------------------------------------------------------
|
||||
---------------------------------------------
|
||||
|
||||
You can prevent plugins from loading or unregister them::
|
||||
|
||||
@@ -257,11 +262,11 @@ how to obtain the name of a plugin.
|
||||
.. _`builtin plugins`:
|
||||
|
||||
pytest default plugin reference
|
||||
====================================
|
||||
===============================
|
||||
|
||||
|
||||
You can find the source code for the following plugins
|
||||
in the `pytest repository <http://bitbucket.org/hpk42/pytest/>`_.
|
||||
in the `pytest repository <http://bitbucket.org/pytest-dev/pytest/>`_.
|
||||
|
||||
.. autosummary::
|
||||
|
||||
@@ -291,10 +296,10 @@ in the `pytest repository <http://bitbucket.org/hpk42/pytest/>`_.
|
||||
.. _`well specified hooks`:
|
||||
|
||||
pytest hook reference
|
||||
====================================
|
||||
=====================
|
||||
|
||||
Hook specification and validation
|
||||
-----------------------------------------
|
||||
---------------------------------
|
||||
|
||||
``pytest`` calls hook functions to implement initialization, running,
|
||||
test execution and reporting. When ``pytest`` loads a plugin it validates
|
||||
@@ -305,7 +310,7 @@ by simply not specifying them. If you mistype argument names or the
|
||||
hook name itself you get an error showing the available arguments.
|
||||
|
||||
Initialization, command line and configuration hooks
|
||||
--------------------------------------------------------------------
|
||||
----------------------------------------------------
|
||||
|
||||
.. currentmodule:: _pytest.hookspec
|
||||
|
||||
@@ -319,7 +324,7 @@ Initialization, command line and configuration hooks
|
||||
.. autofunction:: pytest_unconfigure
|
||||
|
||||
Generic "runtest" hooks
|
||||
------------------------------
|
||||
-----------------------
|
||||
|
||||
All runtest related hooks receive a :py:class:`pytest.Item` object.
|
||||
|
||||
@@ -339,7 +344,7 @@ The :py:mod:`_pytest.terminal` reported specifically uses
|
||||
the reporting hook to print information about a test run.
|
||||
|
||||
Collection hooks
|
||||
------------------------------
|
||||
----------------
|
||||
|
||||
``pytest`` calls the following hooks for collecting files and directories:
|
||||
|
||||
@@ -359,7 +364,7 @@ items, delete or otherwise amend the test items:
|
||||
.. autofunction:: pytest_collection_modifyitems
|
||||
|
||||
Reporting hooks
|
||||
------------------------------
|
||||
---------------
|
||||
|
||||
Session related reporting hooks:
|
||||
|
||||
@@ -375,7 +380,7 @@ test execution:
|
||||
|
||||
|
||||
Debugging/Interaction hooks
|
||||
--------------------------------------
|
||||
---------------------------
|
||||
|
||||
There are few hooks which can be used for special
|
||||
reporting or interaction with exceptions:
|
||||
@@ -400,7 +405,7 @@ are expected.
|
||||
|
||||
For an example, see `newhooks.py`_ from :ref:`xdist`.
|
||||
|
||||
.. _`newhooks.py`: https://bitbucket.org/hpk42/pytest-xdist/src/52082f70e7dd04b00361091b8af906c60fd6700f/xdist/newhooks.py?at=default
|
||||
.. _`newhooks.py`: https://bitbucket.org/pytest-dev/pytest-xdist/src/52082f70e7dd04b00361091b8af906c60fd6700f/xdist/newhooks.py?at=default
|
||||
|
||||
|
||||
Using hooks from 3rd party plugins
|
||||
@@ -431,9 +436,44 @@ declaring the hook functions directly in your plugin module, for example::
|
||||
This has the added benefit of allowing you to conditionally install hooks
|
||||
depending on which plugins are installed.
|
||||
|
||||
hookwrapper: executing around other hooks
|
||||
-------------------------------------------------
|
||||
|
||||
.. currentmodule:: _pytest.core
|
||||
|
||||
.. versionadded:: 2.7 (experimental)
|
||||
|
||||
pytest plugins can implement hook wrappers which which wrap the execution
|
||||
of other hook implementations. A hook wrapper is a generator function
|
||||
which yields exactly once. When pytest invokes hooks it first executes
|
||||
hook wrappers and passes the same arguments as to the regular hooks.
|
||||
|
||||
At the yield point of the hook wrapper pytest will execute the next hook
|
||||
implementations and return their result to the yield point in the form of
|
||||
a :py:class:`CallOutcome` instance which encapsulates a result or
|
||||
exception info. The yield point itself will thus typically not raise
|
||||
exceptions (unless there are bugs).
|
||||
|
||||
Here is an example definition of a hook wrapper::
|
||||
|
||||
import pytest
|
||||
|
||||
@pytest.mark.hookwrapper
|
||||
def pytest_pyfunc_call(pyfuncitem):
|
||||
# do whatever you want before the next hook executes
|
||||
outcome = yield
|
||||
# outcome.excinfo may be None or a (cls, val, tb) tuple
|
||||
res = outcome.get_result() # will raise if outcome was exception
|
||||
# postprocess result
|
||||
|
||||
Note that hook wrappers don't return results themselves, they merely
|
||||
perform tracing or other side effects around the actual hook implementations.
|
||||
If the result of the underlying hook is a mutable object, they may modify
|
||||
that result, however.
|
||||
|
||||
|
||||
Reference of objects involved in hooks
|
||||
===========================================================
|
||||
======================================
|
||||
|
||||
.. autoclass:: _pytest.config.Config()
|
||||
:members:
|
||||
@@ -470,3 +510,6 @@ Reference of objects involved in hooks
|
||||
.. autoclass:: _pytest.runner.TestReport()
|
||||
:members:
|
||||
|
||||
.. autoclass:: _pytest.core.CallOutcome()
|
||||
:members:
|
||||
|
||||
|
||||
@@ -4,168 +4,224 @@ List of Third-Party Plugins
|
||||
===========================
|
||||
|
||||
The table below contains a listing of plugins found in PyPI and
|
||||
their status when tested using py.test **2.6.4.dev1** and python 2.7 and
|
||||
their status when tested using py.test **2.7.0** and python 2.7 and
|
||||
3.3.
|
||||
|
||||
A complete listing can also be found at
|
||||
`pytest-plugs <http://pytest-plugs.herokuapp.com/>`_, which contains tests
|
||||
`plugincompat <http://plugincompat.herokuapp.com/>`_, which contains tests
|
||||
status against other py.test releases.
|
||||
|
||||
|
||||
==================================================================================== ================================================================================================================= ================================================================================================================= =========================================================================== =============================================================================================================================================
|
||||
Name Py27 Py34 Home Summary
|
||||
==================================================================================== ================================================================================================================= ================================================================================================================= =========================================================================== =============================================================================================================================================
|
||||
`pytest-allure-adaptor <http://pypi.python.org/pypi/pytest-allure-adaptor>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-allure-adaptor-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-allure-adaptor-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Plugin for py.test to generate allure xml reports
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-allure-adaptor-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-allure-adaptor-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/allure-framework/allure-python
|
||||
`pytest-bdd <http://pypi.python.org/pypi/pytest-bdd>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bdd-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bdd-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png BDD for pytest
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-bdd-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-bdd-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/olegpidsadnyi/pytest-bdd
|
||||
`pytest-beds <http://pypi.python.org/pypi/pytest-beds>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-beds-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-beds-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Fixtures for testing Google Appengine (GAE) apps
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-beds-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-beds-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/kaste/pytest-beds
|
||||
`pytest-bench <http://pypi.python.org/pypi/pytest-bench>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bench-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bench-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Benchmark utility that plugs into pytest.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-bench-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-bench-latest?py=py34&pytest=2.6.4.dev1 :target: http://github.com/concordusapps/pytest-bench
|
||||
`pytest-blockage <http://pypi.python.org/pypi/pytest-blockage>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-blockage-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-blockage-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Disable network requests during a test run.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-blockage-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-blockage-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/rob-b/pytest-blockage
|
||||
`pytest-browsermob-proxy <http://pypi.python.org/pypi/pytest-browsermob-proxy>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-browsermob-proxy-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-browsermob-proxy-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png BrowserMob proxy plugin for py.test.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-browsermob-proxy-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-browsermob-proxy-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/davehunt/pytest-browsermob-proxy
|
||||
`pytest-bugzilla <http://pypi.python.org/pypi/pytest-bugzilla>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bugzilla-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bugzilla-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png py.test bugzilla integration plugin
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-bugzilla-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-bugzilla-latest?py=py34&pytest=2.6.4.dev1 :target: http://github.com/nibrahim/pytest_bugzilla
|
||||
`pytest-cache <http://pypi.python.org/pypi/pytest-cache>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cache-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cache-latest?py=py34&pytest=2.6.4.dev1 .. image:: bitbucket.png pytest plugin with mechanisms for caching across test runs
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-cache-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-cache-latest?py=py34&pytest=2.6.4.dev1 :target: http://bitbucket.org/hpk42/pytest-cache/
|
||||
`pytest-capturelog <http://pypi.python.org/pypi/pytest-capturelog>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-capturelog-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-capturelog-latest?py=py34&pytest=2.6.4.dev1 .. image:: bitbucket.png py.test plugin to capture log messages
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-capturelog-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-capturelog-latest?py=py34&pytest=2.6.4.dev1 :target: http://bitbucket.org/memedough/pytest-capturelog/overview
|
||||
`pytest-codecheckers <http://pypi.python.org/pypi/pytest-codecheckers>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-codecheckers-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-codecheckers-latest?py=py34&pytest=2.6.4.dev1 .. image:: bitbucket.png pytest plugin to add source code sanity checks (pep8 and friends)
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-codecheckers-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-codecheckers-latest?py=py34&pytest=2.6.4.dev1 :target: http://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/
|
||||
`pytest-config <http://pypi.python.org/pypi/pytest-config>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-config-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-config-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Base configurations and utilities for developing your Python project test suite with pytest.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-config-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-config-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/buzzfeed/pytest_config
|
||||
`pytest-contextfixture <http://pypi.python.org/pypi/pytest-contextfixture>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-contextfixture-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-contextfixture-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Define pytest fixtures as context managers.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-contextfixture-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-contextfixture-latest?py=py34&pytest=2.6.4.dev1 :target: http://github.com/pelme/pytest-contextfixture/
|
||||
`pytest-couchdbkit <http://pypi.python.org/pypi/pytest-couchdbkit>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-couchdbkit-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-couchdbkit-latest?py=py34&pytest=2.6.4.dev1 .. image:: bitbucket.png py.test extension for per-test couchdb databases using couchdbkit
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-couchdbkit-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-couchdbkit-latest?py=py34&pytest=2.6.4.dev1 :target: http://bitbucket.org/RonnyPfannschmidt/pytest-couchdbkit
|
||||
`pytest-cov <http://pypi.python.org/pypi/pytest-cov>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cov-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cov-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png py.test plugin for coverage reporting with support for both centralised and distributed testing, including subprocesses and multiprocessing
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-cov-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-cov-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/schlamar/pytest-cov
|
||||
`pytest-cpp <http://pypi.python.org/pypi/pytest-cpp>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cpp-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cpp-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Use pytest's runner to discover and execute C++ tests
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-cpp-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-cpp-latest?py=py34&pytest=2.6.4.dev1 :target: http://github.com/nicoddemus/pytest-cpp
|
||||
`pytest-dbfixtures <http://pypi.python.org/pypi/pytest-dbfixtures>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-dbfixtures-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-dbfixtures-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Databases fixtures plugin for py.test.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-dbfixtures-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-dbfixtures-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/ClearcodeHQ/pytest-dbfixtures
|
||||
`pytest-dbus-notification <http://pypi.python.org/pypi/pytest-dbus-notification>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-dbus-notification-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-dbus-notification-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png D-BUS notifications for pytest results.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-dbus-notification-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-dbus-notification-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/bmathieu33/pytest-dbus-notification
|
||||
`pytest-describe <http://pypi.python.org/pypi/pytest-describe>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-describe-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-describe-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Describe-style plugin for pytest
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-describe-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-describe-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/ropez/pytest-describe
|
||||
`pytest-diffeo <http://pypi.python.org/pypi/pytest-diffeo>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-diffeo-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-diffeo-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Common py.test support for Diffeo packages
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-diffeo-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-diffeo-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/diffeo/pytest-diffeo
|
||||
`pytest-django <http://pypi.python.org/pypi/pytest-django>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-latest?py=py34&pytest=2.6.4.dev1 `link <http://pytest-django.readthedocs.org/>`_ A Django plugin for py.test.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-django-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-django-latest?py=py34&pytest=2.6.4.dev1
|
||||
`pytest-django-haystack <http://pypi.python.org/pypi/pytest-django-haystack>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-haystack-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-haystack-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Cleanup your Haystack indexes between tests
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-django-haystack-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-django-haystack-latest?py=py34&pytest=2.6.4.dev1 :target: http://github.com/rouge8/pytest-django-haystack
|
||||
`pytest-django-lite <http://pypi.python.org/pypi/pytest-django-lite>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-lite-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-lite-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png The bare minimum to integrate py.test with Django.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-django-lite-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-django-lite-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/dcramer/pytest-django-lite
|
||||
`pytest-echo <http://pypi.python.org/pypi/pytest-echo>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-echo-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-echo-latest?py=py34&pytest=2.6.4.dev1 `link <http://pypi.python.org/pypi/pytest-echo/>`_ pytest plugin with mechanisms for echoing environment variables, package version and generic attributes
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-echo-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-echo-latest?py=py34&pytest=2.6.4.dev1
|
||||
`pytest-eradicate <http://pypi.python.org/pypi/pytest-eradicate>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-eradicate-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-eradicate-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png pytest plugin to check for commented out code
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-eradicate-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-eradicate-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/spil-johan/pytest-eradicate
|
||||
`pytest-figleaf <http://pypi.python.org/pypi/pytest-figleaf>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-figleaf-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-figleaf-latest?py=py34&pytest=2.6.4.dev1 .. image:: bitbucket.png py.test figleaf coverage plugin
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-figleaf-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-figleaf-latest?py=py34&pytest=2.6.4.dev1 :target: http://bitbucket.org/hpk42/pytest-figleaf
|
||||
`pytest-fixture-tools <http://pypi.python.org/pypi/pytest-fixture-tools>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-fixture-tools-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-fixture-tools-latest?py=py34&pytest=2.6.4.dev1 ? Plugin for pytest which provides tools for fixtures
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-fixture-tools-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-fixture-tools-latest?py=py34&pytest=2.6.4.dev1
|
||||
`pytest-flakes <http://pypi.python.org/pypi/pytest-flakes>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-flakes-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-flakes-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png pytest plugin to check source code with pyflakes
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-flakes-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-flakes-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/fschulze/pytest-flakes
|
||||
`pytest-flask <http://pypi.python.org/pypi/pytest-flask>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-flask-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-flask-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png A set of py.test fixtures to test Flask applications.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-flask-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-flask-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/vitalk/pytest-flask
|
||||
`pytest-greendots <http://pypi.python.org/pypi/pytest-greendots>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-greendots-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-greendots-latest?py=py34&pytest=2.6.4.dev1 ? Green progress dots
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-greendots-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-greendots-latest?py=py34&pytest=2.6.4.dev1
|
||||
`pytest-growl <http://pypi.python.org/pypi/pytest-growl>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-growl-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-growl-latest?py=py34&pytest=2.6.4.dev1 ? Growl notifications for pytest results.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-growl-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-growl-latest?py=py34&pytest=2.6.4.dev1
|
||||
`pytest-httpbin <http://pypi.python.org/pypi/pytest-httpbin>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-httpbin-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-httpbin-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Easily test your HTTP library against a local copy of httpbin
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-httpbin-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-httpbin-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/kevin1024/pytest-httpbin
|
||||
`pytest-httpretty <http://pypi.python.org/pypi/pytest-httpretty>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-httpretty-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-httpretty-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png A thin wrapper of HTTPretty for pytest
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-httpretty-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-httpretty-latest?py=py34&pytest=2.6.4.dev1 :target: http://github.com/papaeye/pytest-httpretty
|
||||
`pytest-incremental <http://pypi.python.org/pypi/pytest-incremental>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-incremental-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-incremental-latest?py=py34&pytest=2.6.4.dev1 .. image:: bitbucket.png an incremental test runner (pytest plugin)
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-incremental-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-incremental-latest?py=py34&pytest=2.6.4.dev1 :target: https://bitbucket.org/schettino72/pytest-incremental
|
||||
`pytest-instafail <http://pypi.python.org/pypi/pytest-instafail>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-instafail-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-instafail-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png py.test plugin to show failures instantly
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-instafail-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-instafail-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/jpvanhal/pytest-instafail
|
||||
`pytest-ipdb <http://pypi.python.org/pypi/pytest-ipdb>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-ipdb-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-ipdb-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png A py.test plug-in to enable drop to ipdb debugger on test failure.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-ipdb-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-ipdb-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/mverteuil/pytest-ipdb
|
||||
`pytest-jira <http://pypi.python.org/pypi/pytest-jira>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-jira-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-jira-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png py.test JIRA integration plugin, using markers
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-jira-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-jira-latest?py=py34&pytest=2.6.4.dev1 :target: http://github.com/jlaska/pytest_jira
|
||||
`pytest-knows <http://pypi.python.org/pypi/pytest-knows>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-knows-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-knows-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png A pytest plugin that can automaticly skip test case based on dependence info calculated by trace
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-knows-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-knows-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/mapix/ptknows
|
||||
`pytest-konira <http://pypi.python.org/pypi/pytest-konira>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-konira-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-konira-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Run Konira DSL tests with py.test
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-konira-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-konira-latest?py=py34&pytest=2.6.4.dev1 :target: http://github.com/alfredodeza/pytest-konira
|
||||
`pytest-localserver <http://pypi.python.org/pypi/pytest-localserver>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-localserver-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-localserver-latest?py=py34&pytest=2.6.4.dev1 .. image:: bitbucket.png py.test plugin to test server connections locally.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-localserver-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-localserver-latest?py=py34&pytest=2.6.4.dev1 :target: http://bitbucket.org/basti/pytest-localserver/
|
||||
`pytest-marker-bugzilla <http://pypi.python.org/pypi/pytest-marker-bugzilla>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marker-bugzilla-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marker-bugzilla-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png py.test bugzilla integration plugin, using markers
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-marker-bugzilla-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-marker-bugzilla-latest?py=py34&pytest=2.6.4.dev1 :target: http://github.com/eanxgeek/pytest_marker_bugzilla
|
||||
`pytest-markfiltration <http://pypi.python.org/pypi/pytest-markfiltration>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-markfiltration-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-markfiltration-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png UNKNOWN
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-markfiltration-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-markfiltration-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/adamgoucher/pytest-markfiltration
|
||||
`pytest-marks <http://pypi.python.org/pypi/pytest-marks>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marks-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marks-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png UNKNOWN
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-marks-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-marks-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/adamgoucher/pytest-marks
|
||||
`pytest-mock <http://pypi.python.org/pypi/pytest-mock>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-mock-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-mock-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Thin-wrapper around the mock package for easier use with py.test
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-mock-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-mock-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/nicoddemus/pytest-mock/
|
||||
`pytest-monkeyplus <http://pypi.python.org/pypi/pytest-monkeyplus>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-monkeyplus-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-monkeyplus-latest?py=py34&pytest=2.6.4.dev1 .. image:: bitbucket.png pytest's monkeypatch subclass with extra functionalities
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-monkeyplus-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-monkeyplus-latest?py=py34&pytest=2.6.4.dev1 :target: http://bitbucket.org/hsoft/pytest-monkeyplus/
|
||||
`pytest-mozwebqa <http://pypi.python.org/pypi/pytest-mozwebqa>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-mozwebqa-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-mozwebqa-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Mozilla WebQA plugin for py.test.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-mozwebqa-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-mozwebqa-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/davehunt/pytest-mozwebqa
|
||||
`pytest-oerp <http://pypi.python.org/pypi/pytest-oerp>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-oerp-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-oerp-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png pytest plugin to test OpenERP modules
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-oerp-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-oerp-latest?py=py34&pytest=2.6.4.dev1 :target: http://github.com/santagada/pytest-oerp/
|
||||
`pytest-ordering <http://pypi.python.org/pypi/pytest-ordering>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-ordering-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-ordering-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png pytest plugin to run your tests in a specific order
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-ordering-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-ordering-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/ftobia/pytest-ordering
|
||||
`pytest-osxnotify <http://pypi.python.org/pypi/pytest-osxnotify>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-osxnotify-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-osxnotify-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png OS X notifications for py.test results.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-osxnotify-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-osxnotify-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/dbader/pytest-osxnotify
|
||||
`pytest-paste-config <http://pypi.python.org/pypi/pytest-paste-config>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-paste-config-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-paste-config-latest?py=py34&pytest=2.6.4.dev1 ? Allow setting the path to a paste config file
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-paste-config-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-paste-config-latest?py=py34&pytest=2.6.4.dev1
|
||||
`pytest-pep8 <http://pypi.python.org/pypi/pytest-pep8>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pep8-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pep8-latest?py=py34&pytest=2.6.4.dev1 .. image:: bitbucket.png pytest plugin to check PEP8 requirements
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-pep8-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-pep8-latest?py=py34&pytest=2.6.4.dev1 :target: http://bitbucket.org/hpk42/pytest-pep8/
|
||||
`pytest-pipeline <http://pypi.python.org/pypi/pytest-pipeline>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pipeline-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pipeline-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Pytest plugin for functional testing of data analysis pipelines
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-pipeline-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-pipeline-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/bow/pytest_pipeline
|
||||
`pytest-poo <http://pypi.python.org/pypi/pytest-poo>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-poo-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-poo-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Visualize your crappy tests
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-poo-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-poo-latest?py=py34&pytest=2.6.4.dev1 :target: http://github.com/pelme/pytest-poo
|
||||
`pytest-pycharm <http://pypi.python.org/pypi/pytest-pycharm>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pycharm-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pycharm-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Plugin for py.test to enter PyCharm debugger on uncaught exceptions
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-pycharm-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-pycharm-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/jlubcke/pytest-pycharm
|
||||
`pytest-pydev <http://pypi.python.org/pypi/pytest-pydev>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pydev-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pydev-latest?py=py34&pytest=2.6.4.dev1 .. image:: bitbucket.png py.test plugin to connect to a remote debug server with PyDev or PyCharm.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-pydev-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-pydev-latest?py=py34&pytest=2.6.4.dev1 :target: http://bitbucket.org/basti/pytest-pydev/
|
||||
`pytest-pythonpath <http://pypi.python.org/pypi/pytest-pythonpath>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pythonpath-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pythonpath-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png pytest plugin for adding to the PYTHONPATH from command line or configs.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-pythonpath-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-pythonpath-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/bigsassy/pytest-pythonpath
|
||||
`pytest-qt <http://pypi.python.org/pypi/pytest-qt>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-qt-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-qt-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png pytest support for PyQt and PySide applications
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-qt-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-qt-latest?py=py34&pytest=2.6.4.dev1 :target: http://github.com/nicoddemus/pytest-qt
|
||||
`pytest-quickcheck <http://pypi.python.org/pypi/pytest-quickcheck>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-quickcheck-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-quickcheck-latest?py=py34&pytest=2.6.4.dev1 .. image:: bitbucket.png pytest plugin to generate random data inspired by QuickCheck
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-quickcheck-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-quickcheck-latest?py=py34&pytest=2.6.4.dev1 :target: http://bitbucket.org/t2y/pytest-quickcheck/
|
||||
`pytest-rage <http://pypi.python.org/pypi/pytest-rage>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rage-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rage-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png pytest plugin to implement PEP712
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-rage-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-rage-latest?py=py34&pytest=2.6.4.dev1 :target: http://github.com/santagada/pytest-rage/
|
||||
`pytest-raisesregexp <http://pypi.python.org/pypi/pytest-raisesregexp>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-raisesregexp-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-raisesregexp-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Simple pytest plugin to look for regex in Exceptions
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-raisesregexp-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-raisesregexp-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/Walkman/pytest_raisesregexp
|
||||
`pytest-random <http://pypi.python.org/pypi/pytest-random>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-random-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-random-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png py.test plugin to randomize tests
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-random-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-random-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/klrmn/pytest-random
|
||||
`pytest-regtest <http://pypi.python.org/pypi/pytest-regtest>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-regtest-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-regtest-latest?py=py34&pytest=2.6.4.dev1 `link <https://sissource.ethz.ch/uweschmitt/pytest-regtest/tree/master>`_ py.test plugin for regression tests
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-regtest-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-regtest-latest?py=py34&pytest=2.6.4.dev1
|
||||
`pytest-rerunfailures <http://pypi.python.org/pypi/pytest-rerunfailures>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rerunfailures-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rerunfailures-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png py.test plugin to re-run tests to eliminate flakey failures
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-rerunfailures-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-rerunfailures-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/klrmn/pytest-rerunfailures
|
||||
`pytest-runfailed <http://pypi.python.org/pypi/pytest-runfailed>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runfailed-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runfailed-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png implement a --failed option for pytest
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-runfailed-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-runfailed-latest?py=py34&pytest=2.6.4.dev1 :target: http://github.com/dmerejkowsky/pytest-runfailed
|
||||
`pytest-runner <http://pypi.python.org/pypi/pytest-runner>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runner-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runner-latest?py=py34&pytest=2.6.4.dev1 .. image:: bitbucket.png Invoke py.test as distutils command with dependency resolution.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-runner-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-runner-latest?py=py34&pytest=2.6.4.dev1 :target: https://bitbucket.org/jaraco/pytest-runner
|
||||
`pytest-sftpserver <http://pypi.python.org/pypi/pytest-sftpserver>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-sftpserver-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-sftpserver-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png py.test plugin to locally test sftp server connections.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-sftpserver-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-sftpserver-latest?py=py34&pytest=2.6.4.dev1 :target: http://github.com/ulope/pytest-sftpserver/
|
||||
`pytest-spec <http://pypi.python.org/pypi/pytest-spec>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-spec-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-spec-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png pytest plugin to display test execution output like a SPECIFICATION
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-spec-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-spec-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/pchomik/pytest-spec
|
||||
`pytest-splinter <http://pypi.python.org/pypi/pytest-splinter>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-splinter-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-splinter-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Splinter plugin for pytest testing framework
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-splinter-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-splinter-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/pytest-dev/pytest-splinter
|
||||
`pytest-stepwise <http://pypi.python.org/pypi/pytest-stepwise>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-stepwise-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-stepwise-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png Run a test suite one failing test at a time.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-stepwise-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-stepwise-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/nip3o/pytest-stepwise
|
||||
`pytest-sugar <http://pypi.python.org/pypi/pytest-sugar>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-sugar-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-sugar-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png py.test is a plugin for py.test that changes the default look and feel of py.test (e.g. progressbar, show tests that fail instantly).
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-sugar-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-sugar-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/Frozenball/pytest-sugar
|
||||
`pytest-timeout <http://pypi.python.org/pypi/pytest-timeout>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-timeout-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-timeout-latest?py=py34&pytest=2.6.4.dev1 .. image:: bitbucket.png py.test plugin to abort hanging tests
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-timeout-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-timeout-latest?py=py34&pytest=2.6.4.dev1 :target: http://bitbucket.org/flub/pytest-timeout/
|
||||
`pytest-twisted <http://pypi.python.org/pypi/pytest-twisted>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-twisted-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-twisted-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png A twisted plugin for py.test.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-twisted-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-twisted-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/schmir/pytest-twisted
|
||||
`pytest-xdist <http://pypi.python.org/pypi/pytest-xdist>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xdist-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xdist-latest?py=py34&pytest=2.6.4.dev1 .. image:: bitbucket.png py.test xdist plugin for distributed testing and loop-on-failing modes
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-xdist-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-xdist-latest?py=py34&pytest=2.6.4.dev1 :target: http://bitbucket.org/hpk42/pytest-xdist
|
||||
`pytest-xprocess <http://pypi.python.org/pypi/pytest-xprocess>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xprocess-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xprocess-latest?py=py34&pytest=2.6.4.dev1 .. image:: bitbucket.png pytest plugin to manage external processes across test runs
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-xprocess-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-xprocess-latest?py=py34&pytest=2.6.4.dev1 :target: http://bitbucket.org/hpk42/pytest-xprocess/
|
||||
`pytest-yamlwsgi <http://pypi.python.org/pypi/pytest-yamlwsgi>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-yamlwsgi-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-yamlwsgi-latest?py=py34&pytest=2.6.4.dev1 ? Run tests against wsgi apps defined in yaml
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-yamlwsgi-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-yamlwsgi-latest?py=py34&pytest=2.6.4.dev1
|
||||
`pytest-zap <http://pypi.python.org/pypi/pytest-zap>`_ .. image:: http://pytest-plugs.herokuapp.com/status/pytest-zap-latest?py=py27&pytest=2.6.4.dev1 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-zap-latest?py=py34&pytest=2.6.4.dev1 .. image:: github.png OWASP ZAP plugin for py.test.
|
||||
:target: http://pytest-plugs.herokuapp.com/output/pytest-zap-latest?py=py27&pytest=2.6.4.dev1 :target: http://pytest-plugs.herokuapp.com/output/pytest-zap-latest?py=py34&pytest=2.6.4.dev1 :target: https://github.com/davehunt/pytest-zap
|
||||
============================================================================================ ================================================================================================================ ================================================================================================================ =========================================================================== =============================================================================================================================================
|
||||
Name Py27 Py34 Home Summary
|
||||
============================================================================================ ================================================================================================================ ================================================================================================================ =========================================================================== =============================================================================================================================================
|
||||
`pytest-allure-adaptor <http://pypi.python.org/pypi/pytest-allure-adaptor>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-allure-adaptor-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-allure-adaptor-latest?py=py34&pytest=2.7.0 .. image:: github.png Plugin for py.test to generate allure xml reports
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-allure-adaptor-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-allure-adaptor-latest?py=py34&pytest=2.7.0 :target: https://github.com/allure-framework/allure-python
|
||||
`pytest-ansible <http://pypi.python.org/pypi/pytest-ansible>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-ansible-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-ansible-latest?py=py34&pytest=2.7.0 .. image:: github.png UNKNOWN
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-ansible-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-ansible-latest?py=py34&pytest=2.7.0 :target: http://github.com/jlaska/pytest-ansible
|
||||
`pytest-autochecklog <http://pypi.python.org/pypi/pytest-autochecklog>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-autochecklog-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-autochecklog-latest?py=py34&pytest=2.7.0 .. image:: github.png automatically check condition and log all the checks
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-autochecklog-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-autochecklog-latest?py=py34&pytest=2.7.0 :target: https://github.com/steven004/python-autochecklog
|
||||
`pytest-bdd <http://pypi.python.org/pypi/pytest-bdd>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-bdd-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-bdd-latest?py=py34&pytest=2.7.0 .. image:: github.png BDD for pytest
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-bdd-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-bdd-latest?py=py34&pytest=2.7.0 :target: https://github.com/olegpidsadnyi/pytest-bdd
|
||||
`pytest-beakerlib <http://pypi.python.org/pypi/pytest-beakerlib>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-beakerlib-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-beakerlib-latest?py=py34&pytest=2.7.0 `link <https://fedorahosted.org/python-pytest-beakerlib/>`_ A pytest plugin that reports test results to the BeakerLib framework
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-beakerlib-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-beakerlib-latest?py=py34&pytest=2.7.0
|
||||
`pytest-beds <http://pypi.python.org/pypi/pytest-beds>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-beds-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-beds-latest?py=py34&pytest=2.7.0 .. image:: github.png Fixtures for testing Google Appengine (GAE) apps
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-beds-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-beds-latest?py=py34&pytest=2.7.0 :target: https://github.com/kaste/pytest-beds
|
||||
`pytest-bench <http://pypi.python.org/pypi/pytest-bench>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-bench-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-bench-latest?py=py34&pytest=2.7.0 .. image:: github.png Benchmark utility that plugs into pytest.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-bench-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-bench-latest?py=py34&pytest=2.7.0 :target: http://github.com/concordusapps/pytest-bench
|
||||
`pytest-benchmark <http://pypi.python.org/pypi/pytest-benchmark>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-benchmark-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-benchmark-latest?py=py34&pytest=2.7.0 .. image:: github.png py.test fixture for benchmarking code
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-benchmark-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-benchmark-latest?py=py34&pytest=2.7.0 :target: https://github.com/ionelmc/pytest-benchmark
|
||||
`pytest-blockage <http://pypi.python.org/pypi/pytest-blockage>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-blockage-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-blockage-latest?py=py34&pytest=2.7.0 .. image:: github.png Disable network requests during a test run.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-blockage-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-blockage-latest?py=py34&pytest=2.7.0 :target: https://github.com/rob-b/pytest-blockage
|
||||
`pytest-bpdb <http://pypi.python.org/pypi/pytest-bpdb>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-bpdb-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-bpdb-latest?py=py34&pytest=2.7.0 .. image:: github.png A py.test plug-in to enable drop to bpdb debugger on test failure.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-bpdb-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-bpdb-latest?py=py34&pytest=2.7.0 :target: https://github.com/slafs/pytest-bpdb
|
||||
`pytest-browsermob-proxy <http://pypi.python.org/pypi/pytest-browsermob-proxy>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-browsermob-proxy-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-browsermob-proxy-latest?py=py34&pytest=2.7.0 .. image:: github.png BrowserMob proxy plugin for py.test.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-browsermob-proxy-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-browsermob-proxy-latest?py=py34&pytest=2.7.0 :target: https://github.com/davehunt/pytest-browsermob-proxy
|
||||
`pytest-bugzilla <http://pypi.python.org/pypi/pytest-bugzilla>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-bugzilla-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-bugzilla-latest?py=py34&pytest=2.7.0 .. image:: github.png py.test bugzilla integration plugin
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-bugzilla-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-bugzilla-latest?py=py34&pytest=2.7.0 :target: http://github.com/nibrahim/pytest_bugzilla
|
||||
`pytest-cache <http://pypi.python.org/pypi/pytest-cache>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-cache-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-cache-latest?py=py34&pytest=2.7.0 .. image:: bitbucket.png pytest plugin with mechanisms for caching across test runs
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-cache-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-cache-latest?py=py34&pytest=2.7.0 :target: http://bitbucket.org/hpk42/pytest-cache/
|
||||
`pytest-cagoule <http://pypi.python.org/pypi/pytest-cagoule>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-cagoule-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-cagoule-latest?py=py34&pytest=2.7.0 .. image:: github.png Pytest plugin to only run tests affected by changes
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-cagoule-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-cagoule-latest?py=py34&pytest=2.7.0 :target: https://github.com/davidszotten/pytest-cagoule
|
||||
`pytest-capturelog <http://pypi.python.org/pypi/pytest-capturelog>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-capturelog-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-capturelog-latest?py=py34&pytest=2.7.0 .. image:: bitbucket.png py.test plugin to capture log messages
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-capturelog-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-capturelog-latest?py=py34&pytest=2.7.0 :target: http://bitbucket.org/memedough/pytest-capturelog/overview
|
||||
`pytest-catchlog <http://pypi.python.org/pypi/pytest-catchlog>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-catchlog-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-catchlog-latest?py=py34&pytest=2.7.0 .. image:: github.png py.test plugin to catch log messages. This is a fork of pytest-capturelog.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-catchlog-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-catchlog-latest?py=py34&pytest=2.7.0 :target: https://github.com/eisensheng/pytest-catchlog
|
||||
`pytest-circleci <http://pypi.python.org/pypi/pytest-circleci>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-circleci-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-circleci-latest?py=py34&pytest=2.7.0 .. image:: github.png py.test plugin for CircleCI
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-circleci-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-circleci-latest?py=py34&pytest=2.7.0 :target: https://github.com/micktwomey/pytest-circleci
|
||||
`pytest-cloud <http://pypi.python.org/pypi/pytest-cloud>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-cloud-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-cloud-latest?py=py34&pytest=2.7.0 .. image:: github.png Distributed tests planner plugin for pytest testing framework.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-cloud-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-cloud-latest?py=py34&pytest=2.7.0 :target: https://github.com/pytest-dev/pytest-cloud
|
||||
`pytest-codecheckers <http://pypi.python.org/pypi/pytest-codecheckers>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-codecheckers-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-codecheckers-latest?py=py34&pytest=2.7.0 .. image:: bitbucket.png pytest plugin to add source code sanity checks (pep8 and friends)
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-codecheckers-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-codecheckers-latest?py=py34&pytest=2.7.0 :target: http://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/
|
||||
`pytest-colordots <http://pypi.python.org/pypi/pytest-colordots>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-colordots-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-colordots-latest?py=py34&pytest=2.7.0 .. image:: github.png Colorizes the progress indicators
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-colordots-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-colordots-latest?py=py34&pytest=2.7.0 :target: https://github.com/svenstaro/pytest-colordots
|
||||
`pytest-config <http://pypi.python.org/pypi/pytest-config>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-config-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-config-latest?py=py34&pytest=2.7.0 .. image:: github.png Base configurations and utilities for developing your Python project test suite with pytest.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-config-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-config-latest?py=py34&pytest=2.7.0 :target: https://github.com/buzzfeed/pytest_config
|
||||
`pytest-contextfixture <http://pypi.python.org/pypi/pytest-contextfixture>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-contextfixture-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-contextfixture-latest?py=py34&pytest=2.7.0 .. image:: github.png Define pytest fixtures as context managers.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-contextfixture-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-contextfixture-latest?py=py34&pytest=2.7.0 :target: http://github.com/pelme/pytest-contextfixture/
|
||||
`pytest-couchdbkit <http://pypi.python.org/pypi/pytest-couchdbkit>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-couchdbkit-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-couchdbkit-latest?py=py34&pytest=2.7.0 .. image:: bitbucket.png py.test extension for per-test couchdb databases using couchdbkit
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-couchdbkit-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-couchdbkit-latest?py=py34&pytest=2.7.0 :target: http://bitbucket.org/RonnyPfannschmidt/pytest-couchdbkit
|
||||
`pytest-cov <http://pypi.python.org/pypi/pytest-cov>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-cov-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-cov-latest?py=py34&pytest=2.7.0 .. image:: github.png py.test plugin for coverage reporting with support for both centralised and distributed testing, including subprocesses and multiprocessing
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-cov-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-cov-latest?py=py34&pytest=2.7.0 :target: https://github.com/schlamar/pytest-cov
|
||||
`pytest-cpp <http://pypi.python.org/pypi/pytest-cpp>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-cpp-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-cpp-latest?py=py34&pytest=2.7.0 .. image:: github.png Use pytest's runner to discover and execute C++ tests
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-cpp-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-cpp-latest?py=py34&pytest=2.7.0 :target: http://github.com/pytest-dev/pytest-cpp
|
||||
`pytest-dbfixtures <http://pypi.python.org/pypi/pytest-dbfixtures>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-dbfixtures-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-dbfixtures-latest?py=py34&pytest=2.7.0 .. image:: github.png Databases fixtures plugin for py.test.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-dbfixtures-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-dbfixtures-latest?py=py34&pytest=2.7.0 :target: https://github.com/ClearcodeHQ/pytest-dbfixtures
|
||||
`pytest-dbus-notification <http://pypi.python.org/pypi/pytest-dbus-notification>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-dbus-notification-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-dbus-notification-latest?py=py34&pytest=2.7.0 .. image:: github.png D-BUS notifications for pytest results.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-dbus-notification-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-dbus-notification-latest?py=py34&pytest=2.7.0 :target: https://github.com/bmathieu33/pytest-dbus-notification
|
||||
`pytest-describe <http://pypi.python.org/pypi/pytest-describe>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-describe-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-describe-latest?py=py34&pytest=2.7.0 .. image:: github.png Describe-style plugin for pytest
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-describe-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-describe-latest?py=py34&pytest=2.7.0 :target: https://github.com/ropez/pytest-describe
|
||||
`pytest-diffeo <http://pypi.python.org/pypi/pytest-diffeo>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-diffeo-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-diffeo-latest?py=py34&pytest=2.7.0 .. image:: github.png Common py.test support for Diffeo packages
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-diffeo-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-diffeo-latest?py=py34&pytest=2.7.0 :target: https://github.com/diffeo/pytest-diffeo
|
||||
`pytest-django <http://pypi.python.org/pypi/pytest-django>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-django-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-django-latest?py=py34&pytest=2.7.0 `link <http://pytest-django.readthedocs.org/>`_ A Django plugin for py.test.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-django-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-django-latest?py=py34&pytest=2.7.0
|
||||
`pytest-django-haystack <http://pypi.python.org/pypi/pytest-django-haystack>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-django-haystack-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-django-haystack-latest?py=py34&pytest=2.7.0 .. image:: github.png Cleanup your Haystack indexes between tests
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-django-haystack-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-django-haystack-latest?py=py34&pytest=2.7.0 :target: http://github.com/rouge8/pytest-django-haystack
|
||||
`pytest-django-lite <http://pypi.python.org/pypi/pytest-django-lite>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-django-lite-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-django-lite-latest?py=py34&pytest=2.7.0 .. image:: github.png The bare minimum to integrate py.test with Django.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-django-lite-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-django-lite-latest?py=py34&pytest=2.7.0 :target: https://github.com/dcramer/pytest-django-lite
|
||||
`pytest-django-sqlcount <http://pypi.python.org/pypi/pytest-django-sqlcount>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-django-sqlcount-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-django-sqlcount-latest?py=py34&pytest=2.7.0 .. image:: github.png py.test plugin for reporting the number of SQLs executed per django testcase.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-django-sqlcount-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-django-sqlcount-latest?py=py34&pytest=2.7.0 :target: https://github.com/stj/pytest-django-sqlcount
|
||||
`pytest-echo <http://pypi.python.org/pypi/pytest-echo>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-echo-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-echo-latest?py=py34&pytest=2.7.0 `link <http://pypi.python.org/pypi/pytest-echo/>`_ pytest plugin with mechanisms for echoing environment variables, package version and generic attributes
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-echo-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-echo-latest?py=py34&pytest=2.7.0
|
||||
`pytest-env <http://pypi.python.org/pypi/pytest-env>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-env-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-env-latest?py=py34&pytest=2.7.0 .. image:: github.png py.test plugin that allows you to add environment variables.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-env-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-env-latest?py=py34&pytest=2.7.0 :target: https://github.com/MobileDynasty/pytest-env
|
||||
`pytest-eradicate <http://pypi.python.org/pypi/pytest-eradicate>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-eradicate-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-eradicate-latest?py=py34&pytest=2.7.0 .. image:: github.png pytest plugin to check for commented out code
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-eradicate-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-eradicate-latest?py=py34&pytest=2.7.0 :target: https://github.com/spil-johan/pytest-eradicate
|
||||
`pytest-figleaf <http://pypi.python.org/pypi/pytest-figleaf>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-figleaf-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-figleaf-latest?py=py34&pytest=2.7.0 .. image:: bitbucket.png py.test figleaf coverage plugin
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-figleaf-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-figleaf-latest?py=py34&pytest=2.7.0 :target: http://bitbucket.org/hpk42/pytest-figleaf
|
||||
`pytest-fixture-tools <http://pypi.python.org/pypi/pytest-fixture-tools>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-fixture-tools-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-fixture-tools-latest?py=py34&pytest=2.7.0 ? Plugin for pytest which provides tools for fixtures
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-fixture-tools-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-fixture-tools-latest?py=py34&pytest=2.7.0
|
||||
`pytest-flakes <http://pypi.python.org/pypi/pytest-flakes>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-flakes-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-flakes-latest?py=py34&pytest=2.7.0 .. image:: github.png pytest plugin to check source code with pyflakes
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-flakes-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-flakes-latest?py=py34&pytest=2.7.0 :target: https://github.com/fschulze/pytest-flakes
|
||||
`pytest-flask <http://pypi.python.org/pypi/pytest-flask>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-flask-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-flask-latest?py=py34&pytest=2.7.0 .. image:: github.png A set of py.test fixtures to test Flask applications.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-flask-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-flask-latest?py=py34&pytest=2.7.0 :target: https://github.com/vitalk/pytest-flask
|
||||
`pytest-greendots <http://pypi.python.org/pypi/pytest-greendots>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-greendots-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-greendots-latest?py=py34&pytest=2.7.0 ? Green progress dots
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-greendots-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-greendots-latest?py=py34&pytest=2.7.0
|
||||
`pytest-growl <http://pypi.python.org/pypi/pytest-growl>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-growl-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-growl-latest?py=py34&pytest=2.7.0 ? Growl notifications for pytest results.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-growl-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-growl-latest?py=py34&pytest=2.7.0
|
||||
`pytest-httpbin <http://pypi.python.org/pypi/pytest-httpbin>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-httpbin-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-httpbin-latest?py=py34&pytest=2.7.0 .. image:: github.png Easily test your HTTP library against a local copy of httpbin
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-httpbin-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-httpbin-latest?py=py34&pytest=2.7.0 :target: https://github.com/kevin1024/pytest-httpbin
|
||||
`pytest-httpretty <http://pypi.python.org/pypi/pytest-httpretty>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-httpretty-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-httpretty-latest?py=py34&pytest=2.7.0 .. image:: github.png A thin wrapper of HTTPretty for pytest
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-httpretty-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-httpretty-latest?py=py34&pytest=2.7.0 :target: http://github.com/papaeye/pytest-httpretty
|
||||
`pytest-incremental <http://pypi.python.org/pypi/pytest-incremental>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-incremental-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-incremental-latest?py=py34&pytest=2.7.0 .. image:: bitbucket.png an incremental test runner (pytest plugin)
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-incremental-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-incremental-latest?py=py34&pytest=2.7.0 :target: https://bitbucket.org/schettino72/pytest-incremental
|
||||
`pytest-instafail <http://pypi.python.org/pypi/pytest-instafail>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-instafail-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-instafail-latest?py=py34&pytest=2.7.0 .. image:: github.png py.test plugin to show failures instantly
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-instafail-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-instafail-latest?py=py34&pytest=2.7.0 :target: https://github.com/jpvanhal/pytest-instafail
|
||||
`pytest-ipdb <http://pypi.python.org/pypi/pytest-ipdb>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-ipdb-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-ipdb-latest?py=py34&pytest=2.7.0 .. image:: github.png A py.test plug-in to enable drop to ipdb debugger on test failure.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-ipdb-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-ipdb-latest?py=py34&pytest=2.7.0 :target: https://github.com/mverteuil/pytest-ipdb
|
||||
`pytest-ipynb <http://pypi.python.org/pypi/pytest-ipynb>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-ipynb-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-ipynb-latest?py=py34&pytest=2.7.0 .. image:: github.png Use pytest's runner to discover and execute tests as cells of IPython notebooks
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-ipynb-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-ipynb-latest?py=py34&pytest=2.7.0 :target: http://github.com/zonca/pytest-ipynb
|
||||
`pytest-jira <http://pypi.python.org/pypi/pytest-jira>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-jira-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-jira-latest?py=py34&pytest=2.7.0 .. image:: github.png py.test JIRA integration plugin, using markers
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-jira-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-jira-latest?py=py34&pytest=2.7.0 :target: http://github.com/jlaska/pytest_jira
|
||||
`pytest-knows <http://pypi.python.org/pypi/pytest-knows>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-knows-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-knows-latest?py=py34&pytest=2.7.0 .. image:: github.png A pytest plugin that can automaticly skip test case based on dependence info calculated by trace
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-knows-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-knows-latest?py=py34&pytest=2.7.0 :target: https://github.com/mapix/ptknows
|
||||
`pytest-konira <http://pypi.python.org/pypi/pytest-konira>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-konira-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-konira-latest?py=py34&pytest=2.7.0 .. image:: github.png Run Konira DSL tests with py.test
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-konira-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-konira-latest?py=py34&pytest=2.7.0 :target: http://github.com/alfredodeza/pytest-konira
|
||||
`pytest-localserver <http://pypi.python.org/pypi/pytest-localserver>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-localserver-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-localserver-latest?py=py34&pytest=2.7.0 .. image:: bitbucket.png py.test plugin to test server connections locally.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-localserver-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-localserver-latest?py=py34&pytest=2.7.0 :target: http://bitbucket.org/basti/pytest-localserver/
|
||||
`pytest-marker-bugzilla <http://pypi.python.org/pypi/pytest-marker-bugzilla>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-marker-bugzilla-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-marker-bugzilla-latest?py=py34&pytest=2.7.0 .. image:: github.png py.test bugzilla integration plugin, using markers
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-marker-bugzilla-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-marker-bugzilla-latest?py=py34&pytest=2.7.0 :target: http://github.com/eanxgeek/pytest_marker_bugzilla
|
||||
`pytest-markfiltration <http://pypi.python.org/pypi/pytest-markfiltration>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-markfiltration-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-markfiltration-latest?py=py34&pytest=2.7.0 .. image:: github.png UNKNOWN
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-markfiltration-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-markfiltration-latest?py=py34&pytest=2.7.0 :target: https://github.com/adamgoucher/pytest-markfiltration
|
||||
`pytest-marks <http://pypi.python.org/pypi/pytest-marks>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-marks-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-marks-latest?py=py34&pytest=2.7.0 .. image:: github.png UNKNOWN
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-marks-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-marks-latest?py=py34&pytest=2.7.0 :target: https://github.com/adamgoucher/pytest-marks
|
||||
`pytest-mock <http://pypi.python.org/pypi/pytest-mock>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-mock-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-mock-latest?py=py34&pytest=2.7.0 .. image:: github.png Thin-wrapper around the mock package for easier use with py.test
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-mock-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-mock-latest?py=py34&pytest=2.7.0 :target: https://github.com/pytest-dev/pytest-mock/
|
||||
`pytest-monkeyplus <http://pypi.python.org/pypi/pytest-monkeyplus>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-monkeyplus-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-monkeyplus-latest?py=py34&pytest=2.7.0 .. image:: bitbucket.png pytest's monkeypatch subclass with extra functionalities
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-monkeyplus-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-monkeyplus-latest?py=py34&pytest=2.7.0 :target: http://bitbucket.org/hsoft/pytest-monkeyplus/
|
||||
`pytest-mozwebqa <http://pypi.python.org/pypi/pytest-mozwebqa>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-mozwebqa-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-mozwebqa-latest?py=py34&pytest=2.7.0 .. image:: github.png Mozilla WebQA plugin for py.test.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-mozwebqa-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-mozwebqa-latest?py=py34&pytest=2.7.0 :target: https://github.com/mozilla/pytest-mozwebqa
|
||||
`pytest-multihost <http://pypi.python.org/pypi/pytest-multihost>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-multihost-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-multihost-latest?py=py34&pytest=2.7.0 `link <https://fedorahosted.org/python-pytest-multihost/>`_ Utility for writing multi-host tests for pytest
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-multihost-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-multihost-latest?py=py34&pytest=2.7.0
|
||||
`pytest-oerp <http://pypi.python.org/pypi/pytest-oerp>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-oerp-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-oerp-latest?py=py34&pytest=2.7.0 .. image:: github.png pytest plugin to test OpenERP modules
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-oerp-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-oerp-latest?py=py34&pytest=2.7.0 :target: http://github.com/santagada/pytest-oerp/
|
||||
`pytest-oot <http://pypi.python.org/pypi/pytest-oot>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-oot-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-oot-latest?py=py34&pytest=2.7.0 `link <https://pypi.python.org/pypi?name=pytest-oot&:action=display>`_ Run object-oriented tests in a simple format
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-oot-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-oot-latest?py=py34&pytest=2.7.0
|
||||
`pytest-optional <http://pypi.python.org/pypi/pytest-optional>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-optional-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-optional-latest?py=py34&pytest=2.7.0 .. image:: bitbucket.png include/exclude values of fixtures in pytest
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-optional-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-optional-latest?py=py34&pytest=2.7.0 :target: http://bitbucket.org/maho/pytest-optional
|
||||
`pytest-ordering <http://pypi.python.org/pypi/pytest-ordering>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-ordering-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-ordering-latest?py=py34&pytest=2.7.0 .. image:: github.png pytest plugin to run your tests in a specific order
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-ordering-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-ordering-latest?py=py34&pytest=2.7.0 :target: https://github.com/ftobia/pytest-ordering
|
||||
`pytest-osxnotify <http://pypi.python.org/pypi/pytest-osxnotify>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-osxnotify-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-osxnotify-latest?py=py34&pytest=2.7.0 .. image:: github.png OS X notifications for py.test results.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-osxnotify-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-osxnotify-latest?py=py34&pytest=2.7.0 :target: https://github.com/dbader/pytest-osxnotify
|
||||
`pytest-paste-config <http://pypi.python.org/pypi/pytest-paste-config>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-paste-config-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-paste-config-latest?py=py34&pytest=2.7.0 ? Allow setting the path to a paste config file
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-paste-config-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-paste-config-latest?py=py34&pytest=2.7.0
|
||||
`pytest-pep257 <http://pypi.python.org/pypi/pytest-pep257>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-pep257-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-pep257-latest?py=py34&pytest=2.7.0 ? py.test plugin for pep257
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-pep257-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-pep257-latest?py=py34&pytest=2.7.0
|
||||
`pytest-pep8 <http://pypi.python.org/pypi/pytest-pep8>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-pep8-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-pep8-latest?py=py34&pytest=2.7.0 .. image:: bitbucket.png pytest plugin to check PEP8 requirements
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-pep8-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-pep8-latest?py=py34&pytest=2.7.0 :target: http://bitbucket.org/hpk42/pytest-pep8/
|
||||
`pytest-pipeline <http://pypi.python.org/pypi/pytest-pipeline>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-pipeline-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-pipeline-latest?py=py34&pytest=2.7.0 .. image:: github.png Pytest plugin for functional testing of data analysis pipelines
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-pipeline-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-pipeline-latest?py=py34&pytest=2.7.0 :target: https://github.com/bow/pytest_pipeline
|
||||
`pytest-poo <http://pypi.python.org/pypi/pytest-poo>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-poo-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-poo-latest?py=py34&pytest=2.7.0 .. image:: github.png Visualize your crappy tests
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-poo-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-poo-latest?py=py34&pytest=2.7.0 :target: http://github.com/pelme/pytest-poo
|
||||
`pytest-poo-fail <http://pypi.python.org/pypi/pytest-poo-fail>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-poo-fail-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-poo-fail-latest?py=py34&pytest=2.7.0 .. image:: github.png Visualize your failed tests with poo
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-poo-fail-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-poo-fail-latest?py=py34&pytest=2.7.0 :target: http://github.com/alyssa.barela/pytest-poo-fail
|
||||
`pytest-pycharm <http://pypi.python.org/pypi/pytest-pycharm>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-pycharm-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-pycharm-latest?py=py34&pytest=2.7.0 .. image:: github.png Plugin for py.test to enter PyCharm debugger on uncaught exceptions
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-pycharm-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-pycharm-latest?py=py34&pytest=2.7.0 :target: https://github.com/jlubcke/pytest-pycharm
|
||||
`pytest-pydev <http://pypi.python.org/pypi/pytest-pydev>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-pydev-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-pydev-latest?py=py34&pytest=2.7.0 .. image:: bitbucket.png py.test plugin to connect to a remote debug server with PyDev or PyCharm.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-pydev-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-pydev-latest?py=py34&pytest=2.7.0 :target: http://bitbucket.org/basti/pytest-pydev/
|
||||
`pytest-pyq <http://pypi.python.org/pypi/pytest-pyq>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-pyq-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-pyq-latest?py=py34&pytest=2.7.0 `link <http://pyq.enlnt.com>`_ Pytest fixture "q" for pyq
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-pyq-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-pyq-latest?py=py34&pytest=2.7.0
|
||||
`pytest-pythonpath <http://pypi.python.org/pypi/pytest-pythonpath>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-pythonpath-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-pythonpath-latest?py=py34&pytest=2.7.0 .. image:: github.png pytest plugin for adding to the PYTHONPATH from command line or configs.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-pythonpath-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-pythonpath-latest?py=py34&pytest=2.7.0 :target: https://github.com/bigsassy/pytest-pythonpath
|
||||
`pytest-qt <http://pypi.python.org/pypi/pytest-qt>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-qt-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-qt-latest?py=py34&pytest=2.7.0 .. image:: github.png pytest support for PyQt and PySide applications
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-qt-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-qt-latest?py=py34&pytest=2.7.0 :target: http://github.com/pytest-dev/pytest-qt
|
||||
`pytest-quickcheck <http://pypi.python.org/pypi/pytest-quickcheck>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-quickcheck-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-quickcheck-latest?py=py34&pytest=2.7.0 .. image:: bitbucket.png pytest plugin to generate random data inspired by QuickCheck
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-quickcheck-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-quickcheck-latest?py=py34&pytest=2.7.0 :target: http://bitbucket.org/t2y/pytest-quickcheck/
|
||||
`pytest-rage <http://pypi.python.org/pypi/pytest-rage>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-rage-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-rage-latest?py=py34&pytest=2.7.0 .. image:: github.png pytest plugin to implement PEP712
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-rage-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-rage-latest?py=py34&pytest=2.7.0 :target: http://github.com/santagada/pytest-rage/
|
||||
`pytest-raisesregexp <http://pypi.python.org/pypi/pytest-raisesregexp>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-raisesregexp-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-raisesregexp-latest?py=py34&pytest=2.7.0 .. image:: github.png Simple pytest plugin to look for regex in Exceptions
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-raisesregexp-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-raisesregexp-latest?py=py34&pytest=2.7.0 :target: https://github.com/Walkman/pytest_raisesregexp
|
||||
`pytest-random <http://pypi.python.org/pypi/pytest-random>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-random-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-random-latest?py=py34&pytest=2.7.0 .. image:: github.png py.test plugin to randomize tests
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-random-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-random-latest?py=py34&pytest=2.7.0 :target: https://github.com/klrmn/pytest-random
|
||||
`pytest-readme <http://pypi.python.org/pypi/pytest-readme>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-readme-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-readme-latest?py=py34&pytest=2.7.0 .. image:: github.png Test your README.md file
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-readme-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-readme-latest?py=py34&pytest=2.7.0 :target: https://github.com/boxed/pytest-readme
|
||||
`pytest-regtest <http://pypi.python.org/pypi/pytest-regtest>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-regtest-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-regtest-latest?py=py34&pytest=2.7.0 `link <https://sissource.ethz.ch/uweschmitt/pytest-regtest/tree/master>`_ py.test plugin for regression tests
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-regtest-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-regtest-latest?py=py34&pytest=2.7.0
|
||||
`pytest-remove-stale-bytecode <http://pypi.python.org/pypi/pytest-remove-stale-bytecode>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-remove-stale-bytecode-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-remove-stale-bytecode-latest?py=py34&pytest=2.7.0 .. image:: bitbucket.png py.test plugin to remove stale byte code files.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-remove-stale-bytecode-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-remove-stale-bytecode-latest?py=py34&pytest=2.7.0 :target: https://bitbucket.org/gocept/pytest-remove-stale-bytecode/
|
||||
`pytest-rerunfailures <http://pypi.python.org/pypi/pytest-rerunfailures>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-rerunfailures-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-rerunfailures-latest?py=py34&pytest=2.7.0 .. image:: github.png py.test plugin to re-run tests to eliminate flakey failures
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-rerunfailures-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-rerunfailures-latest?py=py34&pytest=2.7.0 :target: https://github.com/klrmn/pytest-rerunfailures
|
||||
`pytest-runfailed <http://pypi.python.org/pypi/pytest-runfailed>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-runfailed-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-runfailed-latest?py=py34&pytest=2.7.0 .. image:: github.png implement a --failed option for pytest
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-runfailed-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-runfailed-latest?py=py34&pytest=2.7.0 :target: http://github.com/dmerejkowsky/pytest-runfailed
|
||||
`pytest-runner <http://pypi.python.org/pypi/pytest-runner>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-runner-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-runner-latest?py=py34&pytest=2.7.0 .. image:: bitbucket.png Invoke py.test as distutils command with dependency resolution.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-runner-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-runner-latest?py=py34&pytest=2.7.0 :target: https://bitbucket.org/jaraco/pytest-runner
|
||||
`pytest-services <http://pypi.python.org/pypi/pytest-services>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-services-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-services-latest?py=py34&pytest=2.7.0 .. image:: github.png Services plugin for pytest testing framework
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-services-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-services-latest?py=py34&pytest=2.7.0 :target: https://github.com/pytest-dev/pytest-services
|
||||
`pytest-sftpserver <http://pypi.python.org/pypi/pytest-sftpserver>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-sftpserver-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-sftpserver-latest?py=py34&pytest=2.7.0 .. image:: github.png py.test plugin to locally test sftp server connections.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-sftpserver-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-sftpserver-latest?py=py34&pytest=2.7.0 :target: http://github.com/ulope/pytest-sftpserver/
|
||||
`pytest-smartcov <http://pypi.python.org/pypi/pytest-smartcov>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-smartcov-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-smartcov-latest?py=py34&pytest=2.7.0 .. image:: github.png Smart coverage plugin for pytest.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-smartcov-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-smartcov-latest?py=py34&pytest=2.7.0 :target: https://github.com/carljm/pytest-smartcov/
|
||||
`pytest-sourceorder <http://pypi.python.org/pypi/pytest-sourceorder>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-sourceorder-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-sourceorder-latest?py=py34&pytest=2.7.0 `link <https://fedorahosted.org/python-pytest-sourceorder/>`_ Test-ordering plugin for pytest
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-sourceorder-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-sourceorder-latest?py=py34&pytest=2.7.0
|
||||
`pytest-spec <http://pypi.python.org/pypi/pytest-spec>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-spec-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-spec-latest?py=py34&pytest=2.7.0 .. image:: github.png pytest plugin to display test execution output like a SPECIFICATION
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-spec-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-spec-latest?py=py34&pytest=2.7.0 :target: https://github.com/pchomik/pytest-spec
|
||||
`pytest-splinter <http://pypi.python.org/pypi/pytest-splinter>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-splinter-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-splinter-latest?py=py34&pytest=2.7.0 .. image:: github.png Splinter plugin for pytest testing framework
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-splinter-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-splinter-latest?py=py34&pytest=2.7.0 :target: https://github.com/pytest-dev/pytest-splinter
|
||||
`pytest-stepwise <http://pypi.python.org/pypi/pytest-stepwise>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-stepwise-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-stepwise-latest?py=py34&pytest=2.7.0 .. image:: github.png Run a test suite one failing test at a time.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-stepwise-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-stepwise-latest?py=py34&pytest=2.7.0 :target: https://github.com/nip3o/pytest-stepwise
|
||||
`pytest-sugar <http://pypi.python.org/pypi/pytest-sugar>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-sugar-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-sugar-latest?py=py34&pytest=2.7.0 .. image:: github.png py.test is a plugin for py.test that changes the default look and feel of py.test (e.g. progressbar, show tests that fail instantly).
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-sugar-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-sugar-latest?py=py34&pytest=2.7.0 :target: https://github.com/Frozenball/pytest-sugar
|
||||
`pytest-timeout <http://pypi.python.org/pypi/pytest-timeout>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-timeout-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-timeout-latest?py=py34&pytest=2.7.0 .. image:: bitbucket.png py.test plugin to abort hanging tests
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-timeout-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-timeout-latest?py=py34&pytest=2.7.0 :target: http://bitbucket.org/flub/pytest-timeout/
|
||||
`pytest-tornado <http://pypi.python.org/pypi/pytest-tornado>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-tornado-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-tornado-latest?py=py34&pytest=2.7.0 .. image:: github.png A py.test plugin providing fixtures and markers to simplify testing of asynchronous tornado applications.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-tornado-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-tornado-latest?py=py34&pytest=2.7.0 :target: https://github.com/eugeniy/pytest-tornado
|
||||
`pytest-translations <http://pypi.python.org/pypi/pytest-translations>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-translations-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-translations-latest?py=py34&pytest=2.7.0 .. image:: github.png Test your translation files
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-translations-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-translations-latest?py=py34&pytest=2.7.0 :target: https://github.com/thermondo/pytest-translations
|
||||
`pytest-twisted <http://pypi.python.org/pypi/pytest-twisted>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-twisted-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-twisted-latest?py=py34&pytest=2.7.0 .. image:: github.png A twisted plugin for py.test.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-twisted-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-twisted-latest?py=py34&pytest=2.7.0 :target: https://github.com/schmir/pytest-twisted
|
||||
`pytest-unmarked <http://pypi.python.org/pypi/pytest-unmarked>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-unmarked-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-unmarked-latest?py=py34&pytest=2.7.0 .. image:: github.png Run only unmarked tests
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-unmarked-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-unmarked-latest?py=py34&pytest=2.7.0 :target: http://github.com/alyssa.barela/pytest-unmarked
|
||||
`pytest-watch <http://pypi.python.org/pypi/pytest-watch>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-watch-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-watch-latest?py=py34&pytest=2.7.0 .. image:: github.png Local continuous test runner with pytest and watchdog.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-watch-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-watch-latest?py=py34&pytest=2.7.0 :target: http://github.com/joeyespo/pytest-watch
|
||||
`pytest-xdist <http://pypi.python.org/pypi/pytest-xdist>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-xdist-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-xdist-latest?py=py34&pytest=2.7.0 .. image:: bitbucket.png py.test xdist plugin for distributed testing and loop-on-failing modes
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-xdist-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-xdist-latest?py=py34&pytest=2.7.0 :target: http://bitbucket.org/hpk42/pytest-xdist
|
||||
`pytest-xprocess <http://pypi.python.org/pypi/pytest-xprocess>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-xprocess-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-xprocess-latest?py=py34&pytest=2.7.0 .. image:: bitbucket.png pytest plugin to manage external processes across test runs
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-xprocess-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-xprocess-latest?py=py34&pytest=2.7.0 :target: http://bitbucket.org/hpk42/pytest-xprocess/
|
||||
`pytest-yamlwsgi <http://pypi.python.org/pypi/pytest-yamlwsgi>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-yamlwsgi-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-yamlwsgi-latest?py=py34&pytest=2.7.0 ? Run tests against wsgi apps defined in yaml
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-yamlwsgi-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-yamlwsgi-latest?py=py34&pytest=2.7.0
|
||||
`pytest-zap <http://pypi.python.org/pypi/pytest-zap>`_ .. image:: http://plugincompat.herokuapp.com/status/pytest-zap-latest?py=py27&pytest=2.7.0 .. image:: http://plugincompat.herokuapp.com/status/pytest-zap-latest?py=py34&pytest=2.7.0 .. image:: github.png OWASP ZAP plugin for py.test.
|
||||
:target: http://plugincompat.herokuapp.com/output/pytest-zap-latest?py=py27&pytest=2.7.0 :target: http://plugincompat.herokuapp.com/output/pytest-zap-latest?py=py34&pytest=2.7.0 :target: https://github.com/davehunt/pytest-zap
|
||||
|
||||
==================================================================================== ================================================================================================================= ================================================================================================================= =========================================================================== =============================================================================================================================================
|
||||
============================================================================================ ================================================================================================================ ================================================================================================================ =========================================================================== =============================================================================================================================================
|
||||
|
||||
*(Updated on 2014-09-27)*
|
||||
*(Updated on 2015-02-28)*
|
||||
|
||||
@@ -10,7 +10,7 @@ This should be issued before every major documentation release to obtain latest
|
||||
versions from PyPI.
|
||||
|
||||
Also includes plugin compatibility between different python and pytest versions,
|
||||
obtained from http://pytest-plugs.herokuapp.com.
|
||||
obtained from http://plugincompat.herokuapp.com.
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from collections import namedtuple
|
||||
@@ -61,7 +61,7 @@ def get_latest_versions(plugins):
|
||||
yield name, str(loose_version)
|
||||
|
||||
|
||||
def obtain_plugins_table(plugins, client, verbose):
|
||||
def obtain_plugins_table(plugins, client, verbose, pytest_ver):
|
||||
"""
|
||||
Returns information to populate a table of plugins, their versions,
|
||||
authors, etc.
|
||||
@@ -73,7 +73,11 @@ def obtain_plugins_table(plugins, client, verbose):
|
||||
:param plugins: list of (name, version)
|
||||
:param client: ServerProxy
|
||||
:param verbose: print plugin name and version as they are fetch
|
||||
:param pytest_ver: pytest version to use.
|
||||
"""
|
||||
if pytest_ver is None:
|
||||
pytest_ver = pytest.__version__
|
||||
|
||||
def get_repo_markup(repo):
|
||||
"""
|
||||
obtains appropriate markup for the given repository, as two lines
|
||||
@@ -107,9 +111,8 @@ def obtain_plugins_table(plugins, client, verbose):
|
||||
rows = []
|
||||
ColumnData = namedtuple('ColumnData', 'text link')
|
||||
headers = ['Name', 'Py27', 'Py34', 'Home', 'Summary']
|
||||
pytest_version = pytest.__version__
|
||||
repositories = obtain_override_repositories()
|
||||
print('Generating plugins_index page (pytest-{0})'.format(pytest_version))
|
||||
print('Generating plugins_index page (pytest-{0})'.format(pytest_ver))
|
||||
plugins = list(plugins)
|
||||
for index, (package_name, version) in enumerate(plugins):
|
||||
if verbose:
|
||||
@@ -118,7 +121,7 @@ def obtain_plugins_table(plugins, client, verbose):
|
||||
release_data = client.release_data(package_name, version)
|
||||
|
||||
common_params = dict(
|
||||
site='http://pytest-plugs.herokuapp.com',
|
||||
site='http://plugincompat.herokuapp.com',
|
||||
name=package_name,
|
||||
version=version)
|
||||
|
||||
@@ -131,9 +134,9 @@ def obtain_plugins_table(plugins, client, verbose):
|
||||
image_url += '?py={py}&pytest={pytest}'
|
||||
row = (
|
||||
ColumnData(package_name, release_data['package_url']),
|
||||
ColumnData(image_url.format(py='py27', pytest=pytest_version),
|
||||
ColumnData(image_url.format(py='py27', pytest=pytest_ver),
|
||||
None),
|
||||
ColumnData(image_url.format(py='py34', pytest=pytest_version),
|
||||
ColumnData(image_url.format(py='py34', pytest=pytest_ver),
|
||||
None),
|
||||
ColumnData(
|
||||
repo_markup_1,
|
||||
@@ -150,9 +153,9 @@ def obtain_plugins_table(plugins, client, verbose):
|
||||
|
||||
row = (
|
||||
ColumnData('', None),
|
||||
ColumnData(output_url.format(py='py27', pytest=pytest_version),
|
||||
ColumnData(output_url.format(py='py27', pytest=pytest_ver),
|
||||
None),
|
||||
ColumnData(output_url.format(py='py34', pytest=pytest_version),
|
||||
ColumnData(output_url.format(py='py34', pytest=pytest_ver),
|
||||
None),
|
||||
ColumnData(repo_markup_2, None),
|
||||
ColumnData('', None),
|
||||
@@ -184,13 +187,14 @@ def obtain_override_repositories():
|
||||
}
|
||||
|
||||
|
||||
def generate_plugins_index_from_table(filename, headers, rows):
|
||||
def generate_plugins_index_from_table(filename, headers, rows, pytest_ver):
|
||||
"""
|
||||
Generates a RST file with the table data given.
|
||||
|
||||
:param filename: output filename
|
||||
:param headers: see `obtain_plugins_table`
|
||||
:param rows: see `obtain_plugins_table`
|
||||
:param pytest_ver: see `obtain_plugins_table`
|
||||
"""
|
||||
# creates a list of rows, each being a str containing appropriate column
|
||||
# text and link
|
||||
@@ -215,7 +219,7 @@ def generate_plugins_index_from_table(filename, headers, rows):
|
||||
|
||||
with open(filename, 'w') as f:
|
||||
# header
|
||||
header_text = HEADER.format(pytest_version=pytest.__version__)
|
||||
header_text = HEADER.format(pytest_version=pytest_ver)
|
||||
print(header_text, file=f)
|
||||
print(file=f)
|
||||
|
||||
@@ -240,7 +244,7 @@ def generate_plugins_index_from_table(filename, headers, rows):
|
||||
print('*(Updated on %s)*' % today, file=f)
|
||||
|
||||
|
||||
def generate_plugins_index(client, filename, verbose):
|
||||
def generate_plugins_index(client, filename, verbose, pytest_ver):
|
||||
"""
|
||||
Generates an RST file with a table of the latest pytest plugins found in
|
||||
PyPI.
|
||||
@@ -248,10 +252,12 @@ def generate_plugins_index(client, filename, verbose):
|
||||
:param client: ServerProxy
|
||||
:param filename: output filename
|
||||
:param verbose: print name and version of each plugin as they are fetch
|
||||
:param pytest_ver: pytest version to use; if not given, use current pytest
|
||||
version.
|
||||
"""
|
||||
plugins = get_latest_versions(iter_plugins(client))
|
||||
headers, rows = obtain_plugins_table(plugins, client, verbose)
|
||||
generate_plugins_index_from_table(filename, headers, rows)
|
||||
headers, rows = obtain_plugins_table(plugins, client, verbose, pytest_ver)
|
||||
generate_plugins_index_from_table(filename, headers, rows, pytest_ver)
|
||||
|
||||
|
||||
def main(argv):
|
||||
@@ -270,10 +276,12 @@ def main(argv):
|
||||
help='url of PyPI server to obtain data from [default: %default]')
|
||||
parser.add_option('-v', '--verbose', default=False, action='store_true',
|
||||
help='verbose output')
|
||||
parser.add_option('--pytest-ver', default=None, action='store',
|
||||
help='generate index for this pytest version (default current version)')
|
||||
(options, _) = parser.parse_args(argv[1:])
|
||||
|
||||
client = get_proxy(options.url)
|
||||
generate_plugins_index(client, options.filename, options.verbose)
|
||||
generate_plugins_index(client, options.filename, options.verbose, options.pytest_ver)
|
||||
|
||||
print()
|
||||
print('%s updated.' % options.filename)
|
||||
@@ -291,7 +299,7 @@ their status when tested using py.test **{pytest_version}** and python 2.7 and
|
||||
3.3.
|
||||
|
||||
A complete listing can also be found at
|
||||
`pytest-plugs <http://pytest-plugs.herokuapp.com/>`_, which contains tests
|
||||
`plugincompat <http://plugincompat.herokuapp.com/>`_, which contains tests
|
||||
status against other py.test releases.
|
||||
'''
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ Here are some examples of projects using ``pytest`` (please send notes via :ref:
|
||||
`21000 tests <http://buildbot.pypy.org/summary?branch=%3Ctrunk%3E>`_
|
||||
* the `MoinMoin <http://moinmo.in>`_ Wiki Engine
|
||||
* `sentry <https://getsentry.com/welcome/>`_, realtime app-maintenance and exception tracking
|
||||
* `Astropy <http://www.astropy.org/>`_ and `affiliated packages <http://www.astropy.org/affiliated/index.html>`_
|
||||
* `tox <http://testrun.org/tox>`_, virtualenv/Hudson integration tool
|
||||
* `PIDA <http://pida.co.uk>`_ framework for integrated development
|
||||
* `PyPM <http://code.activestate.com/pypm/>`_ ActiveState's package manager
|
||||
@@ -78,6 +79,6 @@ Some organisations using pytest
|
||||
* `Stups department of Heinrich Heine University Duesseldorf <http://www.stups.uni-duesseldorf.de/projects.php>`_
|
||||
* `cellzome <http://www.cellzome.com/>`_
|
||||
* `Open End, Gothenborg <http://www.openend.se>`_
|
||||
* `Laboraratory of Bioinformatics, Warsaw <http://genesilico.pl/>`_
|
||||
* `Laboratory of Bioinformatics, Warsaw <http://genesilico.pl/>`_
|
||||
* `merlinux, Germany <http://merlinux.eu>`_
|
||||
* many more ... (please be so kind to send a note via :ref:`contact`)
|
||||
|
||||
@@ -164,7 +164,8 @@ Running it with the report-on-xfail option gives this output::
|
||||
|
||||
example $ py.test -rx xfail_demo.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /home/hpk/p/pytest/doc/en, inifile: pytest.ini
|
||||
collected 7 items
|
||||
|
||||
xfail_demo.py xxxxxxx
|
||||
@@ -182,7 +183,7 @@ Running it with the report-on-xfail option gives this output::
|
||||
reason: reason
|
||||
XFAIL xfail_demo.py::test_hello7
|
||||
|
||||
======================== 7 xfailed in 0.04 seconds =========================
|
||||
======================== 7 xfailed in 0.05 seconds =========================
|
||||
|
||||
.. _`skip/xfail with parametrize`:
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
pytest development status
|
||||
================================
|
||||
|
||||
https://drone.io/bitbucket.org/hpk42/pytest
|
||||
https://drone.io/bitbucket.org/pytest-dev/pytest
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ Talks and Tutorials
|
||||
Talks and blog postings
|
||||
---------------------------------------------
|
||||
|
||||
.. _`tutorial1 repository`: http://bitbucket.org/hpk42/pytest-tutorial1/
|
||||
.. _`pycon 2010 tutorial PDF`: http://bitbucket.org/hpk42/pytest-tutorial1/raw/tip/pytest-basic.pdf
|
||||
.. _`tutorial1 repository`: http://bitbucket.org/pytest-dev/pytest-tutorial1/
|
||||
.. _`pycon 2010 tutorial PDF`: http://bitbucket.org/pytest-dev/pytest-tutorial1/raw/tip/pytest-basic.pdf
|
||||
|
||||
- `Introduction to pytest, Andreas Pelme, EuroPython 2014
|
||||
<https://www.youtube.com/watch?v=LdVJj65ikRY>`_.
|
||||
|
||||
@@ -159,7 +159,7 @@ command line options
|
||||
|
||||
each: send each test to each available environment.
|
||||
|
||||
load: send each test to available environment.
|
||||
load: send each test to one available environment so it is run only once.
|
||||
|
||||
(default) no: run tests inprocess, don't distribute.
|
||||
``--tx=xspec``
|
||||
|
||||
@@ -29,7 +29,8 @@ Running this would result in a passed test except for the last
|
||||
|
||||
$ py.test test_tmpdir.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-129, inifile:
|
||||
collected 1 items
|
||||
|
||||
test_tmpdir.py F
|
||||
@@ -37,7 +38,7 @@ Running this would result in a passed test except for the last
|
||||
================================= FAILURES =================================
|
||||
_____________________________ test_create_file _____________________________
|
||||
|
||||
tmpdir = local('/tmp/pytest-109/test_create_file0')
|
||||
tmpdir = local('/tmp/pytest-216/test_create_file0')
|
||||
|
||||
def test_create_file(tmpdir):
|
||||
p = tmpdir.mkdir("sub").join("hello.txt")
|
||||
@@ -48,7 +49,7 @@ Running this would result in a passed test except for the last
|
||||
E assert 0
|
||||
|
||||
test_tmpdir.py:7: AssertionError
|
||||
========================= 1 failed in 0.02 seconds =========================
|
||||
========================= 1 failed in 0.01 seconds =========================
|
||||
|
||||
.. _`base temporary directory`:
|
||||
|
||||
|
||||
@@ -88,7 +88,8 @@ the ``self.db`` values in the traceback::
|
||||
|
||||
$ py.test test_unittest_db.py
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.6.4
|
||||
platform linux -- Python 3.4.0 -- py-1.4.26 -- pytest-2.7.0
|
||||
rootdir: /tmp/doc-exec-130, inifile:
|
||||
collected 2 items
|
||||
|
||||
test_unittest_db.py FF
|
||||
@@ -101,7 +102,7 @@ the ``self.db`` values in the traceback::
|
||||
def test_method1(self):
|
||||
assert hasattr(self, "db")
|
||||
> assert 0, self.db # fail for demo purposes
|
||||
E AssertionError: <conftest.db_class.<locals>.DummyDB object at 0x2b98cc5a2e80>
|
||||
E AssertionError: <conftest.db_class.<locals>.DummyDB object at 0x2ab102a4bac8>
|
||||
E assert 0
|
||||
|
||||
test_unittest_db.py:9: AssertionError
|
||||
@@ -111,7 +112,7 @@ the ``self.db`` values in the traceback::
|
||||
|
||||
def test_method2(self):
|
||||
> assert 0, self.db # fail for demo purposes
|
||||
E AssertionError: <conftest.db_class.<locals>.DummyDB object at 0x2b98cc5a2e80>
|
||||
E AssertionError: <conftest.db_class.<locals>.DummyDB object at 0x2ab102a4bac8>
|
||||
E assert 0
|
||||
|
||||
test_unittest_db.py:12: AssertionError
|
||||
@@ -162,7 +163,7 @@ Running this test module ...::
|
||||
|
||||
$ py.test -q test_unittest_cleandir.py
|
||||
.
|
||||
1 passed in 0.05 seconds
|
||||
1 passed in 0.04 seconds
|
||||
|
||||
... gives us one passed test because the ``initdir`` fixture function
|
||||
was executed ahead of the ``test_method``.
|
||||
|
||||
@@ -87,6 +87,17 @@ failure situation::
|
||||
py.test -x --pdb # drop to PDB on first failure, then end test session
|
||||
py.test --pdb --maxfail=3 # drop to PDB for first three failures
|
||||
|
||||
Note that on any failure the exception information is stored on
|
||||
``sys.last_value``, ``sys.last_type`` and ``sys.last_traceback``. In
|
||||
interactive use, this allows one to drop into postmortem debugging with
|
||||
any debug tool. One can also manually access the exception information,
|
||||
for example::
|
||||
|
||||
>> import sys
|
||||
>> sys.last_traceback.tb_lineno
|
||||
42
|
||||
>> sys.last_value
|
||||
AssertionError('assert result == "ok"',)
|
||||
|
||||
Setting a breakpoint / aka ``set_trace()``
|
||||
----------------------------------------------------
|
||||
|
||||
@@ -192,6 +192,6 @@ These directory specifications are relative to the directory
|
||||
where the configuration file was found.
|
||||
|
||||
.. _`pytest-xdist`: http://pypi.python.org/pypi/pytest-xdist
|
||||
.. _`pytest-xdist repository`: http://bitbucket.org/hpk42/pytest-xdist
|
||||
.. _`pytest-xdist repository`: http://bitbucket.org/pytest-dev/pytest-xdist
|
||||
.. _`pytest`: http://pytest.org
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ Let's run it with output capturing disabled::
|
||||
test called
|
||||
.teardown after yield
|
||||
|
||||
1 passed in 0.01 seconds
|
||||
1 passed in 0.00 seconds
|
||||
|
||||
We can also seamlessly use the new syntax with ``with`` statements.
|
||||
Let's simplify the above ``passwd`` fixture::
|
||||
|
||||
@@ -2,7 +2,7 @@ import json
|
||||
import py
|
||||
import textwrap
|
||||
|
||||
issues_url = "http://bitbucket.org/api/1.0/repositories/hpk42/pytest/issues"
|
||||
issues_url = "http://bitbucket.org/api/1.0/repositories/pytest-dev/pytest/issues"
|
||||
|
||||
import requests
|
||||
|
||||
@@ -11,7 +11,7 @@ def get_issues():
|
||||
start = 0
|
||||
issues = []
|
||||
while 1:
|
||||
post_data = {"accountname": "hpk42",
|
||||
post_data = {"accountname": "pytest-dev",
|
||||
"repo_slug": "pytest",
|
||||
"start": start,
|
||||
"limit": chunksize}
|
||||
@@ -53,7 +53,7 @@ def report(issues):
|
||||
kind = metadata["kind"]
|
||||
status = issue["status"]
|
||||
id = issue["local_id"]
|
||||
link = "https://bitbucket.org/hpk42/pytest/issue/%s/" % id
|
||||
link = "https://bitbucket.org/pytest-dev/pytest/issue/%s/" % id
|
||||
print("----")
|
||||
print(status, kind, link)
|
||||
print(title)
|
||||
|
||||
11
extra/setup-py.test/setup.py
Normal file
11
extra/setup-py.test/setup.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import sys
|
||||
from distutils.core import setup
|
||||
|
||||
if __name__ == "__main__":
|
||||
if "sdist" not in sys.argv[1:]:
|
||||
raise ValueError("please use 'pytest' pypi package instead of 'py.test'")
|
||||
setup(
|
||||
name="py.test",
|
||||
version="0.0",
|
||||
description="please use 'pytest' for installation",
|
||||
)
|
||||
2
requirements-docs.txt
Normal file
2
requirements-docs.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
sphinx==1.2.3
|
||||
hg+ssh://hg@bitbucket.org/RonnyPfannschmidt/regendoc#egg=regendoc
|
||||
5
setup.py
5
setup.py
@@ -13,7 +13,8 @@ classifiers = ['Development Status :: 6 - Mature',
|
||||
('Programming Language :: Python :: %s' % x) for x in
|
||||
'2 2.6 2.7 3 3.2 3.3 3.4'.split()]
|
||||
|
||||
long_description = open('README.rst').read()
|
||||
with open('README.rst') as fd:
|
||||
long_description = fd.read()
|
||||
|
||||
|
||||
def main():
|
||||
@@ -27,7 +28,7 @@ def main():
|
||||
name='pytest',
|
||||
description='pytest: simple powerful testing with Python',
|
||||
long_description=long_description,
|
||||
version='2.6.4',
|
||||
version='2.7.0',
|
||||
url='http://pytest.org',
|
||||
license='MIT license',
|
||||
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
|
||||
|
||||
@@ -393,14 +393,31 @@ class TestFunction:
|
||||
return 'value'
|
||||
|
||||
@pytest.mark.parametrize('value',
|
||||
['overrided'])
|
||||
def test_overrided_via_param(value):
|
||||
assert value == 'overrided'
|
||||
['overridden'])
|
||||
def test_overridden_via_param(value):
|
||||
assert value == 'overridden'
|
||||
""")
|
||||
rec = testdir.inline_run()
|
||||
rec.assertoutcome(passed=1)
|
||||
|
||||
|
||||
def test_parametrize_overrides_parametrized_fixture(self, testdir):
|
||||
"""Test parametrization when parameter overrides existing parametrized fixture with same name."""
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
||||
@pytest.fixture(params=[1, 2])
|
||||
def value(request):
|
||||
return request.param
|
||||
|
||||
@pytest.mark.parametrize('value',
|
||||
['overridden'])
|
||||
def test_overridden_via_param(value):
|
||||
assert value == 'overridden'
|
||||
""")
|
||||
rec = testdir.inline_run()
|
||||
rec.assertoutcome(passed=1)
|
||||
|
||||
def test_parametrize_with_mark(selfself, testdir):
|
||||
items = testdir.getitems("""
|
||||
import pytest
|
||||
@@ -525,12 +542,15 @@ class TestConftestCustomization:
|
||||
def test_customized_pymakeitem(self, testdir):
|
||||
b = testdir.mkdir("a").mkdir("b")
|
||||
b.join("conftest.py").write(py.code.Source("""
|
||||
def pytest_pycollect_makeitem(__multicall__):
|
||||
result = __multicall__.execute()
|
||||
if result:
|
||||
for func in result:
|
||||
func._some123 = "world"
|
||||
return result
|
||||
import pytest
|
||||
@pytest.mark.hookwrapper
|
||||
def pytest_pycollect_makeitem():
|
||||
outcome = yield
|
||||
if outcome.excinfo is None:
|
||||
result = outcome.result
|
||||
if result:
|
||||
for func in result:
|
||||
func._some123 = "world"
|
||||
"""))
|
||||
b.join("test_module.py").write(py.code.Source("""
|
||||
import pytest
|
||||
|
||||
@@ -226,6 +226,114 @@ class TestFillFixtures:
|
||||
result = testdir.runpytest()
|
||||
assert result.ret == 0
|
||||
|
||||
def test_override_parametrized_fixture_conftest_module(self, testdir):
|
||||
"""Test override of the parametrized fixture with non-parametrized one on the test module level."""
|
||||
testdir.makeconftest("""
|
||||
import pytest
|
||||
|
||||
@pytest.fixture(params=[1, 2, 3])
|
||||
def spam(request):
|
||||
return request.param
|
||||
""")
|
||||
testfile = testdir.makepyfile("""
|
||||
import pytest
|
||||
|
||||
@pytest.fixture
|
||||
def spam():
|
||||
return 'spam'
|
||||
|
||||
def test_spam(spam):
|
||||
assert spam == 'spam'
|
||||
""")
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines(["*1 passed*"])
|
||||
result = testdir.runpytest(testfile)
|
||||
result.stdout.fnmatch_lines(["*1 passed*"])
|
||||
|
||||
def test_override_parametrized_fixture_conftest_conftest(self, testdir):
|
||||
"""Test override of the parametrized fixture with non-parametrized one on the conftest level."""
|
||||
testdir.makeconftest("""
|
||||
import pytest
|
||||
|
||||
@pytest.fixture(params=[1, 2, 3])
|
||||
def spam(request):
|
||||
return request.param
|
||||
""")
|
||||
subdir = testdir.mkpydir('subdir')
|
||||
subdir.join("conftest.py").write(py.code.Source("""
|
||||
import pytest
|
||||
|
||||
@pytest.fixture
|
||||
def spam():
|
||||
return 'spam'
|
||||
"""))
|
||||
testfile = subdir.join("test_spam.py")
|
||||
testfile.write(py.code.Source("""
|
||||
def test_spam(spam):
|
||||
assert spam == "spam"
|
||||
"""))
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines(["*1 passed*"])
|
||||
result = testdir.runpytest(testfile)
|
||||
result.stdout.fnmatch_lines(["*1 passed*"])
|
||||
|
||||
def test_override_non_parametrized_fixture_conftest_module(self, testdir):
|
||||
"""Test override of the non-parametrized fixture with parametrized one on the test module level."""
|
||||
testdir.makeconftest("""
|
||||
import pytest
|
||||
|
||||
@pytest.fixture
|
||||
def spam():
|
||||
return 'spam'
|
||||
""")
|
||||
testfile = testdir.makepyfile("""
|
||||
import pytest
|
||||
|
||||
@pytest.fixture(params=[1, 2, 3])
|
||||
def spam(request):
|
||||
return request.param
|
||||
|
||||
params = {'spam': 1}
|
||||
|
||||
def test_spam(spam):
|
||||
assert spam == params['spam']
|
||||
params['spam'] += 1
|
||||
""")
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines(["*3 passed*"])
|
||||
result = testdir.runpytest(testfile)
|
||||
result.stdout.fnmatch_lines(["*3 passed*"])
|
||||
|
||||
def test_override_non_parametrized_fixture_conftest_conftest(self, testdir):
|
||||
"""Test override of the non-parametrized fixture with parametrized one on the conftest level."""
|
||||
testdir.makeconftest("""
|
||||
import pytest
|
||||
|
||||
@pytest.fixture
|
||||
def spam():
|
||||
return 'spam'
|
||||
""")
|
||||
subdir = testdir.mkpydir('subdir')
|
||||
subdir.join("conftest.py").write(py.code.Source("""
|
||||
import pytest
|
||||
|
||||
@pytest.fixture(params=[1, 2, 3])
|
||||
def spam(request):
|
||||
return request.param
|
||||
"""))
|
||||
testfile = subdir.join("test_spam.py")
|
||||
testfile.write(py.code.Source("""
|
||||
params = {'spam': 1}
|
||||
|
||||
def test_spam(spam):
|
||||
assert spam == params['spam']
|
||||
params['spam'] += 1
|
||||
"""))
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines(["*3 passed*"])
|
||||
result = testdir.runpytest(testfile)
|
||||
result.stdout.fnmatch_lines(["*3 passed*"])
|
||||
|
||||
def test_autouse_fixture_plugin(self, testdir):
|
||||
# A fixture from a plugin has no baseid set, which screwed up
|
||||
# the autouse fixture handling.
|
||||
@@ -261,6 +369,29 @@ class TestFillFixtures:
|
||||
])
|
||||
assert "INTERNAL" not in result.stdout.str()
|
||||
|
||||
def test_fixture_excinfo_leak(self, testdir):
|
||||
# on python2 sys.excinfo would leak into fixture executions
|
||||
testdir.makepyfile("""
|
||||
import sys
|
||||
import traceback
|
||||
import pytest
|
||||
|
||||
@pytest.fixture
|
||||
def leak():
|
||||
if sys.exc_info()[0]: # python3 bug :)
|
||||
traceback.print_exc()
|
||||
#fails
|
||||
assert sys.exc_info() == (None, None, None)
|
||||
|
||||
def test_leak(leak):
|
||||
if sys.exc_info()[0]: # python3 bug :)
|
||||
traceback.print_exc()
|
||||
assert sys.exc_info() == (None, None, None)
|
||||
""")
|
||||
result = testdir.runpytest()
|
||||
assert result.ret == 0
|
||||
|
||||
|
||||
class TestRequestBasic:
|
||||
def test_request_attributes(self, testdir):
|
||||
item = testdir.getitem("""
|
||||
@@ -477,7 +608,7 @@ class TestRequestBasic:
|
||||
reprec.assertoutcome(passed=3)
|
||||
|
||||
def test_fixtures_sub_subdir_normalize_sep(self, testdir):
|
||||
# this tests that normlization of nodeids takes place
|
||||
# this tests that normalization of nodeids takes place
|
||||
b = testdir.mkdir("tests").mkdir("unit")
|
||||
b.join("conftest.py").write(py.code.Source("""
|
||||
def pytest_funcarg__arg1():
|
||||
@@ -2300,6 +2431,35 @@ class TestShowFixtures:
|
||||
*hello world*
|
||||
""")
|
||||
|
||||
def test_show_fixtures_trimmed_doc(self, testdir):
|
||||
p = testdir.makepyfile('''
|
||||
import pytest
|
||||
@pytest.fixture
|
||||
def arg1():
|
||||
"""
|
||||
line1
|
||||
line2
|
||||
|
||||
"""
|
||||
@pytest.fixture
|
||||
def arg2():
|
||||
"""
|
||||
line1
|
||||
line2
|
||||
|
||||
"""
|
||||
''')
|
||||
result = testdir.runpytest("--fixtures", p)
|
||||
result.stdout.fnmatch_lines("""
|
||||
* fixtures defined from test_show_fixtures_trimmed_doc *
|
||||
arg2
|
||||
line1
|
||||
line2
|
||||
arg1
|
||||
line1
|
||||
line2
|
||||
|
||||
""")
|
||||
|
||||
|
||||
class TestContextManagerFixtureFuncs:
|
||||
|
||||
@@ -282,5 +282,58 @@ class TestNoselikeTestAttribute:
|
||||
call = reprec.getcalls("pytest_collection_modifyitems")[0]
|
||||
assert len(call.items) == 1
|
||||
assert call.items[0].cls.__name__ == "TC"
|
||||
|
||||
|
||||
|
||||
@pytest.mark.issue351
|
||||
class TestParameterize:
|
||||
|
||||
def test_idfn_marker(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
||||
def idfn(param):
|
||||
if param == 0:
|
||||
return 'spam'
|
||||
elif param == 1:
|
||||
return 'ham'
|
||||
else:
|
||||
return None
|
||||
|
||||
@pytest.mark.parametrize('a,b', [(0, 2), (1, 2)], ids=idfn)
|
||||
def test_params(a, b):
|
||||
pass
|
||||
""")
|
||||
res = testdir.runpytest('--collect-only')
|
||||
res.stdout.fnmatch_lines([
|
||||
"*spam-2*",
|
||||
"*ham-2*",
|
||||
])
|
||||
|
||||
def test_idfn_fixture(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
||||
def idfn(param):
|
||||
if param == 0:
|
||||
return 'spam'
|
||||
elif param == 1:
|
||||
return 'ham'
|
||||
else:
|
||||
return None
|
||||
|
||||
@pytest.fixture(params=[0, 1], ids=idfn)
|
||||
def a(request):
|
||||
return request.param
|
||||
|
||||
@pytest.fixture(params=[1, 2], ids=idfn)
|
||||
def b(request):
|
||||
return request.param
|
||||
|
||||
def test_params(a, b):
|
||||
pass
|
||||
""")
|
||||
res = testdir.runpytest('--collect-only')
|
||||
res.stdout.fnmatch_lines([
|
||||
"*spam-2*",
|
||||
"*ham-2*",
|
||||
])
|
||||
|
||||
@@ -151,6 +151,52 @@ class TestMetafunc:
|
||||
"a6-b6",
|
||||
"a7-b7"]
|
||||
|
||||
@pytest.mark.issue351
|
||||
def test_idmaker_idfn(self):
|
||||
from _pytest.python import idmaker
|
||||
def ids(val):
|
||||
if isinstance(val, Exception):
|
||||
return repr(val)
|
||||
|
||||
result = idmaker(("a", "b"), [(10.0, IndexError()),
|
||||
(20, KeyError()),
|
||||
("three", [1, 2, 3]),
|
||||
], idfn=ids)
|
||||
assert result == ["10.0-IndexError()",
|
||||
"20-KeyError()",
|
||||
"three-b2",
|
||||
]
|
||||
|
||||
@pytest.mark.issue351
|
||||
def test_idmaker_idfn_unique_names(self):
|
||||
from _pytest.python import idmaker
|
||||
def ids(val):
|
||||
return 'a'
|
||||
|
||||
result = idmaker(("a", "b"), [(10.0, IndexError()),
|
||||
(20, KeyError()),
|
||||
("three", [1, 2, 3]),
|
||||
], idfn=ids)
|
||||
assert result == ["0a-a",
|
||||
"1a-a",
|
||||
"2a-a",
|
||||
]
|
||||
|
||||
@pytest.mark.issue351
|
||||
def test_idmaker_idfn_exception(self):
|
||||
from _pytest.python import idmaker
|
||||
def ids(val):
|
||||
raise Exception("bad code")
|
||||
|
||||
result = idmaker(("a", "b"), [(10.0, IndexError()),
|
||||
(20, KeyError()),
|
||||
("three", [1, 2, 3]),
|
||||
], idfn=ids)
|
||||
assert result == ["10.0-b0",
|
||||
"20-b1",
|
||||
"three-b2",
|
||||
]
|
||||
|
||||
def test_addcall_and_parametrize(self):
|
||||
def func(x, y): pass
|
||||
metafunc = self.Metafunc(func)
|
||||
@@ -646,6 +692,21 @@ class TestMetafuncFunctional:
|
||||
reprec = testdir.inline_run()
|
||||
reprec.assertoutcome(passed=4)
|
||||
|
||||
@pytest.mark.issue463
|
||||
def test_parameterize_misspelling(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
||||
@pytest.mark.parameterize("x", range(2))
|
||||
def test_foo(x):
|
||||
pass
|
||||
""")
|
||||
reprec = testdir.inline_run('--collectonly')
|
||||
failures = reprec.getfailures()
|
||||
assert len(failures) == 1
|
||||
expectederror = "MarkerError: test_foo has 'parameterize', spelling should be 'parametrize'"
|
||||
assert expectederror in failures[0].longrepr.reprcrash.message
|
||||
|
||||
|
||||
class TestMarkersWithParametrization:
|
||||
pytestmark = pytest.mark.issue308
|
||||
|
||||
@@ -270,6 +270,14 @@ class TestAssertionRewrite:
|
||||
assert not 5 % 4
|
||||
assert getmsg(f) == "assert not (5 % 4)"
|
||||
|
||||
def test_boolop_percent(self):
|
||||
def f():
|
||||
assert 3 % 2 and False
|
||||
assert getmsg(f) == "assert ((3 % 2) and False)"
|
||||
def f():
|
||||
assert False or 4 % 2
|
||||
assert getmsg(f) == "assert (False or (4 % 2))"
|
||||
|
||||
def test_call(self):
|
||||
def g(a=42, *args, **kwargs):
|
||||
return False
|
||||
@@ -633,3 +641,27 @@ class TestAssertionRewriteHookDetails(object):
|
||||
pyc.write(contents[:strip_bytes], mode='wb')
|
||||
|
||||
assert _read_pyc(source, str(pyc)) is None # no error
|
||||
|
||||
def test_reload_is_same(self, testdir):
|
||||
# A file that will be picked up during collecting.
|
||||
testdir.tmpdir.join("file.py").ensure()
|
||||
testdir.tmpdir.join("pytest.ini").write(py.std.textwrap.dedent("""
|
||||
[pytest]
|
||||
python_files = *.py
|
||||
"""))
|
||||
|
||||
testdir.makepyfile(test_fun="""
|
||||
import sys
|
||||
try:
|
||||
from imp import reload
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
def test_loader():
|
||||
import file
|
||||
assert sys.modules["file"] is reload(file)
|
||||
""")
|
||||
result = testdir.runpytest('-s')
|
||||
result.stdout.fnmatch_lines([
|
||||
"* 1 passed*",
|
||||
])
|
||||
|
||||
@@ -1040,7 +1040,7 @@ def test_dontreadfrominput_has_encoding(testdir):
|
||||
|
||||
|
||||
def test_pickling_and_unpickling_enocded_file():
|
||||
# See https://bitbucket.org/hpk42/pytest/pull-request/194
|
||||
# See https://bitbucket.org/pytest-dev/pytest/pull-request/194
|
||||
# pickle.loads() raises infinite recursion if
|
||||
# EncodedFile.__getattr__ is not implemented properly
|
||||
ef = capture.EncodedFile(None, None)
|
||||
|
||||
@@ -334,16 +334,16 @@ class TestSession:
|
||||
assert item.name == "test_func"
|
||||
newid = item.nodeid
|
||||
assert newid == id
|
||||
py.std.pprint.pprint(hookrec.hookrecorder.calls)
|
||||
py.std.pprint.pprint(hookrec.calls)
|
||||
topdir = testdir.tmpdir # noqa
|
||||
hookrec.hookrecorder.contains([
|
||||
hookrec.assert_contains([
|
||||
("pytest_collectstart", "collector.fspath == topdir"),
|
||||
("pytest_make_collect_report", "collector.fspath == topdir"),
|
||||
("pytest_collectstart", "collector.fspath == p"),
|
||||
("pytest_make_collect_report", "collector.fspath == p"),
|
||||
("pytest_pycollect_makeitem", "name == 'test_func'"),
|
||||
("pytest_collectreport", "report.nodeid.startswith(p.basename)"),
|
||||
("pytest_collectreport", "report.nodeid == '.'")
|
||||
("pytest_collectreport", "report.nodeid == ''")
|
||||
])
|
||||
|
||||
def test_collect_protocol_method(self, testdir):
|
||||
@@ -381,9 +381,9 @@ class TestSession:
|
||||
id = p.basename
|
||||
|
||||
items, hookrec = testdir.inline_genitems(id)
|
||||
py.std.pprint.pprint(hookrec.hookrecorder.calls)
|
||||
py.std.pprint.pprint(hookrec.calls)
|
||||
assert len(items) == 2
|
||||
hookrec.hookrecorder.contains([
|
||||
hookrec.assert_contains([
|
||||
("pytest_collectstart",
|
||||
"collector.fspath == collector.session.fspath"),
|
||||
("pytest_collectstart",
|
||||
@@ -404,8 +404,8 @@ class TestSession:
|
||||
|
||||
items, hookrec = testdir.inline_genitems()
|
||||
assert len(items) == 1
|
||||
py.std.pprint.pprint(hookrec.hookrecorder.calls)
|
||||
hookrec.hookrecorder.contains([
|
||||
py.std.pprint.pprint(hookrec.calls)
|
||||
hookrec.assert_contains([
|
||||
("pytest_collectstart", "collector.fspath == test_aaa"),
|
||||
("pytest_pycollect_makeitem", "name == 'test_func'"),
|
||||
("pytest_collectreport",
|
||||
@@ -425,8 +425,8 @@ class TestSession:
|
||||
|
||||
items, hookrec = testdir.inline_genitems(id)
|
||||
assert len(items) == 2
|
||||
py.std.pprint.pprint(hookrec.hookrecorder.calls)
|
||||
hookrec.hookrecorder.contains([
|
||||
py.std.pprint.pprint(hookrec.calls)
|
||||
hookrec.assert_contains([
|
||||
("pytest_collectstart", "collector.fspath == test_aaa"),
|
||||
("pytest_pycollect_makeitem", "name == 'test_func'"),
|
||||
("pytest_collectreport", "report.nodeid == 'aaa/test_aaa.py'"),
|
||||
@@ -478,7 +478,7 @@ class Test_getinitialnodes:
|
||||
config = testdir.parseconfigure(x)
|
||||
col = testdir.getnode(config, x)
|
||||
assert isinstance(col, pytest.Module)
|
||||
assert col.name == 'subdir/x.py'
|
||||
assert col.name == 'x.py'
|
||||
assert col.parent.parent is None
|
||||
for col in col.listchain():
|
||||
assert col.config is config
|
||||
@@ -528,6 +528,30 @@ class Test_genitems:
|
||||
assert s.endswith("test_example_items1.testone")
|
||||
print(s)
|
||||
|
||||
def test_class_and_functions_discovery_using_glob(self, testdir):
|
||||
"""
|
||||
tests that python_classes and python_functions config options work
|
||||
as prefixes and glob-like patterns (issue #600).
|
||||
"""
|
||||
testdir.makeini("""
|
||||
[pytest]
|
||||
python_classes = *Suite Test
|
||||
python_functions = *_test test
|
||||
""")
|
||||
p = testdir.makepyfile('''
|
||||
class MyTestSuite:
|
||||
def x_test(self):
|
||||
pass
|
||||
|
||||
class TestCase:
|
||||
def test_y(self):
|
||||
pass
|
||||
''')
|
||||
items, reprec = testdir.inline_genitems(p)
|
||||
ids = [x.getmodpath() for x in items]
|
||||
assert ids == ['MyTestSuite.x_test', 'TestCase.test_y']
|
||||
|
||||
|
||||
def test_matchnodes_two_collections_same_file(testdir):
|
||||
testdir.makeconftest("""
|
||||
import pytest
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import py, pytest
|
||||
|
||||
from _pytest.config import getcfg
|
||||
from _pytest.config import getcfg, get_common_ancestor, determine_setup
|
||||
|
||||
class TestParseIni:
|
||||
def test_getcfg_and_config(self, testdir, tmpdir):
|
||||
@@ -10,7 +10,7 @@ class TestParseIni:
|
||||
[pytest]
|
||||
name = value
|
||||
"""))
|
||||
cfg = getcfg([sub], ["setup.cfg"])
|
||||
rootdir, inifile, cfg = getcfg([sub], ["setup.cfg"])
|
||||
assert cfg['name'] == "value"
|
||||
config = testdir.parseconfigure(sub)
|
||||
assert config.inicfg['name'] == 'value'
|
||||
@@ -18,12 +18,16 @@ class TestParseIni:
|
||||
def test_getcfg_empty_path(self, tmpdir):
|
||||
getcfg([''], ['setup.cfg']) #happens on py.test ""
|
||||
|
||||
def test_append_parse_args(self, testdir, tmpdir):
|
||||
def test_append_parse_args(self, testdir, tmpdir, monkeypatch):
|
||||
monkeypatch.setenv('PYTEST_ADDOPTS', '--color no -rs --tb="short"')
|
||||
tmpdir.join("setup.cfg").write(py.code.Source("""
|
||||
[pytest]
|
||||
addopts = --verbose
|
||||
"""))
|
||||
config = testdir.parseconfig(tmpdir)
|
||||
assert config.option.color == 'no'
|
||||
assert config.option.reportchars == 's'
|
||||
assert config.option.tbstyle == 'short'
|
||||
assert config.option.verbose
|
||||
#config = testdir.Config()
|
||||
#args = [tmpdir,]
|
||||
@@ -396,3 +400,55 @@ class TestWarning:
|
||||
*WT1*test_warn_on_test_item*:5*hello*
|
||||
*1 warning*
|
||||
""")
|
||||
|
||||
class TestRootdir:
|
||||
def test_simple_noini(self, tmpdir):
|
||||
assert get_common_ancestor([tmpdir]) == tmpdir
|
||||
assert get_common_ancestor([tmpdir.mkdir("a"), tmpdir]) == tmpdir
|
||||
assert get_common_ancestor([tmpdir, tmpdir.join("a")]) == tmpdir
|
||||
with tmpdir.as_cwd():
|
||||
assert get_common_ancestor([]) == tmpdir
|
||||
|
||||
@pytest.mark.parametrize("name", "setup.cfg tox.ini pytest.ini".split())
|
||||
def test_with_ini(self, tmpdir, name):
|
||||
inifile = tmpdir.join(name)
|
||||
inifile.write("[pytest]\n")
|
||||
|
||||
a = tmpdir.mkdir("a")
|
||||
b = a.mkdir("b")
|
||||
for args in ([tmpdir], [a], [b]):
|
||||
rootdir, inifile, inicfg = determine_setup(None, args)
|
||||
assert rootdir == tmpdir
|
||||
assert inifile == inifile
|
||||
rootdir, inifile, inicfg = determine_setup(None, [b,a])
|
||||
assert rootdir == tmpdir
|
||||
assert inifile == inifile
|
||||
|
||||
@pytest.mark.parametrize("name", "setup.cfg tox.ini".split())
|
||||
def test_pytestini_overides_empty_other(self, tmpdir, name):
|
||||
inifile = tmpdir.ensure("pytest.ini")
|
||||
a = tmpdir.mkdir("a")
|
||||
a.ensure(name)
|
||||
rootdir, inifile, inicfg = determine_setup(None, [a])
|
||||
assert rootdir == tmpdir
|
||||
assert inifile == inifile
|
||||
|
||||
def test_setuppy_fallback(self, tmpdir):
|
||||
a = tmpdir.mkdir("a")
|
||||
a.ensure("setup.cfg")
|
||||
tmpdir.ensure("setup.py")
|
||||
rootdir, inifile, inicfg = determine_setup(None, [a])
|
||||
assert rootdir == tmpdir
|
||||
assert inifile is None
|
||||
assert inicfg == {}
|
||||
|
||||
def test_nothing(self, tmpdir):
|
||||
rootdir, inifile, inicfg = determine_setup(None, [tmpdir])
|
||||
assert rootdir == tmpdir
|
||||
assert inifile is None
|
||||
assert inicfg == {}
|
||||
|
||||
def test_with_specific_inifile(self, tmpdir):
|
||||
inifile = tmpdir.ensure("pytest.ini")
|
||||
rootdir, inifile, inicfg = determine_setup(inifile, [tmpdir])
|
||||
assert rootdir == tmpdir
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
from textwrap import dedent
|
||||
import py, pytest
|
||||
from _pytest.config import Conftest
|
||||
|
||||
|
||||
|
||||
@pytest.fixture(scope="module", params=["global", "inpackage"])
|
||||
def basedir(request):
|
||||
from _pytest.tmpdir import tmpdir
|
||||
@@ -255,3 +257,93 @@ def test_conftest_found_with_double_dash(testdir):
|
||||
result.stdout.fnmatch_lines("""
|
||||
*--hello-world*
|
||||
""")
|
||||
|
||||
|
||||
class TestConftestVisibility:
|
||||
def _setup_tree(self, testdir): # for issue616
|
||||
# example mostly taken from:
|
||||
# https://mail.python.org/pipermail/pytest-dev/2014-September/002617.html
|
||||
runner = testdir.mkdir("empty")
|
||||
package = testdir.mkdir("package")
|
||||
|
||||
package.join("conftest.py").write(dedent("""\
|
||||
import pytest
|
||||
@pytest.fixture
|
||||
def fxtr():
|
||||
return "from-package"
|
||||
"""))
|
||||
package.join("test_pkgroot.py").write(dedent("""\
|
||||
def test_pkgroot(fxtr):
|
||||
assert fxtr == "from-package"
|
||||
"""))
|
||||
|
||||
swc = package.mkdir("swc")
|
||||
swc.join("__init__.py").ensure()
|
||||
swc.join("conftest.py").write(dedent("""\
|
||||
import pytest
|
||||
@pytest.fixture
|
||||
def fxtr():
|
||||
return "from-swc"
|
||||
"""))
|
||||
swc.join("test_with_conftest.py").write(dedent("""\
|
||||
def test_with_conftest(fxtr):
|
||||
assert fxtr == "from-swc"
|
||||
|
||||
"""))
|
||||
|
||||
snc = package.mkdir("snc")
|
||||
snc.join("__init__.py").ensure()
|
||||
snc.join("test_no_conftest.py").write(dedent("""\
|
||||
def test_no_conftest(fxtr):
|
||||
assert fxtr == "from-package" # No local conftest.py, so should
|
||||
# use value from parent dir's
|
||||
|
||||
"""))
|
||||
print ("created directory structure:")
|
||||
for x in testdir.tmpdir.visit():
|
||||
print (" " + x.relto(testdir.tmpdir))
|
||||
|
||||
return {
|
||||
"runner": runner,
|
||||
"package": package,
|
||||
"swc": swc,
|
||||
"snc": snc}
|
||||
|
||||
# N.B.: "swc" stands for "subdir with conftest.py"
|
||||
# "snc" stands for "subdir no [i.e. without] conftest.py"
|
||||
@pytest.mark.parametrize("chdir,testarg,expect_ntests_passed", [
|
||||
# Effective target: package/..
|
||||
("runner", "..", 3),
|
||||
("package", "..", 3),
|
||||
("swc", "../..", 3),
|
||||
("snc", "../..", 3),
|
||||
|
||||
# Effective target: package
|
||||
("runner", "../package", 3),
|
||||
("package", ".", 3),
|
||||
("swc", "..", 3),
|
||||
("snc", "..", 3),
|
||||
|
||||
# Effective target: package/swc
|
||||
("runner", "../package/swc", 1),
|
||||
("package", "./swc", 1),
|
||||
("swc", ".", 1),
|
||||
("snc", "../swc", 1),
|
||||
|
||||
# Effective target: package/snc
|
||||
("runner", "../package/snc", 1),
|
||||
("package", "./snc", 1),
|
||||
("swc", "../snc", 1),
|
||||
("snc", ".", 1),
|
||||
])
|
||||
@pytest.mark.issue616
|
||||
def test_parsefactories_relative_node_ids(
|
||||
self, testdir, chdir,testarg, expect_ntests_passed):
|
||||
dirs = self._setup_tree(testdir)
|
||||
print("pytest run in cwd: %s" %(
|
||||
dirs[chdir].relto(testdir.tmpdir)))
|
||||
print("pytestarg : %s" %(testarg))
|
||||
print("expected pass : %s" %(expect_ntests_passed))
|
||||
with dirs[chdir].as_cwd():
|
||||
reprec = testdir.inline_run(testarg, "-q", "--traceconfig")
|
||||
reprec.assertoutcome(passed=expect_ntests_passed)
|
||||
|
||||
@@ -149,7 +149,7 @@ class TestBootstrapping:
|
||||
mod.pytest_plugins = "pytest_a"
|
||||
aplugin = testdir.makepyfile(pytest_a="#")
|
||||
pluginmanager = get_plugin_manager()
|
||||
reprec = testdir.getreportrecorder(pluginmanager)
|
||||
reprec = testdir.make_hook_recorder(pluginmanager)
|
||||
#syspath.prepend(aplugin.dirpath())
|
||||
py.std.sys.path.insert(0, str(aplugin.dirpath()))
|
||||
pluginmanager.consider_module(mod)
|
||||
@@ -184,8 +184,6 @@ class TestBootstrapping:
|
||||
assert pp.getplugin('hello') == a2
|
||||
pp.unregister(a1)
|
||||
assert not pp.isregistered(a1)
|
||||
pp.unregister(name="hello")
|
||||
assert not pp.isregistered(a2)
|
||||
|
||||
def test_pm_ordering(self):
|
||||
pp = PluginManager()
|
||||
@@ -274,14 +272,15 @@ class TestBootstrapping:
|
||||
saveindent.append(pm.trace.root.indent)
|
||||
raise ValueError(42)
|
||||
l = []
|
||||
pm.trace.root.setwriter(l.append)
|
||||
pm.set_tracing(l.append)
|
||||
indent = pm.trace.root.indent
|
||||
p = api1()
|
||||
pm.register(p)
|
||||
|
||||
assert pm.trace.root.indent == indent
|
||||
assert len(l) == 1
|
||||
assert len(l) == 2
|
||||
assert 'pytest_plugin_registered' in l[0]
|
||||
assert 'finish' in l[1]
|
||||
pytest.raises(ValueError, lambda: pm.register(api1()))
|
||||
assert pm.trace.root.indent == indent
|
||||
assert saveindent[0] > indent
|
||||
@@ -405,11 +404,7 @@ class TestPytestPluginInteractions:
|
||||
pluginmanager.register(p3)
|
||||
methods = pluginmanager.listattr('m')
|
||||
assert methods == [p2.m, p3.m, p1.m]
|
||||
# listattr keeps a cache and deleting
|
||||
# a function attribute requires clearing it
|
||||
pluginmanager._listattrcache.clear()
|
||||
del P1.m.__dict__['tryfirst']
|
||||
|
||||
pytest.mark.trylast(getattr(P2.m, 'im_func', P2.m))
|
||||
methods = pluginmanager.listattr('m')
|
||||
assert methods == [p2.m, p1.m, p3.m]
|
||||
@@ -436,6 +431,11 @@ def test_varnames():
|
||||
assert varnames(A().f) == ('y',)
|
||||
assert varnames(B()) == ('z',)
|
||||
|
||||
def test_varnames_default():
|
||||
def f(x, y=3):
|
||||
pass
|
||||
assert varnames(f) == ("x",)
|
||||
|
||||
def test_varnames_class():
|
||||
class C:
|
||||
def __init__(self, x):
|
||||
@@ -494,12 +494,10 @@ class TestMultiCall:
|
||||
return x + z
|
||||
reslist = MultiCall([f], dict(x=23, y=24)).execute()
|
||||
assert reslist == [24]
|
||||
reslist = MultiCall([f], dict(x=23, z=2)).execute()
|
||||
assert reslist == [25]
|
||||
|
||||
def test_tags_call_error(self):
|
||||
multicall = MultiCall([lambda x: x], {})
|
||||
pytest.raises(TypeError, multicall.execute)
|
||||
pytest.raises(KeyError, multicall.execute)
|
||||
|
||||
def test_call_subexecute(self):
|
||||
def m(__multicall__):
|
||||
@@ -556,7 +554,7 @@ class TestMultiCall:
|
||||
l.append("m2 finish")
|
||||
m2.hookwrapper = True
|
||||
res = MultiCall([m2, m1], {}).execute()
|
||||
assert res == [1, 2]
|
||||
assert res == []
|
||||
assert l == ["m1 init", "m2 init", "m2 finish", "m1 finish"]
|
||||
|
||||
def test_listattr_hookwrapper_ordering(self):
|
||||
@@ -594,10 +592,8 @@ class TestMultiCall:
|
||||
m1.hookwrapper = True
|
||||
|
||||
mc = MultiCall([m1], {})
|
||||
with pytest.raises(mc.WrongHookWrapper) as ex:
|
||||
with pytest.raises(TypeError):
|
||||
mc.execute()
|
||||
assert ex.value.func == m1
|
||||
assert ex.value.message
|
||||
|
||||
def test_hookwrapper_too_many_yield(self):
|
||||
def m1():
|
||||
@@ -606,29 +602,43 @@ class TestMultiCall:
|
||||
m1.hookwrapper = True
|
||||
|
||||
mc = MultiCall([m1], {})
|
||||
with pytest.raises(mc.WrongHookWrapper) as ex:
|
||||
with pytest.raises(RuntimeError) as ex:
|
||||
mc.execute()
|
||||
assert ex.value.func == m1
|
||||
assert ex.value.message
|
||||
assert "m1" in str(ex.value)
|
||||
assert "test_core.py:" in str(ex.value)
|
||||
|
||||
|
||||
class TestHookRelay:
|
||||
def test_happypath(self):
|
||||
pm = PluginManager()
|
||||
class Api:
|
||||
def hello(self, arg):
|
||||
"api hook 1"
|
||||
|
||||
mcm = HookRelay(hookspecs=Api, pm=pm, prefix="he")
|
||||
assert hasattr(mcm, 'hello')
|
||||
assert repr(mcm.hello).find("hello") != -1
|
||||
pm = PluginManager([Api], prefix="he")
|
||||
hook = pm.hook
|
||||
assert hasattr(hook, 'hello')
|
||||
assert repr(hook.hello).find("hello") != -1
|
||||
class Plugin:
|
||||
def hello(self, arg):
|
||||
return arg + 1
|
||||
pm.register(Plugin())
|
||||
l = mcm.hello(arg=3)
|
||||
plugin = Plugin()
|
||||
pm.register(plugin)
|
||||
l = hook.hello(arg=3)
|
||||
assert l == [4]
|
||||
assert not hasattr(mcm, 'world')
|
||||
assert not hasattr(hook, 'world')
|
||||
pm.unregister(plugin)
|
||||
assert hook.hello(arg=3) == []
|
||||
|
||||
def test_argmismatch(self):
|
||||
class Api:
|
||||
def hello(self, arg):
|
||||
"api hook 1"
|
||||
pm = PluginManager(Api, prefix="he")
|
||||
class Plugin:
|
||||
def hello(self, argwrong):
|
||||
return arg + 1
|
||||
with pytest.raises(PluginValidationError) as exc:
|
||||
pm.register(Plugin())
|
||||
assert "argwrong" in str(exc.value)
|
||||
|
||||
def test_only_kwargs(self):
|
||||
pm = PluginManager()
|
||||
@@ -639,18 +649,16 @@ class TestHookRelay:
|
||||
pytest.raises(TypeError, lambda: mcm.hello(3))
|
||||
|
||||
def test_firstresult_definition(self):
|
||||
pm = PluginManager()
|
||||
class Api:
|
||||
def hello(self, arg):
|
||||
"api hook 1"
|
||||
hello.firstresult = True
|
||||
|
||||
mcm = HookRelay(hookspecs=Api, pm=pm, prefix="he")
|
||||
pm = PluginManager([Api], "he")
|
||||
class Plugin:
|
||||
def hello(self, arg):
|
||||
return arg + 1
|
||||
pm.register(Plugin())
|
||||
res = mcm.hello(arg=3)
|
||||
res = pm.hook.hello(arg=3)
|
||||
assert res == 4
|
||||
|
||||
class TestTracer:
|
||||
@@ -754,3 +762,105 @@ def test_importplugin_issue375(testdir):
|
||||
assert "qwe" not in str(excinfo.value)
|
||||
assert "aaaa" in str(excinfo.value)
|
||||
|
||||
class TestWrapMethod:
|
||||
def test_basic_happypath(self):
|
||||
class A:
|
||||
def f(self):
|
||||
return "A.f"
|
||||
|
||||
l = []
|
||||
def f(self):
|
||||
l.append(1)
|
||||
box = yield
|
||||
assert box.result == "A.f"
|
||||
l.append(2)
|
||||
undo = add_method_wrapper(A, f)
|
||||
|
||||
assert A().f() == "A.f"
|
||||
assert l == [1,2]
|
||||
undo()
|
||||
l[:] = []
|
||||
assert A().f() == "A.f"
|
||||
assert l == []
|
||||
|
||||
def test_no_yield(self):
|
||||
class A:
|
||||
def method(self):
|
||||
return
|
||||
|
||||
def method(self):
|
||||
if 0:
|
||||
yield
|
||||
|
||||
add_method_wrapper(A, method)
|
||||
with pytest.raises(RuntimeError) as excinfo:
|
||||
A().method()
|
||||
|
||||
assert "method" in str(excinfo.value)
|
||||
assert "did not yield" in str(excinfo.value)
|
||||
|
||||
def test_method_raises(self):
|
||||
class A:
|
||||
def error(self, val):
|
||||
raise ValueError(val)
|
||||
|
||||
l = []
|
||||
def error(self, val):
|
||||
l.append(val)
|
||||
yield
|
||||
l.append(None)
|
||||
|
||||
undo = add_method_wrapper(A, error)
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
A().error(42)
|
||||
assert l == [42, None]
|
||||
undo()
|
||||
l[:] = []
|
||||
with pytest.raises(ValueError):
|
||||
A().error(42)
|
||||
assert l == []
|
||||
|
||||
def test_controller_swallows_method_raises(self):
|
||||
class A:
|
||||
def error(self, val):
|
||||
raise ValueError(val)
|
||||
|
||||
def error(self, val):
|
||||
box = yield
|
||||
box.force_result(2)
|
||||
|
||||
add_method_wrapper(A, error)
|
||||
assert A().error(42) == 2
|
||||
|
||||
def test_reraise_on_controller_StopIteration(self):
|
||||
class A:
|
||||
def error(self, val):
|
||||
raise ValueError(val)
|
||||
|
||||
def error(self, val):
|
||||
try:
|
||||
yield
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
add_method_wrapper(A, error)
|
||||
with pytest.raises(ValueError):
|
||||
A().error(42)
|
||||
|
||||
@pytest.mark.xfail(reason="if needed later")
|
||||
def test_modify_call_args(self):
|
||||
class A:
|
||||
def error(self, val1, val2):
|
||||
raise ValueError(val1+val2)
|
||||
|
||||
l = []
|
||||
def error(self):
|
||||
box = yield (1,), {'val2': 2}
|
||||
assert box.excinfo[1].args == (3,)
|
||||
l.append(1)
|
||||
|
||||
add_method_wrapper(A, error)
|
||||
with pytest.raises(ValueError):
|
||||
A().error()
|
||||
assert l == [1]
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
from _pytest.doctest import DoctestItem, DoctestModule, DoctestTextfile
|
||||
import py, pytest
|
||||
|
||||
import pdb
|
||||
|
||||
xfail_if_pdbpp_installed = pytest.mark.xfail(hasattr(pdb, "__author__"),
|
||||
reason="doctest/pdbpp problem: https://bitbucket.org/antocuni/pdb/issue/24/doctests-fail-when-pdbpp-is-installed", run=False)
|
||||
|
||||
class TestDoctests:
|
||||
|
||||
def test_collect_testtextfile(self, testdir):
|
||||
@@ -161,7 +156,6 @@ class TestDoctests:
|
||||
reprec = testdir.inline_run(p, "--doctest-modules")
|
||||
reprec.assertoutcome(failed=1)
|
||||
|
||||
@xfail_if_pdbpp_installed
|
||||
def test_doctestmodule_external_and_issue116(self, testdir):
|
||||
p = testdir.mkpydir("hello")
|
||||
p.join("__init__.py").write(py.code.Source("""
|
||||
@@ -201,7 +195,6 @@ class TestDoctests:
|
||||
"*test_txtfile_failing.txt:2: DocTestFailure"
|
||||
])
|
||||
|
||||
@xfail_if_pdbpp_installed
|
||||
def test_txtfile_with_fixtures(self, testdir):
|
||||
p = testdir.maketxtfile("""
|
||||
>>> dir = getfixture('tmpdir')
|
||||
@@ -211,7 +204,6 @@ class TestDoctests:
|
||||
reprec = testdir.inline_run(p, )
|
||||
reprec.assertoutcome(passed=1)
|
||||
|
||||
@xfail_if_pdbpp_installed
|
||||
def test_txtfile_with_usefixtures_in_ini(self, testdir):
|
||||
testdir.makeini("""
|
||||
[pytest]
|
||||
@@ -232,7 +224,6 @@ class TestDoctests:
|
||||
reprec = testdir.inline_run(p, )
|
||||
reprec.assertoutcome(passed=1)
|
||||
|
||||
@xfail_if_pdbpp_installed
|
||||
def test_doctestmodule_with_fixtures(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
'''
|
||||
@@ -244,7 +235,6 @@ class TestDoctests:
|
||||
reprec = testdir.inline_run(p, "--doctest-modules")
|
||||
reprec.assertoutcome(passed=1)
|
||||
|
||||
@xfail_if_pdbpp_installed
|
||||
def test_doctestmodule_three_tests(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
'''
|
||||
@@ -270,7 +260,6 @@ class TestDoctests:
|
||||
reprec = testdir.inline_run(p, "--doctest-modules")
|
||||
reprec.assertoutcome(passed=3)
|
||||
|
||||
@xfail_if_pdbpp_installed
|
||||
def test_doctestmodule_two_tests_one_fail(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
class MyClass:
|
||||
@@ -289,3 +278,79 @@ class TestDoctests:
|
||||
""")
|
||||
reprec = testdir.inline_run(p, "--doctest-modules")
|
||||
reprec.assertoutcome(failed=1, passed=1)
|
||||
|
||||
def test_ignored_whitespace(self, testdir):
|
||||
testdir.makeini("""
|
||||
[pytest]
|
||||
doctest_optionflags = ELLIPSIS NORMALIZE_WHITESPACE
|
||||
""")
|
||||
p = testdir.makepyfile("""
|
||||
class MyClass:
|
||||
'''
|
||||
>>> a = "foo "
|
||||
>>> print(a)
|
||||
foo
|
||||
'''
|
||||
pass
|
||||
""")
|
||||
reprec = testdir.inline_run(p, "--doctest-modules")
|
||||
reprec.assertoutcome(passed=1)
|
||||
|
||||
def test_non_ignored_whitespace(self, testdir):
|
||||
testdir.makeini("""
|
||||
[pytest]
|
||||
doctest_optionflags = ELLIPSIS
|
||||
""")
|
||||
p = testdir.makepyfile("""
|
||||
class MyClass:
|
||||
'''
|
||||
>>> a = "foo "
|
||||
>>> print(a)
|
||||
foo
|
||||
'''
|
||||
pass
|
||||
""")
|
||||
reprec = testdir.inline_run(p, "--doctest-modules")
|
||||
reprec.assertoutcome(failed=1, passed=0)
|
||||
|
||||
def test_ignored_whitespace_glob(self, testdir):
|
||||
testdir.makeini("""
|
||||
[pytest]
|
||||
doctest_optionflags = ELLIPSIS NORMALIZE_WHITESPACE
|
||||
""")
|
||||
p = testdir.maketxtfile(xdoc="""
|
||||
>>> a = "foo "
|
||||
>>> print(a)
|
||||
foo
|
||||
""")
|
||||
reprec = testdir.inline_run(p, "--doctest-glob=x*.txt")
|
||||
reprec.assertoutcome(passed=1)
|
||||
|
||||
def test_non_ignored_whitespace_glob(self, testdir):
|
||||
testdir.makeini("""
|
||||
[pytest]
|
||||
doctest_optionflags = ELLIPSIS
|
||||
""")
|
||||
p = testdir.maketxtfile(xdoc="""
|
||||
>>> a = "foo "
|
||||
>>> print(a)
|
||||
foo
|
||||
""")
|
||||
reprec = testdir.inline_run(p, "--doctest-glob=x*.txt")
|
||||
reprec.assertoutcome(failed=1, passed=0)
|
||||
|
||||
def test_ignore_import_errors_on_doctest(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
import asdf
|
||||
|
||||
def add_one(x):
|
||||
'''
|
||||
>>> add_one(1)
|
||||
2
|
||||
'''
|
||||
return x + 1
|
||||
""")
|
||||
|
||||
reprec = testdir.inline_run(p, "--doctest-modules",
|
||||
"--doctest-ignore-import-errors")
|
||||
reprec.assertoutcome(skipped=1, failed=1, passed=0)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import py, pytest
|
||||
from _pytest.helpconfig import collectattr
|
||||
import pytest
|
||||
|
||||
def test_version(testdir, pytestconfig):
|
||||
result = testdir.runpytest("--version")
|
||||
@@ -25,18 +24,6 @@ def test_help(testdir):
|
||||
*to see*fixtures*py.test --fixtures*
|
||||
""")
|
||||
|
||||
def test_collectattr():
|
||||
class A:
|
||||
def pytest_hello(self):
|
||||
pass
|
||||
class B(A):
|
||||
def pytest_world(self):
|
||||
pass
|
||||
methods = py.builtin.sorted(collectattr(B))
|
||||
assert list(methods) == ['pytest_hello', 'pytest_world']
|
||||
methods = py.builtin.sorted(collectattr(B()))
|
||||
assert list(methods) == ['pytest_hello', 'pytest_world']
|
||||
|
||||
def test_hookvalidation_unknown(testdir):
|
||||
testdir.makeconftest("""
|
||||
def pytest_hello(xyz):
|
||||
|
||||
@@ -150,7 +150,7 @@ class TestPython:
|
||||
classname="test_failure_function",
|
||||
name="test_fail")
|
||||
fnode = tnode.getElementsByTagName("failure")[0]
|
||||
assert_attr(fnode, message="test failure")
|
||||
assert_attr(fnode, message="ValueError: 42")
|
||||
assert "ValueError" in fnode.toxml()
|
||||
systemout = fnode.nextSibling
|
||||
assert systemout.tagName == "system-out"
|
||||
@@ -159,6 +159,19 @@ class TestPython:
|
||||
assert systemerr.tagName == "system-err"
|
||||
assert "hello-stderr" in systemerr.toxml()
|
||||
|
||||
def test_failure_verbose_message(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import sys
|
||||
def test_fail():
|
||||
assert 0, "An error"
|
||||
""")
|
||||
|
||||
result, dom = runandparse(testdir)
|
||||
node = dom.getElementsByTagName("testsuite")[0]
|
||||
tnode = node.getElementsByTagName("testcase")[0]
|
||||
fnode = tnode.getElementsByTagName("failure")[0]
|
||||
assert_attr(fnode, message="AssertionError: An error assert 0")
|
||||
|
||||
def test_failure_escape(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
@@ -371,7 +384,7 @@ class TestNonPython:
|
||||
#classname="test_collect_error",
|
||||
name="myfile.xyz")
|
||||
fnode = tnode.getElementsByTagName("failure")[0]
|
||||
assert_attr(fnode, message="test failure")
|
||||
assert_attr(fnode, message="custom item runtest failed")
|
||||
assert "custom item runtest failed" in fnode.toxml()
|
||||
|
||||
|
||||
|
||||
@@ -509,11 +509,13 @@ class TestKeywordSelection:
|
||||
pass
|
||||
""")
|
||||
testdir.makepyfile(conftest="""
|
||||
def pytest_pycollect_makeitem(__multicall__, name):
|
||||
import pytest
|
||||
@pytest.mark.hookwrapper
|
||||
def pytest_pycollect_makeitem(name):
|
||||
outcome = yield
|
||||
if name == "TestClass":
|
||||
item = __multicall__.execute()
|
||||
item = outcome.get_result()
|
||||
item.extra_keyword_matches.add("xxx")
|
||||
return item
|
||||
""")
|
||||
reprec = testdir.inline_run(p.dirpath(), '-s', '-k', keyword)
|
||||
py.builtin.print_("keyword", repr(keyword))
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import py
|
||||
import sys
|
||||
|
||||
from test_doctest import xfail_if_pdbpp_installed
|
||||
|
||||
class TestPDB:
|
||||
def pytest_funcarg__pdblist(self, request):
|
||||
@@ -187,7 +186,6 @@ class TestPDB:
|
||||
if child.isalive():
|
||||
child.wait()
|
||||
|
||||
@xfail_if_pdbpp_installed
|
||||
def test_pdb_interaction_doctest(self, testdir):
|
||||
p1 = testdir.makepyfile("""
|
||||
import pytest
|
||||
|
||||
@@ -3,9 +3,9 @@ import os
|
||||
from _pytest.pytester import HookRecorder
|
||||
from _pytest.core import PluginManager
|
||||
|
||||
def test_reportrecorder(testdir):
|
||||
def test_make_hook_recorder(testdir):
|
||||
item = testdir.getitem("def test_func(): pass")
|
||||
recorder = testdir.getreportrecorder(item.config)
|
||||
recorder = testdir.make_hook_recorder(item.config.pluginmanager)
|
||||
assert not recorder.getfailures()
|
||||
|
||||
pytest.xfail("internal reportrecorder tests need refactoring")
|
||||
@@ -71,47 +71,37 @@ def test_testdir_runs_with_plugin(testdir):
|
||||
"*1 passed*"
|
||||
])
|
||||
|
||||
def test_hookrecorder_basic():
|
||||
rec = HookRecorder(PluginManager())
|
||||
class ApiClass:
|
||||
|
||||
def make_holder():
|
||||
class apiclass:
|
||||
def pytest_xyz(self, arg):
|
||||
"x"
|
||||
rec.start_recording(ApiClass)
|
||||
rec.hook.pytest_xyz(arg=123)
|
||||
def pytest_xyz_noarg(self):
|
||||
"x"
|
||||
|
||||
apimod = type(os)('api')
|
||||
def pytest_xyz(arg):
|
||||
"x"
|
||||
def pytest_xyz_noarg():
|
||||
"x"
|
||||
apimod.pytest_xyz = pytest_xyz
|
||||
apimod.pytest_xyz_noarg = pytest_xyz_noarg
|
||||
return apiclass, apimod
|
||||
|
||||
|
||||
@pytest.mark.parametrize("holder", make_holder())
|
||||
def test_hookrecorder_basic(holder):
|
||||
pm = PluginManager()
|
||||
pm.hook._addhooks(holder, "pytest_")
|
||||
rec = HookRecorder(pm)
|
||||
pm.hook.pytest_xyz(arg=123)
|
||||
call = rec.popcall("pytest_xyz")
|
||||
assert call.arg == 123
|
||||
assert call._name == "pytest_xyz"
|
||||
pytest.raises(pytest.fail.Exception, "rec.popcall('abc')")
|
||||
|
||||
def test_hookrecorder_basic_no_args_hook():
|
||||
rec = HookRecorder(PluginManager())
|
||||
apimod = type(os)('api')
|
||||
def pytest_xyz():
|
||||
"x"
|
||||
apimod.pytest_xyz = pytest_xyz
|
||||
rec.start_recording(apimod)
|
||||
rec.hook.pytest_xyz()
|
||||
call = rec.popcall("pytest_xyz")
|
||||
assert call._name == "pytest_xyz"
|
||||
|
||||
def test_functional(testdir, linecomp):
|
||||
reprec = testdir.inline_runsource("""
|
||||
import pytest
|
||||
from _pytest.core import HookRelay, PluginManager
|
||||
pytest_plugins="pytester"
|
||||
def test_func(_pytest):
|
||||
class ApiClass:
|
||||
def pytest_xyz(self, arg): "x"
|
||||
hook = HookRelay([ApiClass], PluginManager())
|
||||
rec = _pytest.gethookrecorder(hook)
|
||||
class Plugin:
|
||||
def pytest_xyz(self, arg):
|
||||
return arg + 1
|
||||
rec._pluginmanager.register(Plugin())
|
||||
res = rec.hook.pytest_xyz(arg=41)
|
||||
assert res == [42]
|
||||
""")
|
||||
reprec.assertoutcome(passed=1)
|
||||
pm.hook.pytest_xyz_noarg()
|
||||
call = rec.popcall("pytest_xyz_noarg")
|
||||
assert call._name == "pytest_xyz_noarg"
|
||||
|
||||
|
||||
def test_makepyfile_unicode(testdir):
|
||||
|
||||
@@ -525,3 +525,21 @@ def test_makereport_getsource(testdir):
|
||||
result = testdir.runpytest()
|
||||
assert 'INTERNALERROR' not in result.stdout.str()
|
||||
result.stdout.fnmatch_lines(['*else: assert False*'])
|
||||
|
||||
|
||||
def test_store_except_info_on_eror():
|
||||
""" Test that upon test failure, the exception info is stored on
|
||||
sys.last_traceback and friends.
|
||||
"""
|
||||
# Simulate item that raises a specific exception
|
||||
class ItemThatRaises:
|
||||
def runtest(self):
|
||||
raise IndexError('TEST')
|
||||
try:
|
||||
runner.pytest_runtest_call(ItemThatRaises())
|
||||
except IndexError:
|
||||
pass
|
||||
# Check that exception info is stored on sys
|
||||
assert sys.last_type is IndexError
|
||||
assert sys.last_value.args[0] == 'TEST'
|
||||
assert sys.last_traceback
|
||||
|
||||
@@ -77,11 +77,11 @@ class TestTerminal:
|
||||
def test_writeline(self, testdir, linecomp):
|
||||
modcol = testdir.getmodulecol("def test_one(): pass")
|
||||
rep = TerminalReporter(modcol.config, file=linecomp.stringio)
|
||||
rep.write_fspath_result(py.path.local("xy.py"), '.')
|
||||
rep.write_fspath_result(modcol.nodeid, ".")
|
||||
rep.write_line("hello world")
|
||||
lines = linecomp.stringio.getvalue().split('\n')
|
||||
assert not lines[0]
|
||||
assert lines[1].endswith("xy.py .")
|
||||
assert lines[1].endswith(modcol.name + " .")
|
||||
assert lines[2] == "hello world"
|
||||
|
||||
def test_show_runtest_logstart(self, testdir, linecomp):
|
||||
@@ -126,7 +126,7 @@ class TestTerminal:
|
||||
])
|
||||
result = testdir.runpytest("-v", p2)
|
||||
result.stdout.fnmatch_lines([
|
||||
"*test_p2.py <- *test_p1.py::TestMore::test_p1*",
|
||||
"*test_p2.py::TestMore::test_p1* <- *test_p1.py*PASSED",
|
||||
])
|
||||
|
||||
def test_itemreport_directclasses_not_shown_as_subclasses(self, testdir):
|
||||
|
||||
4
tox.ini
4
tox.ini
@@ -1,6 +1,6 @@
|
||||
[tox]
|
||||
distshare={homedir}/.tox/distshare
|
||||
envlist=flakes,py26,py27,py34,pypy,py27-pexpect,py33-pexpect,py27-nobyte,py32,py33,py27-xdist,py33-xdist,py27-trial,py33-trial,doctesting,py27-cxfreeze
|
||||
envlist=flakes,py26,py27,py34,pypy,py27-pexpect,py33-pexpect,py27-nobyte,py33,py27-xdist,py33-xdist,py27-trial,py33-trial,doctesting,py27-cxfreeze
|
||||
|
||||
[testenv]
|
||||
changedir=testing
|
||||
@@ -136,7 +136,7 @@ commands=
|
||||
minversion=2.0
|
||||
plugins=pytester
|
||||
#--pyargs --doctest-modules --ignore=.tox
|
||||
addopts= -rxsX
|
||||
addopts= -rxsX
|
||||
rsyncdirs=tox.ini pytest.py _pytest testing
|
||||
python_files=test_*.py *_test.py testing/*/*.py
|
||||
python_classes=Test Acceptance
|
||||
|
||||
Reference in New Issue
Block a user