diff options
author | Robert Collins <robertc@robertcollins.net> | 2013-08-16 12:50:14 +1200 |
---|---|---|
committer | Robert Collins <robertc@robertcollins.net> | 2013-08-16 12:50:14 +1200 |
commit | 9659b22fcc17420abaa946125e1c723c377fc46e (patch) | |
tree | 0b13908ff41771c5da731cfeedf50722acc64e6b | |
parent | 1ff98c654ba833d9dc2a442c7d3bce7c800d6958 (diff) | |
download | fixtures-9659b22fcc17420abaa946125e1c723c377fc46e.tar.gz |
* Documentation hopefully covers ``TestWithFixtures`` a little better.
(Robert Collins, #1102688)
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | README | 5 | ||||
-rw-r--r-- | lib/fixtures/testcase.py | 3 |
3 files changed, 10 insertions, 1 deletions
@@ -9,6 +9,9 @@ NEXT CHANGES ------- +* Documentation hopefully covers ``TestWithFixtures`` a little better. + (Robert Collins, #1102688) + * ``FakePopen`` now accepts all the parameters available in Python 2.7. (Robert Collins) @@ -173,7 +173,10 @@ cleanup, and return the fixture. This lets one write:: >>> import unittest Note that we use testtools TestCase here as we need to guarantee a -TestCase.addCleanup method. +TestCase.addCleanup method in this doctest. Unittest2 - Python2.7 and above - +also have ``addCleanup``. testtools has it's own implementation of +``useFixture`` so there is no need to use ``fixtures.TestWithFixtures`` with +``testtools.TestCase``. >>> class NoddyTest(testtools.TestCase, fixtures.TestWithFixtures): ... def test_example(self): diff --git a/lib/fixtures/testcase.py b/lib/fixtures/testcase.py index 6a84ddf..1d6a85c 100644 --- a/lib/fixtures/testcase.py +++ b/lib/fixtures/testcase.py @@ -26,6 +26,9 @@ class TestWithFixtures(unittest.TestCase): """A TestCase with a helper function to use fixtures. Normally used as a mix-in class to add useFixture. + + Note that test classes such as testtools.TestCase which already have a + ``useFixture`` method do not need this mixed in. """ def useFixture(self, fixture): |