Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
r27323 | jim | 2004-08-28 15:31:22 -0400 (Sat, 28 Aug 2004) | 15 lines Integrated the latest doctest rom the Python cvs. This brought two backward-incompatible changes: - setUp and tearDown functions are now passed a test argument, which is a doctest.DocTest. This provides access to the test globals. - The names of doctest reporting options for requesting diff output have changed. Thesechanges are both positive for the long run, despite the short-term backward-incompatability. Better before X3.0 final than later.
- Loading branch information
Jim Fulton
committed
Aug 28, 2004
1 parent
3ee7eed
commit 0ac1d35
Showing
8 changed files
with
135 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
############################################################################## | ||
# | ||
# Copyright (c) 2004 Zope Corporation and Contributors. | ||
# All Rights Reserved. | ||
# | ||
# This software is subject to the provisions of the Zope Public License, | ||
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. | ||
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED | ||
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS | ||
# FOR A PARTICULAR PURPOSE. | ||
# | ||
############################################################################## | ||
"""Tests for the Service Documentation Module | ||
$Id$ | ||
""" | ||
import unittest | ||
from zope.testing.doctestunit import DocTestSuite | ||
from zope.app.tests import placelesssetup, ztapi | ||
|
||
from zope.app.tree.interfaces import IUniqueId | ||
from zope.app.tree.adapters import LocationUniqueId | ||
|
||
from zope.app.traversing.interfaces import IPhysicallyLocatable | ||
from zope.app.location.traversing import LocationPhysicallyLocatable | ||
|
||
def setUp(test): | ||
placelesssetup.setUp() | ||
ztapi.provideAdapter(None, IUniqueId, LocationUniqueId) | ||
ztapi.provideAdapter(None, IPhysicallyLocatable, | ||
LocationPhysicallyLocatable) | ||
|
||
def test_suite(): | ||
return unittest.TestSuite(( | ||
DocTestSuite('zope.app.apidoc.servicemodule'), | ||
DocTestSuite('zope.app.apidoc.servicemodule.browser', | ||
setUp=setUp, tearDown=placelesssetup.tearDown), | ||
)) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
############################################################################## | ||
# | ||
# Copyright (c) 2004 Zope Corporation and Contributors. | ||
# All Rights Reserved. | ||
# | ||
# This software is subject to the provisions of the Zope Public License, | ||
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. | ||
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED | ||
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS | ||
# FOR A PARTICULAR PURPOSE. | ||
# | ||
############################################################################## | ||
"""Tests for the Utility Documentation Module | ||
$Id$ | ||
""" | ||
import unittest | ||
|
||
from zope.interface import implements | ||
from zope.publisher.browser import TestRequest | ||
from zope.testing.doctestunit import DocTestSuite | ||
|
||
from zope.app import zapi | ||
from zope.app.tests import placelesssetup, ztapi | ||
|
||
from zope.app.apidoc.interfaces import IDocumentationModule | ||
from zope.app.apidoc.tests import Root | ||
from zope.app.apidoc.ifacemodule import InterfaceModule | ||
from zope.app.apidoc.classmodule import ClassModule | ||
from zope.app.apidoc.utilitymodule import UtilityModule, Utility | ||
from browser import UtilityDetails | ||
|
||
from zope.app.tree.interfaces import IUniqueId | ||
from zope.app.tree.adapters import LocationUniqueId | ||
|
||
from zope.app.traversing.interfaces import IPhysicallyLocatable | ||
from zope.app.location.traversing import LocationPhysicallyLocatable | ||
|
||
|
||
def setUp(test): | ||
placelesssetup.setUp() | ||
service = zapi.getGlobalService('Utilities') | ||
service.provideUtility(IDocumentationModule, InterfaceModule(), '') | ||
service.provideUtility(IDocumentationModule, ClassModule(), 'Classes') | ||
|
||
ztapi.provideAdapter(None, IUniqueId, LocationUniqueId) | ||
ztapi.provideAdapter(None, IPhysicallyLocatable, | ||
LocationPhysicallyLocatable) | ||
|
||
|
||
def makeRegistration(name, interface, component): | ||
return type('RegistrationStub', (), | ||
{'name': name, 'provided': interface, | ||
'component': component, 'doc': ''})() | ||
|
||
def getDetailsView(): | ||
utils = UtilityModule() | ||
utils.__parent__ = Root | ||
utils.__name__ = 'Utility' | ||
util = Utility( | ||
utils, | ||
makeRegistration('Classes', IDocumentationModule, ClassModule())) | ||
details = UtilityDetails() | ||
details.context = util | ||
details.request = TestRequest() | ||
return details | ||
|
||
def test_suite(): | ||
return unittest.TestSuite(( | ||
DocTestSuite('zope.app.apidoc.utilitymodule', | ||
setUp=setUp, tearDown=placelesssetup.tearDown), | ||
DocTestSuite('zope.app.apidoc.utilitymodule.browser', | ||
setUp=setUp, tearDown=placelesssetup.tearDown), | ||
)) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters