Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python.announce > #407

pytest-2.2.0: test marking++, parametrization++ and duration profiling

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <holger@merlinux.eu>
X-Original-To python-announce-list@python.org
Delivered-To python-announce-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'bug': 0.02; '"if': 0.04; 'fixes': 0.05; 'subject:test': 0.05; 'apis': 0.07; 'cleanup': 0.07; 'marking': 0.07; 'suite.': 0.07; 'unexpected': 0.07; '"just"': 0.09; 'decorator': 0.09; 'exceptions': 0.09; 'failing': 0.09; 'holger': 0.09; 'received:eu': 0.09; 'reports.': 0.09; 'slowest': 0.09; 'upgrades.': 0.09; 'api': 0.09; 'examples': 0.11; 'jeff': 0.13; 'argument': 0.15; '2.1.3': 0.16; '2.2.0': 0.16; 'already.': 0.16; 'doctest': 0.16; 'earlier.': 0.16; 'optimizing': 0.16; 'predictable': 0.16; 'runs.': 0.16; 'scenarios': 0.16; 'stricter': 0.16; 'subject: \n ': 0.16; 'skip:= 70': 0.17; 'arguments': 0.18; 'checked': 0.20; 'compatible': 0.21; 'calls.': 0.23; 'helper': 0.23; 'performs': 0.23; 'skip:` 20': 0.23; 'testing': 0.24; 'besides': 0.24; 'code': 0.25; 'tests': 0.25; 'ignore': 0.25; 'function': 0.27; '(this': 0.28; 'described': 0.28; 'bit': 0.28; 'matches': 0.28; 'fix': 0.29; 'module': 0.30; 'distributing': 0.30; 'email name:': 0.30; 'tool.': 0.30; 'example': 0.30; 'reporting': 0.30; 'error': 0.31; 'thanks': 0.31; 'version': 0.31; 'values': 0.31; 'cases': 0.32; 'changes': 0.32; 'handling': 0.32; 'implement': 0.32; 'list': 0.32; 'skip:- 30': 0.32; 'there': 0.33; 'calling': 0.33; 'header:User-Agent:1': 0.33; 'rules': 0.33; 'daniel': 0.34; 'fail': 0.34; 'showing': 0.34; 'install': 0.34; 'test': 0.34; 'probably': 0.34; 'registering': 0.34; 'test.': 0.34; 'usual': 0.34; 'david': 0.34; 'notes': 0.35; 'project': 0.35; 'something': 0.36; 'useful': 0.36; 'skip:" 10': 0.36; 'charset:us-ascii': 0.36; 'subject:skip:p 10': 0.36; 'to:addr:python-announce-list': 0.36; 'skip:- 40': 0.37; 'using': 0.37; 'eager': 0.38; 'allows': 0.38; 'run': 0.38; 'easier': 0.38; 'called': 0.38; 'url:org': 0.38; 'option': 0.38; 'should': 0.39; 'help': 0.39; 'mark': 0.39; 'subject:: ': 0.39; 'change': 0.39; 'might': 0.39; 'to:addr:python.org': 0.39; 'release': 0.40; 'port': 0.40; 'more': 0.60; 'to:2**2': 0.60; 'according': 0.60; 'easily': 0.60; 'your': 0.61; 'choose': 0.61; 'link': 0.63; 'ready': 0.65; 'information,': 0.66; 'here:': 0.66; 'introduce': 0.80; 'bails': 0.84; 'easy_install': 0.84; 'fixture': 0.84; 'hook': 0.84; 'leak': 0.84; 'markers': 0.84; 'phases': 0.84; 'profiling': 0.84; 'received:85.25': 0.84; 'refined': 0.84; 'typos': 0.84; 'unregistered': 0.84; 'url:example': 0.84; 'plugins': 0.91; 'releases.': 0.91
Date Fri, 18 Nov 2011 19:10:07 +0000
From holger krekel <holger@merlinux.eu>
To Testing in Python <testing-in-python@lists.idyll.org>, py-dev@codespeak.net, python announce <python-announce-list@python.org>
Subject pytest-2.2.0: test marking++, parametrization++ and duration profiling
Mail-Followup-To holger krekel <holger@merlinux.eu>, Testing in Python <testing-in-python@lists.idyll.org>, py-dev@codespeak.net, python announce <python-announce-list@python.org>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.20 (2009-06-14)
X-Mailman-Approved-At Sat, 19 Nov 2011 16:38:18 +0100
X-BeenThere python-announce-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To python-list@python.org
List-Id Announcement-only list for the Python programming language <python-announce-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-announce-list>, <mailto:python-announce-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-announce-list>
List-Post <mailto:python-announce-list@python.org>
List-Help <mailto:python-announce-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-announce-list>, <mailto:python-announce-list-request@python.org?subject=subscribe>
Approved python-announce-list@python.org
Newsgroups comp.lang.python.announce
Message-ID <mailman.2848.1321717100.27778.python-announce-list@python.org> (permalink)
Lines 96
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1321717100 news.xs4all.nl 6886 [2001:888:2000:d::a6]:53673
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python.announce:407

Show key headers only | View raw


py.test 2.2.0: test marking++, parametrization++ and duration profiling
===========================================================================

pytest-2.2.0 is a test-suite compatible release of the popular
py.test testing tool.  Plugins might need upgrades. It comes 
with these improvements:

* easier and more powerful parametrization of tests:

  - new @pytest.mark.parametrize decorator to run tests with different arguments
  - new metafunc.parametrize() API for parametrizing arguments independently
  - see examples at http://pytest.org/latest/example/parametrize.html
  - NOTE that parametrize() related APIs are still a bit experimental
    and might change in future releases.

* improved handling of test markers and refined marking mechanism:

  - "-m markexpr" option for selecting tests according to their mark
  - a new "markers" ini-variable for registering test markers for your project
  - the new "--strict" bails out with an error if using unregistered markers.
  - see examples at http://pytest.org/latest/example/markers.html

* duration profiling: new "--duration=N" option showing the N slowest test 
  execution or setup/teardown calls. This is most useful if you want to
  find out where your slowest test code is.

* also 2.2.0 performs more eager calling of teardown/finalizers functions 
  resulting in better and more accurate reporting when they fail

Besides there is the usual set of bug fixes along with a cleanup of
pytest's own test suite allowing it to run on a wider range of environments.

For general information, see extensive docs with examples here:

     http://pytest.org/

If you want to install or upgrade pytest you might just type::

    pip install -U pytest # or
    easy_install -U pytest

Thanks to Ronny Pfannschmidt, David Burns, Jeff Donner, Daniel Nouri,
Alfredo Doza and all who gave feedback or sent bug reports.

best,
holger krekel


notes on incompatibility
------------------------------

While test suites should work unchanged you might need to upgrade plugins:

* You need a new version of the pytest-xdist plugin (1.7) for distributing 
  test runs.  

* Other plugins might need an upgrade if they implement
  the ``pytest_runtest_logreport`` hook which now is called unconditionally
  for the setup/teardown fixture phases of a test. You may choose to
  ignore setup/teardown failures by inserting "if rep.when != 'call': return"
  or something similar. Note that most code probably "just" works because 
  the hook was already called for failing setup/teardown phases of a test
  so a plugin should have been ready to grok such reports already.


Changes between 2.1.3 and 2.2.0
----------------------------------------

- fix issue90: introduce eager tearing down of test items so that
  teardown function are called earlier.
- add an all-powerful metafunc.parametrize function which allows to 
  parametrize test function arguments in multiple steps and therefore
  from indepdenent plugins and palces. 
- add a @pytest.mark.parametrize helper which allows to easily
  call a test function with different argument values
- Add examples to the "parametrize" example page, including a quick port 
  of Test scenarios and the new parametrize function and decorator.
- introduce registration for "pytest.mark.*" helpers via ini-files
  or through plugin hooks.  Also introduce a "--strict" option which 
  will treat unregistered markers as errors
  allowing to avoid typos and maintain a well described set of markers
  for your test suite.  See exaples at http://pytest.org/latest/mark.html
  and its links.
- issue50: introduce "-m marker" option to select tests based on markers
  (this is a stricter and more predictable version of '-k' in that "-m"
  only matches complete markers and has more obvious rules for and/or
  semantics.
- new feature to help optimizing the speed of your tests: 
  --durations=N option for displaying N slowest test calls 
  and setup/teardown methods.
- fix issue87: --pastebin now works with python3
- fix issue89: --pdb with unexpected exceptions in doctest work more sensibly
- fix and cleanup pytest's own test suite to not leak FDs 
- fix issue83: link to generated funcarg list
- fix issue74: pyarg module names are now checked against imp.find_module false positives
- fix compatibility with twisted/trial-11.1.0 use cases

Back to comp.lang.python.announce | Previous | Next | Find similar | Unroll thread


Thread

pytest-2.2.0: test marking++, parametrization++ and duration profiling holger krekel <holger@merlinux.eu> - 2011-11-18 19:10 +0000

csiph-web