From 305cbecb347f424d451fe27c462fdc9af91a191f Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 12 Dec 2013 19:20:13 -0200 Subject: [PATCH 1/4] Updated plugins_index to use pytest 2.5.0 - Also made test for plugins_index less brittle; --- doc/en/plugins_index/plugins_index.py | 1 + doc/en/plugins_index/plugins_index.txt | 102 +++++++++--------- .../test_plugins_index.expected.txt | 16 +++ doc/en/plugins_index/test_plugins_index.py | 32 ++---- 4 files changed, 78 insertions(+), 73 deletions(-) create mode 100644 doc/en/plugins_index/test_plugins_index.expected.txt diff --git a/doc/en/plugins_index/plugins_index.py b/doc/en/plugins_index/plugins_index.py index 672c4071b..6cf794f22 100644 --- a/doc/en/plugins_index/plugins_index.py +++ b/doc/en/plugins_index/plugins_index.py @@ -61,6 +61,7 @@ def obtain_plugins_table(plugins, client): ColumnData = namedtuple('ColumnData', 'text link') headers = ['Name', 'Author', 'Downloads', 'Python 2.7', 'Python 3.3', 'Summary'] pytest_version = pytest.__version__ + print '*** pytest-{} ***'.format(pytest_version) plugins = list(plugins) for index, (package_name, version) in enumerate(plugins): print package_name, version, '...', diff --git a/doc/en/plugins_index/plugins_index.txt b/doc/en/plugins_index/plugins_index.txt index 9b01770a4..ce999e898 100644 --- a/doc/en/plugins_index/plugins_index.txt +++ b/doc/en/plugins_index/plugins_index.txt @@ -6,59 +6,59 @@ List of Third-Party Plugins ========================================================================================== ==================================================================================== ========= ====================================================================================================== ====================================================================================================== ============================================================================================================================================= Name Author Downloads Python 2.7 Python 3.3 Summary ========================================================================================== ==================================================================================== ========= ====================================================================================================== ====================================================================================================== ============================================================================================================================================= - `pytest-bdd-0.6.7 `_ `Oleg Pidsadnyi `_ 1467 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bdd-0.6.7?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bdd-0.6.7?py=py33&pytest=2.4.2 BDD for pytest - `pytest-bdd-splinter-0.5.96 `_ `Oleg Pidsadnyi `_ 3352 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bdd-splinter-0.5.96?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bdd-splinter-0.5.96?py=py33&pytest=2.4.2 Splinter subplugin for Pytest BDD plugin - `pytest-bench-0.2.5 `_ `Concordus Applications `_ 1560 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bench-0.2.5?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bench-0.2.5?py=py33&pytest=2.4.2 Benchmark utility that plugs into pytest. - `pytest-blockage-0.1 `_ `UNKNOWN `_ 102 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-blockage-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-blockage-0.1?py=py33&pytest=2.4.2 Disable network requests during a test run. - `pytest-browsermob-proxy-0.1 `_ `Dave Hunt `_ 55 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-browsermob-proxy-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-browsermob-proxy-0.1?py=py33&pytest=2.4.2 BrowserMob proxy plugin for py.test. - `pytest-bugzilla-0.2 `_ `Noufal Ibrahim `_ 89 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bugzilla-0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bugzilla-0.2?py=py33&pytest=2.4.2 py.test bugzilla integration plugin - `pytest-cache-1.0 `_ `Holger Krekel `_ 5561 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cache-1.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cache-1.0?py=py33&pytest=2.4.2 pytest plugin with mechanisms for caching across test runs - `pytest-capturelog-0.7 `_ `Meme Dough `_ 1553 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-capturelog-0.7?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-capturelog-0.7?py=py33&pytest=2.4.2 py.test plugin to capture log messages - `pytest-codecheckers-0.2 `_ `Ronny Pfannschmidt `_ 384 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-codecheckers-0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-codecheckers-0.2?py=py33&pytest=2.4.2 pytest plugin to add source code sanity checks (pep8 and friends) - `pytest-contextfixture-0.1.1 `_ `Andreas Pelme `_ 92 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-contextfixture-0.1.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-contextfixture-0.1.1?py=py33&pytest=2.4.2 Define pytest fixtures as context managers. - `pytest-couchdbkit-0.5.1 `_ `RonnyPfannschmidt `_ 200 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-couchdbkit-0.5.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-couchdbkit-0.5.1?py=py33&pytest=2.4.2 py.test extension for per-test couchdb databases using couchdbkit - `pytest-cov-1.6 `_ `Meme Dough `_ 23291 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cov-1.6?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cov-1.6?py=py33&pytest=2.4.2 py.test plugin for coverage reporting with support for both centralised and distributed testing, including subprocesses and multiprocessing - `pytest-dbfixtures-0.4.0 `_ `Clearcode - The A Room `_ 6223 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-dbfixtures-0.4.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-dbfixtures-0.4.0?py=py33&pytest=2.4.2 dbfixtures plugin for py.test. - `pytest-django-2.4 `_ `Andreas Pelme `_ 4809 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-2.4?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-2.4?py=py33&pytest=2.4.2 A Django plugin for py.test. - `pytest-django-lite-0.1.0 `_ `David Cramer `_ 987 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-lite-0.1.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-lite-0.1.0?py=py33&pytest=2.4.2 The bare minimum to integrate py.test with Django. - `pytest-figleaf-1.0 `_ `holger krekel `_ 53 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-figleaf-1.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-figleaf-1.0?py=py33&pytest=2.4.2 py.test figleaf coverage plugin - `pytest-flakes-0.2 `_ `Florian Schulze, Holger Krekel and Ronny Pfannschmidt `_ 1146 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-flakes-0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-flakes-0.2?py=py33&pytest=2.4.2 pytest plugin to check source code with pyflakes - `pytest-greendots-0.2 `_ `UNKNOWN `_ 139 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-greendots-0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-greendots-0.2?py=py33&pytest=2.4.2 Green progress dots - `pytest-growl-0.1 `_ `Anthony Long `_ 58 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-growl-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-growl-0.1?py=py33&pytest=2.4.2 Growl notifications for pytest results. - `pytest-incremental-0.3.0 `_ `Eduardo Naufel Schettino `_ 180 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-incremental-0.3.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-incremental-0.3.0?py=py33&pytest=2.4.2 an incremental test runner (pytest plugin) - `pytest-instafail-0.1.1 `_ `Janne Vanhala `_ 418 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-instafail-0.1.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-instafail-0.1.1?py=py33&pytest=2.4.2 py.test plugin to show failures instantly - `pytest-ipdb-0.1-prerelease `_ `Matthew de Verteuil `_ 93 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-ipdb-0.1-prerelease?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-ipdb-0.1-prerelease?py=py33&pytest=2.4.2 A py.test plug-in to enable drop to ipdb debugger on test failure. - `pytest-jira-0.01 `_ `James Laska `_ 86 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-jira-0.01?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-jira-0.01?py=py33&pytest=2.4.2 py.test JIRA integration plugin, using markers - `pytest-konira-0.2 `_ `Alfredo Deza `_ 91 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-konira-0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-konira-0.2?py=py33&pytest=2.4.2 Run Konira DSL tests with py.test - `pytest-localserver-0.3.2 `_ `Sebastian Rahlf `_ 448 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-localserver-0.3.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-localserver-0.3.2?py=py33&pytest=2.4.2 py.test plugin to test server connections locally. - `pytest-marker-bugzilla-0.06 `_ `Eric Sammons `_ 191 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marker-bugzilla-0.06?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marker-bugzilla-0.06?py=py33&pytest=2.4.2 py.test bugzilla integration plugin, using markers - `pytest-markfiltration-0.8 `_ `adam goucher `_ 253 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-markfiltration-0.8?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-markfiltration-0.8?py=py33&pytest=2.4.2 UNKNOWN - `pytest-marks-0.4 `_ `adam goucher `_ 225 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marks-0.4?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marks-0.4?py=py33&pytest=2.4.2 UNKNOWN - `pytest-monkeyplus-1.1.0 `_ `Virgil Dupras `_ 123 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-monkeyplus-1.1.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-monkeyplus-1.1.0?py=py33&pytest=2.4.2 pytest's monkeypatch subclass with extra functionalities - `pytest-mozwebqa-1.1.1 `_ `Dave Hunt `_ 1037 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-mozwebqa-1.1.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-mozwebqa-1.1.1?py=py33&pytest=2.4.2 Mozilla WebQA plugin for py.test. - `pytest-oerp-0.2.0 `_ `Leonardo Santagada `_ 144 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-oerp-0.2.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-oerp-0.2.0?py=py33&pytest=2.4.2 pytest plugin to test OpenERP modules - `pytest-osxnotify-0.1.4 `_ `Daniel Bader `_ 184 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-osxnotify-0.1.4?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-osxnotify-0.1.4?py=py33&pytest=2.4.2 OS X notifications for py.test results. - `pytest-paste-config-0.1 `_ `UNKNOWN `_ 164 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-paste-config-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-paste-config-0.1?py=py33&pytest=2.4.2 Allow setting the path to a paste config file - `pytest-pep8-1.0.5 `_ `Holger Krekel and Ronny Pfannschmidt `_ 5809 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pep8-1.0.5?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pep8-1.0.5?py=py33&pytest=2.4.2 pytest plugin to check PEP8 requirements - `pytest-poo-0.2 `_ `Andreas Pelme `_ 108 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-poo-0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-poo-0.2?py=py33&pytest=2.4.2 Visualize your crappy tests - `pytest-pydev-0.1 `_ `Sebastian Rahlf `_ 100 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pydev-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pydev-0.1?py=py33&pytest=2.4.2 py.test plugin to connect to a remote debug server with PyDev or PyCharm. - `pytest-qt-1.0.2 `_ `Bruno Oliveira `_ 129 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-qt-1.0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-qt-1.0.2?py=py33&pytest=2.4.2 pytest plugin that adds fixtures for testing Qt (PyQt and PySide) applications. - `pytest-quickcheck-0.8 `_ `Tetsuya Morimoto `_ 345 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-quickcheck-0.8?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-quickcheck-0.8?py=py33&pytest=2.4.2 pytest plugin to generate random data inspired by QuickCheck - `pytest-rage-0.1 `_ `Leonardo Santagada `_ 56 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rage-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rage-0.1?py=py33&pytest=2.4.2 pytest plugin to implement PEP712 - `pytest-random-0.02 `_ `Leah Klearman `_ 116 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-random-0.02?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-random-0.02?py=py33&pytest=2.4.2 py.test plugin to randomize tests - `pytest-rerunfailures-0.03 `_ `Leah Klearman `_ 147 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rerunfailures-0.03?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rerunfailures-0.03?py=py33&pytest=2.4.2 py.test plugin to re-run tests to eliminate flakey failures - `pytest-runfailed-0.3 `_ `Dimitri Merejkowsky `_ 88 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runfailed-0.3?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runfailed-0.3?py=py33&pytest=2.4.2 implement a --failed option for pytest - `pytest-runner-2.0 `_ `Jason R. Coombs `_ 5657 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runner-2.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runner-2.0?py=py33&pytest=2.4.2 UNKNOWN - `pytest-sugar-0.2.2 `_ `Teemu, Janne Vanhala `_ 348 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-sugar-0.2.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-sugar-0.2.2?py=py33&pytest=2.4.2 py.test plugin that adds instafail, ETA and neat graphics - `pytest-timeout-0.3 `_ `Floris Bruynooghe `_ 4351 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-timeout-0.3?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-timeout-0.3?py=py33&pytest=2.4.2 pytest plugin to abort tests after a timeout - `pytest-twisted-1.4 `_ `Ralf Schmitt `_ 239 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-twisted-1.4?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-twisted-1.4?py=py33&pytest=2.4.2 A twisted plugin for py.test. - `pytest-xdist-1.9 `_ `holger krekel and contributors `_ 7894 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xdist-1.9?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xdist-1.9?py=py33&pytest=2.4.2 py.test xdist plugin for distributed testing and loop-on-failing modes - `pytest-xprocess-0.8 `_ `Holger Krekel `_ 96 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xprocess-0.8?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xprocess-0.8?py=py33&pytest=2.4.2 pytest plugin to manage external processes across test runs - `pytest-yamlwsgi-0.6 `_ `Ali Afshar `_ 194 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-yamlwsgi-0.6?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-yamlwsgi-0.6?py=py33&pytest=2.4.2 Run tests against wsgi apps defined in yaml - `pytest-zap-0.1 `_ `Dave Hunt `_ 63 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-zap-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-zap-0.1?py=py33&pytest=2.4.2 OWASP ZAP plugin for py.test. + `pytest-bdd-0.6.7 `_ `Oleg Pidsadnyi `_ 1640 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bdd-0.6.7?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bdd-0.6.7?py=py33&pytest=2.5.0 BDD for pytest + `pytest-bdd-splinter-0.5.96 `_ `Oleg Pidsadnyi `_ 3463 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bdd-splinter-0.5.96?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bdd-splinter-0.5.96?py=py33&pytest=2.5.0 Splinter subplugin for Pytest BDD plugin + `pytest-bench-0.2.5 `_ `Concordus Applications `_ 1588 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bench-0.2.5?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bench-0.2.5?py=py33&pytest=2.5.0 Benchmark utility that plugs into pytest. + `pytest-blockage-0.1 `_ `UNKNOWN `_ 110 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-blockage-0.1?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-blockage-0.1?py=py33&pytest=2.5.0 Disable network requests during a test run. + `pytest-browsermob-proxy-0.1 `_ `Dave Hunt `_ 61 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-browsermob-proxy-0.1?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-browsermob-proxy-0.1?py=py33&pytest=2.5.0 BrowserMob proxy plugin for py.test. + `pytest-bugzilla-0.2 `_ `Noufal Ibrahim `_ 105 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bugzilla-0.2?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bugzilla-0.2?py=py33&pytest=2.5.0 py.test bugzilla integration plugin + `pytest-cache-1.0 `_ `Holger Krekel `_ 5690 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cache-1.0?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cache-1.0?py=py33&pytest=2.5.0 pytest plugin with mechanisms for caching across test runs + `pytest-capturelog-0.7 `_ `Meme Dough `_ 1615 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-capturelog-0.7?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-capturelog-0.7?py=py33&pytest=2.5.0 py.test plugin to capture log messages + `pytest-codecheckers-0.2 `_ `Ronny Pfannschmidt `_ 408 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-codecheckers-0.2?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-codecheckers-0.2?py=py33&pytest=2.5.0 pytest plugin to add source code sanity checks (pep8 and friends) + `pytest-contextfixture-0.1.1 `_ `Andreas Pelme `_ 101 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-contextfixture-0.1.1?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-contextfixture-0.1.1?py=py33&pytest=2.5.0 Define pytest fixtures as context managers. + `pytest-couchdbkit-0.5.1 `_ `RonnyPfannschmidt `_ 215 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-couchdbkit-0.5.1?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-couchdbkit-0.5.1?py=py33&pytest=2.5.0 py.test extension for per-test couchdb databases using couchdbkit + `pytest-cov-1.6 `_ `Meme Dough `_ 23787 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cov-1.6?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cov-1.6?py=py33&pytest=2.5.0 py.test plugin for coverage reporting with support for both centralised and distributed testing, including subprocesses and multiprocessing + `pytest-dbfixtures-0.4.0 `_ `Clearcode - The A Room `_ 6332 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-dbfixtures-0.4.0?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-dbfixtures-0.4.0?py=py33&pytest=2.5.0 dbfixtures plugin for py.test. + `pytest-django-2.4 `_ `Andreas Pelme `_ 4935 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-2.4?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-2.4?py=py33&pytest=2.5.0 A Django plugin for py.test. + `pytest-django-lite-0.1.0 `_ `David Cramer `_ 1075 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-lite-0.1.0?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-lite-0.1.0?py=py33&pytest=2.5.0 The bare minimum to integrate py.test with Django. + `pytest-figleaf-1.0 `_ `holger krekel `_ 59 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-figleaf-1.0?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-figleaf-1.0?py=py33&pytest=2.5.0 py.test figleaf coverage plugin + `pytest-flakes-0.2 `_ `Florian Schulze, Holger Krekel and Ronny Pfannschmidt `_ 1203 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-flakes-0.2?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-flakes-0.2?py=py33&pytest=2.5.0 pytest plugin to check source code with pyflakes + `pytest-greendots-0.2 `_ `UNKNOWN `_ 149 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-greendots-0.2?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-greendots-0.2?py=py33&pytest=2.5.0 Green progress dots + `pytest-growl-0.1 `_ `Anthony Long `_ 65 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-growl-0.1?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-growl-0.1?py=py33&pytest=2.5.0 Growl notifications for pytest results. + `pytest-incremental-0.3.0 `_ `Eduardo Naufel Schettino `_ 192 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-incremental-0.3.0?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-incremental-0.3.0?py=py33&pytest=2.5.0 an incremental test runner (pytest plugin) + `pytest-instafail-0.1.1 `_ `Janne Vanhala `_ 431 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-instafail-0.1.1?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-instafail-0.1.1?py=py33&pytest=2.5.0 py.test plugin to show failures instantly + `pytest-ipdb-0.1-prerelease `_ `Matthew de Verteuil `_ 99 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-ipdb-0.1-prerelease?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-ipdb-0.1-prerelease?py=py33&pytest=2.5.0 A py.test plug-in to enable drop to ipdb debugger on test failure. + `pytest-jira-0.01 `_ `James Laska `_ 94 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-jira-0.01?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-jira-0.01?py=py33&pytest=2.5.0 py.test JIRA integration plugin, using markers + `pytest-konira-0.2 `_ `Alfredo Deza `_ 99 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-konira-0.2?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-konira-0.2?py=py33&pytest=2.5.0 Run Konira DSL tests with py.test + `pytest-localserver-0.3.2 `_ `Sebastian Rahlf `_ 470 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-localserver-0.3.2?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-localserver-0.3.2?py=py33&pytest=2.5.0 py.test plugin to test server connections locally. + `pytest-marker-bugzilla-0.06 `_ `Eric Sammons `_ 205 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marker-bugzilla-0.06?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marker-bugzilla-0.06?py=py33&pytest=2.5.0 py.test bugzilla integration plugin, using markers + `pytest-markfiltration-0.8 `_ `adam goucher `_ 269 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-markfiltration-0.8?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-markfiltration-0.8?py=py33&pytest=2.5.0 UNKNOWN + `pytest-marks-0.4 `_ `adam goucher `_ 241 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marks-0.4?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marks-0.4?py=py33&pytest=2.5.0 UNKNOWN + `pytest-monkeyplus-1.1.0 `_ `Virgil Dupras `_ 132 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-monkeyplus-1.1.0?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-monkeyplus-1.1.0?py=py33&pytest=2.5.0 pytest's monkeypatch subclass with extra functionalities + `pytest-mozwebqa-1.1.1 `_ `Dave Hunt `_ 1087 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-mozwebqa-1.1.1?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-mozwebqa-1.1.1?py=py33&pytest=2.5.0 Mozilla WebQA plugin for py.test. + `pytest-oerp-0.2.0 `_ `Leonardo Santagada `_ 158 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-oerp-0.2.0?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-oerp-0.2.0?py=py33&pytest=2.5.0 pytest plugin to test OpenERP modules + `pytest-osxnotify-0.1.4 `_ `Daniel Bader `_ 200 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-osxnotify-0.1.4?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-osxnotify-0.1.4?py=py33&pytest=2.5.0 OS X notifications for py.test results. + `pytest-paste-config-0.1 `_ `UNKNOWN `_ 169 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-paste-config-0.1?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-paste-config-0.1?py=py33&pytest=2.5.0 Allow setting the path to a paste config file + `pytest-pep8-1.0.5 `_ `Holger Krekel and Ronny Pfannschmidt `_ 5971 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pep8-1.0.5?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pep8-1.0.5?py=py33&pytest=2.5.0 pytest plugin to check PEP8 requirements + `pytest-poo-0.2 `_ `Andreas Pelme `_ 116 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-poo-0.2?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-poo-0.2?py=py33&pytest=2.5.0 Visualize your crappy tests + `pytest-pydev-0.1 `_ `Sebastian Rahlf `_ 107 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pydev-0.1?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pydev-0.1?py=py33&pytest=2.5.0 py.test plugin to connect to a remote debug server with PyDev or PyCharm. + `pytest-qt-1.0.2 `_ `Bruno Oliveira `_ 140 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-qt-1.0.2?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-qt-1.0.2?py=py33&pytest=2.5.0 pytest plugin that adds fixtures for testing Qt (PyQt and PySide) applications. + `pytest-quickcheck-0.8 `_ `Tetsuya Morimoto `_ 380 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-quickcheck-0.8?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-quickcheck-0.8?py=py33&pytest=2.5.0 pytest plugin to generate random data inspired by QuickCheck + `pytest-rage-0.1 `_ `Leonardo Santagada `_ 64 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rage-0.1?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rage-0.1?py=py33&pytest=2.5.0 pytest plugin to implement PEP712 + `pytest-random-0.02 `_ `Leah Klearman `_ 125 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-random-0.02?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-random-0.02?py=py33&pytest=2.5.0 py.test plugin to randomize tests + `pytest-rerunfailures-0.03 `_ `Leah Klearman `_ 153 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rerunfailures-0.03?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rerunfailures-0.03?py=py33&pytest=2.5.0 py.test plugin to re-run tests to eliminate flakey failures + `pytest-runfailed-0.3 `_ `Dimitri Merejkowsky `_ 96 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runfailed-0.3?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runfailed-0.3?py=py33&pytest=2.5.0 implement a --failed option for pytest + `pytest-runner-2.0 `_ `Jason R. Coombs `_ 5726 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runner-2.0?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runner-2.0?py=py33&pytest=2.5.0 UNKNOWN + `pytest-sugar-0.2.2 `_ `Teemu, Janne Vanhala `_ 374 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-sugar-0.2.2?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-sugar-0.2.2?py=py33&pytest=2.5.0 py.test plugin that adds instafail, ETA and neat graphics + `pytest-timeout-0.3 `_ `Floris Bruynooghe `_ 4514 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-timeout-0.3?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-timeout-0.3?py=py33&pytest=2.5.0 pytest plugin to abort tests after a timeout + `pytest-twisted-1.4 `_ `Ralf Schmitt `_ 257 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-twisted-1.4?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-twisted-1.4?py=py33&pytest=2.5.0 A twisted plugin for py.test. + `pytest-xdist-1.9 `_ `holger krekel and contributors `_ 8103 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xdist-1.9?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xdist-1.9?py=py33&pytest=2.5.0 py.test xdist plugin for distributed testing and loop-on-failing modes + `pytest-xprocess-0.8 `_ `Holger Krekel `_ 108 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xprocess-0.8?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xprocess-0.8?py=py33&pytest=2.5.0 pytest plugin to manage external processes across test runs + `pytest-yamlwsgi-0.6 `_ `Ali Afshar `_ 210 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-yamlwsgi-0.6?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-yamlwsgi-0.6?py=py33&pytest=2.5.0 Run tests against wsgi apps defined in yaml + `pytest-zap-0.1 `_ `Dave Hunt `_ 69 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-zap-0.1?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-zap-0.1?py=py33&pytest=2.5.0 OWASP ZAP plugin for py.test. ========================================================================================== ==================================================================================== ========= ====================================================================================================== ====================================================================================================== ============================================================================================================================================= *(Downloads are given from last month only)* -*(Updated on 2013-12-11)* +*(Updated on 2013-12-12)* diff --git a/doc/en/plugins_index/test_plugins_index.expected.txt b/doc/en/plugins_index/test_plugins_index.expected.txt new file mode 100644 index 000000000..a78c5cbe5 --- /dev/null +++ b/doc/en/plugins_index/test_plugins_index.expected.txt @@ -0,0 +1,16 @@ +.. _plugins_index: + +List of Third-Party Plugins +=========================== + +============================================ ============================= ========= ============================================================================================= ============================================================================================= =================== + Name Author Downloads Python 2.7 Python 3.3 Summary +============================================ ============================= ========= ============================================================================================= ============================================================================================= =================== + `pytest-plugin1-1.0 `_ `someone `_ 4 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin1-1.0?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin1-1.0?py=py33&pytest=2.5.0 some plugin + `pytest-plugin2-1.2 `_ `other `_ 40 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin2-1.2?py=py27&pytest=2.5.0 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin2-1.2?py=py33&pytest=2.5.0 some other plugin + +============================================ ============================= ========= ============================================================================================= ============================================================================================= =================== + +*(Downloads are given from last month only)* + +*(Updated on 2013-10-20)* diff --git a/doc/en/plugins_index/test_plugins_index.py b/doc/en/plugins_index/test_plugins_index.py index e357a5bb3..a51c5a139 100644 --- a/doc/en/plugins_index/test_plugins_index.py +++ b/doc/en/plugins_index/test_plugins_index.py @@ -53,45 +53,33 @@ def test_plugins_index(tmpdir, monkeypatch): 'downloads': {'last_day': 10, 'last_month': 40, 'last_week': 20}, }, } - return results[(package_name, version)] - monkeypatch.setattr(xmlrpclib, 'ServerProxy', DummyProxy, 'foo') monkeypatch.setattr(plugins_index, '_get_today_as_str', lambda: '2013-10-20') output_file = str(tmpdir.join('output.txt')) assert plugins_index.main(['', '-f', output_file, '-u', DummyProxy.expected_url]) == 0 - + with file(output_file, 'rU') as f: obtained_output = f.read() + expected_output = get_expected_output() if obtained_output != expected_output: - obtained_file = os.path.splitext(__file__)[0] + '.obtained' + obtained_file = os.path.splitext(__file__)[0] + '.obtained.txt' with file(obtained_file, 'w') as f: f.write(obtained_output) assert obtained_output == expected_output -expected_output = '''\ -.. _plugins_index: - -List of Third-Party Plugins -=========================== - -============================================ ============================= ========= ============================================================================================= ============================================================================================= =================== - Name Author Downloads Python 2.7 Python 3.3 Summary -============================================ ============================= ========= ============================================================================================= ============================================================================================= =================== - `pytest-plugin1-1.0 `_ `someone `_ 4 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin1-1.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin1-1.0?py=py33&pytest=2.4.2 some plugin - `pytest-plugin2-1.2 `_ `other `_ 40 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin2-1.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin2-1.2?py=py33&pytest=2.4.2 some other plugin - -============================================ ============================= ========= ============================================================================================= ============================================================================================= =================== - -*(Downloads are given from last month only)* - -*(Updated on 2013-10-20)* -''' +def get_expected_output(): + """ + :return: string with expected rst output from the plugins_index.py script. + """ + expected_filename = os.path.join(os.path.dirname(__file__), 'test_plugins_index.expected.txt') + expected_output = open(expected_filename, 'rU').read() + return expected_output.replace('pytest=2.X.Y', 'pytest={}'.format(pytest.__version__)) #=================================================================================================== From e843b028e654567af7171dc85a87d8dfda21fe23 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Fri, 13 Dec 2013 10:28:23 +0100 Subject: [PATCH 2/4] fix issue404 by more strict junitxml escape --- CHANGELOG | 5 +++++ _pytest/junitxml.py | 14 +++++++------- testing/test_junitxml.py | 14 +++++++++++++- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1b6db9259..6e4f40be1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +Unreleased +----------------------------------- + +- fix issue404 by always using the binary xml escape in the junitxml plugin + 2.5.0 ----------------------------------- diff --git a/_pytest/junitxml.py b/_pytest/junitxml.py index 550ae24fd..2d330870f 100644 --- a/_pytest/junitxml.py +++ b/_pytest/junitxml.py @@ -130,36 +130,36 @@ class LogXML(object): self.skipped += 1 else: fail = Junit.failure(message="test failure") - fail.append(unicode(report.longrepr)) + fail.append(bin_xml_escape(report.longrepr)) self.append(fail) self.failed += 1 self._write_captured_output(report) def append_collect_failure(self, report): #msg = str(report.longrepr.reprtraceback.extraline) - self.append(Junit.failure(unicode(report.longrepr), + self.append(Junit.failure(bin_xml_escape(report.longrepr), message="collection failure")) self.errors += 1 def append_collect_skipped(self, report): #msg = str(report.longrepr.reprtraceback.extraline) - self.append(Junit.skipped(unicode(report.longrepr), + self.append(Junit.skipped(bin_xml_escape(report.longrepr), message="collection skipped")) self.skipped += 1 def append_error(self, report): - self.append(Junit.error(unicode(report.longrepr), + self.append(Junit.error(bin_xml_escape(report.longrepr), message="test setup failure")) self.errors += 1 def append_skipped(self, report): if hasattr(report, "wasxfail"): - self.append(Junit.skipped(unicode(report.wasxfail), + self.append(Junit.skipped(bin_xml_escape(report.wasxfail), message="expected test failure")) else: filename, lineno, skipreason = report.longrepr if skipreason.startswith("Skipped: "): - skipreason = skipreason[9:] + skipreason = bin_xml_escape(skipreason[9:]) self.append( Junit.skipped("%s:%s: %s" % report.longrepr, type="pytest.skip", @@ -193,7 +193,7 @@ class LogXML(object): def pytest_internalerror(self, excrepr): self.errors += 1 - data = py.xml.escape(excrepr) + data = bin_xml_escape(excrepr) self.tests.append( Junit.testcase( Junit.error(data, message="internal error"), diff --git a/testing/test_junitxml.py b/testing/test_junitxml.py index 01e38b88c..57b5461c7 100644 --- a/testing/test_junitxml.py +++ b/testing/test_junitxml.py @@ -284,6 +284,19 @@ class TestPython: if not sys.platform.startswith("java"): assert "hx" in fnode.toxml() + def test_assertion_binchars(self, testdir): + """this test did fail when the escaping wasnt strict""" + testdir.makepyfile(""" + + M1 = '\x01\x02\x03\x04' + M2 = '\x01\x02\x03\x05' + + def test_str_compare(): + assert M1 == M2 + """) + result, dom = runandparse(testdir) + print dom.toxml() + def test_pass_captures_stdout(self, testdir): testdir.makepyfile(""" def test_pass(): @@ -392,7 +405,6 @@ def test_nullbyte_replace(testdir): text = xmlf.read() assert '#x0' in text - def test_invalid_xml_escape(): # Test some more invalid xml chars, the full range should be # tested really but let's just thest the edges of the ranges From 1b7c70eab49a56240a7e5a43cb3c5f3f850211a3 Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Sun, 15 Dec 2013 22:12:38 +0000 Subject: [PATCH 3/4] Do not use py2-only print, breaks py3 testruns --- testing/test_junitxml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/test_junitxml.py b/testing/test_junitxml.py index 57b5461c7..b7c115d8e 100644 --- a/testing/test_junitxml.py +++ b/testing/test_junitxml.py @@ -295,7 +295,7 @@ class TestPython: assert M1 == M2 """) result, dom = runandparse(testdir) - print dom.toxml() + # print dom.toxml() def test_pass_captures_stdout(self, testdir): testdir.makepyfile(""" From 0c737e3de0fa5f68f6f1a3300ce4ebad55bf45e7 Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Sun, 15 Dec 2013 22:15:15 +0000 Subject: [PATCH 4/4] Allow parameterised fixtures to give paramemter IDs This is just like the markers etc already can do. --- CHANGELOG | 3 +++ _pytest/python.py | 25 +++++++++++++++++-------- testing/python/fixture.py | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 6e4f40be1..588e28bbf 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,9 @@ Unreleased ----------------------------------- +- Allow parameterized fixtures to specify the ID of the parameters by + adding an ids argument to pytest.fixture() and pytest.yield_fixture(). + - fix issue404 by always using the binary xml escape in the junitxml plugin 2.5.0 diff --git a/_pytest/python.py b/_pytest/python.py index b437871a7..913a3079e 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -35,11 +35,13 @@ def getimfunc(func): class FixtureFunctionMarker: - def __init__(self, scope, params, autouse=False, yieldctx=False): + def __init__(self, scope, params, + autouse=False, yieldctx=False, ids=None): self.scope = scope self.params = params self.autouse = autouse self.yieldctx = yieldctx + self.ids = ids def __call__(self, function): if inspect.isclass(function): @@ -49,7 +51,7 @@ class FixtureFunctionMarker: return function -def fixture(scope="function", params=None, autouse=False): +def fixture(scope="function", params=None, autouse=False, ids=None): """ (return a) decorator to mark a fixture factory function. This decorator can be used (with or or without parameters) to define @@ -71,6 +73,10 @@ def fixture(scope="function", params=None, autouse=False): can see it. If False (the default) then an explicit reference is needed to activate the fixture. + :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. + """ if callable(scope) and params is None and autouse == False: # direct decoration @@ -78,9 +84,9 @@ def fixture(scope="function", params=None, autouse=False): "function", params, autouse)(scope) if params is not None and not isinstance(params, (list, tuple)): params = list(params) - return FixtureFunctionMarker(scope, params, autouse) + return FixtureFunctionMarker(scope, params, autouse, ids=ids) -def yield_fixture(scope="function", params=None, autouse=False): +def yield_fixture(scope="function", params=None, autouse=False, ids=None): """ (return a) decorator to mark a yield-fixture factory function (EXPERIMENTAL). @@ -94,7 +100,8 @@ def yield_fixture(scope="function", params=None, autouse=False): return FixtureFunctionMarker( "function", params, autouse, yieldctx=True)(scope) else: - return FixtureFunctionMarker(scope, params, autouse, yieldctx=True) + return FixtureFunctionMarker(scope, params, autouse, + yieldctx=True, ids=ids) defaultfuncargprefixmarker = fixture() @@ -1623,7 +1630,8 @@ class FixtureManager: for fixturedef in faclist: if fixturedef.params is not None: metafunc.parametrize(argname, fixturedef.params, - indirect=True, scope=fixturedef.scope) + indirect=True, scope=fixturedef.scope, + ids=fixturedef.ids) def pytest_collection_modifyitems(self, items): # separate parametrized setups @@ -1660,7 +1668,7 @@ class FixtureManager: fixturedef = FixtureDef(self, nodeid, name, obj, marker.scope, marker.params, yieldctx=marker.yieldctx, - unittest=unittest) + unittest=unittest, ids=marker.ids) faclist = self._arg2fixturedefs.setdefault(name, []) if fixturedef.has_location: faclist.append(fixturedef) @@ -1728,7 +1736,7 @@ def call_fixture_func(fixturefunc, request, kwargs, yieldctx): class FixtureDef: """ A container for a factory definition. """ def __init__(self, fixturemanager, baseid, argname, func, scope, params, - yieldctx, unittest=False): + yieldctx, unittest=False, ids=None): self._fixturemanager = fixturemanager self.baseid = baseid or '' self.has_location = baseid is not None @@ -1741,6 +1749,7 @@ class FixtureDef: self.argnames = getfuncargnames(func, startindex=startindex) self.yieldctx = yieldctx self.unittest = unittest + self.ids = ids self._finalizer = [] def addfinalizer(self, finalizer): diff --git a/testing/python/fixture.py b/testing/python/fixture.py index 60bbba342..79ae87cad 100644 --- a/testing/python/fixture.py +++ b/testing/python/fixture.py @@ -1989,6 +1989,40 @@ class TestFixtureMarker: reprec = testdir.inline_run() reprec.assertoutcome(passed=1) + def test_params_and_ids(self, testdir): + testdir.makepyfile(""" + import pytest + + @pytest.fixture(params=[object(), object()], + ids=['alpha', 'beta']) + def fix(request): + return request.param + + def test_foo(fix): + assert 1 + """) + res = testdir.runpytest('-v') + res.stdout.fnmatch_lines([ + '*test_foo*alpha*', + '*test_foo*beta*']) + + def test_params_and_ids_yieldfixture(self, testdir): + testdir.makepyfile(""" + import pytest + + @pytest.yield_fixture(params=[object(), object()], + ids=['alpha', 'beta']) + def fix(request): + yield request.param + + def test_foo(fix): + assert 1 + """) + res = testdir.runpytest('-v') + res.stdout.fnmatch_lines([ + '*test_foo*alpha*', + '*test_foo*beta*']) + class TestRequestScopeAccess: pytestmark = pytest.mark.parametrize(("scope", "ok", "error"),[