From 7b654a8c180a6467147189332916a5e56634b5af Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 14 Nov 2012 09:46:53 +0100 Subject: testtools: Update to latest version. --- lib/testtools/doc/for-framework-folk.rst | 8 ++++++++ lib/testtools/doc/for-test-authors.rst | 21 +++++++++++++++++++++ lib/testtools/doc/hacking.rst | 9 ++++----- lib/testtools/doc/index.rst | 5 ++++- lib/testtools/doc/overview.rst | 10 ++++++++-- 5 files changed, 45 insertions(+), 8 deletions(-) (limited to 'lib/testtools/doc') diff --git a/lib/testtools/doc/for-framework-folk.rst b/lib/testtools/doc/for-framework-folk.rst index a4b20f64ca..ff9e71e71e 100644 --- a/lib/testtools/doc/for-framework-folk.rst +++ b/lib/testtools/doc/for-framework-folk.rst @@ -151,6 +151,14 @@ Each of the methods on ``MultiTestResult`` will return a tuple of whatever the component test results return. +TestResultDecorator +------------------- + +Not strictly a ``TestResult``, but something that implements the extended +``TestResult`` interface of testtools. It can be subclassed to create objects +that wrap ``TestResults``. + + TextTestResult -------------- diff --git a/lib/testtools/doc/for-test-authors.rst b/lib/testtools/doc/for-test-authors.rst index febbb84151..b83221bd5d 100644 --- a/lib/testtools/doc/for-test-authors.rst +++ b/lib/testtools/doc/for-test-authors.rst @@ -1322,6 +1322,27 @@ Safe attribute testing particular attribute. +Nullary callables +----------------- + +Sometimes you want to be able to pass around a function with the arguments +already specified. The normal way of doing this in Python is:: + + nullary = lambda: f(*args, **kwargs) + nullary() + +Which is mostly good enough, but loses a bit of debugging information. If you +take the ``repr()`` of ``nullary``, you're only told that it's a lambda, and +you get none of the juicy meaning that you'd get from the ``repr()`` of ``f``. + +The solution is to use ``Nullary`` instead:: + + nullary = Nullary(f, *args, **kwargs) + nullary() + +Here, ``repr(nullary)`` will be the same as ``repr(f)``. + + .. _testrepository: https://launchpad.net/testrepository .. _Trial: http://twistedmatrix.com/documents/current/core/howto/testing.html .. _nose: http://somethingaboutorange.com/mrl/projects/nose/ diff --git a/lib/testtools/doc/hacking.rst b/lib/testtools/doc/hacking.rst index fa67887abd..663eeace3c 100644 --- a/lib/testtools/doc/hacking.rst +++ b/lib/testtools/doc/hacking.rst @@ -8,9 +8,7 @@ Coding style In general, follow `PEP 8`_ except where consistency with the standard library's unittest_ module would suggest otherwise. -testtools supports Python 2.4 and later, including Python 3, so avoid any -2.5-only features like the ``with`` statement. - +testtools currently supports Python 2.6 and later, including Python 3. Copyright assignment -------------------- @@ -141,8 +139,9 @@ Release tasks #. Marks all the Fix Committed bugs as Fix Released #. Creates a new milestone #. Merge the release branch testtools-X.Y.Z into trunk. Before the commit, - add a NEXT heading to the top of NEWS and bump the version in __init__.py. - Push trunk to Launchpad + add a NEXT heading to the top of NEWS and bump the version in __init__.py + e.g. to ``(X, Y, Z+1, 'dev', 0)``. +#. Push trunk to Launchpad #. If a new series has been created (e.g. 0.10.0), make the series on Launchpad. .. _PEP 8: http://www.python.org/dev/peps/pep-0008/ diff --git a/lib/testtools/doc/index.rst b/lib/testtools/doc/index.rst index 4687cebb62..bac47e4379 100644 --- a/lib/testtools/doc/index.rst +++ b/lib/testtools/doc/index.rst @@ -9,7 +9,10 @@ testtools: tasteful testing for Python testtools is a set of extensions to the Python standard library's unit testing framework. These extensions have been derived from many years of experience with unit testing in Python and come from many different sources. testtools -also ports recent unittest changes all the way back to Python 2.4. +also ports recent unittest changes all the way back to Python 2.4. The next +release of testtools will change that to support versions that are maintained +by the Python community instead, to allow the use of modern language features +within testtools. Contents: diff --git a/lib/testtools/doc/overview.rst b/lib/testtools/doc/overview.rst index e43265fd1e..cb72893c8b 100644 --- a/lib/testtools/doc/overview.rst +++ b/lib/testtools/doc/overview.rst @@ -5,7 +5,10 @@ testtools: tasteful testing for Python testtools is a set of extensions to the Python standard library's unit testing framework. These extensions have been derived from many years of experience with unit testing in Python and come from many different sources. testtools -also ports recent unittest changes all the way back to Python 2.4. +supports Python versions all the way back to Python 2.4. The next release of +testtools will change that to support versions that are maintained by the +Python community instead, to allow the use of modern language features within +testtools. What better way to start than with a contrived code snippet?:: @@ -93,4 +96,7 @@ Cross-Python compatibility -------------------------- testtools gives you the very latest in unit testing technology in a way that -will work with Python 2.4, 2.5, 2.6, 2.7 and 3.1. +will work with Python 2.6, 2.7 and 3.1. + +If you wish to use testtools with Python 2.4 or 2.5, then please use testtools +0.9.15. -- cgit