diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-05-05 01:24:25 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-05-05 01:24:25 +0000 |
| commit | 589b98b13bfe41a805f367c4d29b986f1575c153 (patch) | |
| tree | c47aedb50b96229facfb80bf72067cc7748919d8 /docs | |
| parent | db2e0b36898ec22270e8d538ae810e8ed14237cc (diff) | |
| download | pyramid-589b98b13bfe41a805f367c4d29b986f1575c153.tar.gz pyramid-589b98b13bfe41a805f367c4d29b986f1575c153.tar.bz2 pyramid-589b98b13bfe41a805f367c4d29b986f1575c153.zip | |
- Applications which rely on ``zope.testing.cleanup.cleanUp` in unit
tests can still use that function indefinitely. However, for
maximum forward compatibility, they should import ``cleanUp`` from
``repoze.bfg.testing`` instead of from ``zope.testing.cleanup``.
The BFG paster templates and docs have been changed to use this
function instead of the ``zope.testing.cleanup`` version.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/narr/MyProject/myproject/tests.py | 9 | ||||
| -rw-r--r-- | docs/narr/unittesting.rst | 7 |
2 files changed, 7 insertions, 9 deletions
diff --git a/docs/narr/MyProject/myproject/tests.py b/docs/narr/MyProject/myproject/tests.py index 4e0b2f8f4..6f287c02b 100644 --- a/docs/narr/MyProject/myproject/tests.py +++ b/docs/narr/MyProject/myproject/tests.py @@ -1,6 +1,5 @@ import unittest -from zope.testing.cleanup import cleanUp from repoze.bfg import testing class ViewTests(unittest.TestCase): @@ -14,13 +13,13 @@ class ViewTests(unittest.TestCase): """ cleanUp() is required to clear out the application registry between tests (done in setUp for good measure too) """ - cleanUp() + testing.cleanUp() def tearDown(self): """ cleanUp() is required to clear out the application registry between tests """ - cleanUp() + testing.cleanUp() def test_my_view(self): from myproject.views import my_view @@ -48,7 +47,7 @@ class ViewIntegrationTests(unittest.TestCase): registrations your application declares in its configure.zcml (including dependent registrations for repoze.bfg itself). """ - cleanUp() + testing.cleanUp() import myproject import zope.configuration.xmlconfig zope.configuration.xmlconfig.file('configure.zcml', @@ -56,7 +55,7 @@ class ViewIntegrationTests(unittest.TestCase): def tearDown(self): """ Clear out the application registry """ - cleanUp() + testing.cleanUp() def test_my_view(self): from myproject.views import my_view diff --git a/docs/narr/unittesting.rst b/docs/narr/unittesting.rst index 34a0740e9..a0d2b551b 100644 --- a/docs/narr/unittesting.rst +++ b/docs/narr/unittesting.rst @@ -46,15 +46,14 @@ unittest TestCase that used the testing API. :linenos: import unittest - from zope.testing.cleanup import cleanUp from repoze.bfg import testing class MyTest(unittest.TestCase): def setUp(self): - cleanUp() + testing.cleanUp() def tearDown(self): - cleanUp() + testing.cleanUp() def test_view_fn_not_submitted(self): from my.package import view_fn @@ -106,7 +105,7 @@ assertion. We assert at the end of this that the renderer's ``say`` attribute is ``Yo``, as this is what is expected of the view function in the branch it's testing. -Note that the test calls the ``zope.testing.cleanup.cleanUp`` function +Note that the test calls the ``repoze.bfg.testing.cleanUp`` function in its ``setUp`` and ``tearDown`` functions. This is required to perform cleanup between the test runs. If you use any of the testing API, be sure to call this function at setup and teardown of individual |
