Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from plone/move-to-p-a-testing
Set up plone.app.testing
- Loading branch information
Showing
4 changed files
with
84 additions
and
129 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# -*- coding: utf-8 -*- | ||
from plone.app.testing import PLONE_FIXTURE | ||
from plone.app.testing import IntegrationTesting | ||
from plone.testing import Layer | ||
from zope.configuration import xmlconfig | ||
|
||
import doctest | ||
|
||
|
||
class PloneAppViewletmanagerLayer(Layer): | ||
|
||
defaultBases = (PLONE_FIXTURE, ) | ||
|
||
def setUpZope(self, app, configurationContext): | ||
# Load ZCML | ||
import plone.app.viewletmanager | ||
xmlconfig.file( | ||
'configure.zcml', | ||
plone.app.viewletmanager, | ||
context=configurationContext | ||
) | ||
|
||
|
||
PLONE_APP_VIEWLETMANAGER_FIXTURE = PloneAppViewletmanagerLayer() | ||
PLONE_APP_VIEWLETMANAGER_INTEGRATION_TESTING = IntegrationTesting( | ||
bases=(PLONE_APP_VIEWLETMANAGER_FIXTURE, ), | ||
name='PloneAppViewletmanagerLayer:Integration' | ||
) | ||
|
||
optionflags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS |
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 |
---|---|---|
@@ -1,27 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
from zope.testing import doctest | ||
from zope.testing.doctestunit import DocFileSuite | ||
from plone.app.viewletmanager.testing import optionflags | ||
|
||
import zope.component.testing | ||
import doctest | ||
import unittest | ||
|
||
|
||
def tearDown(test): | ||
zope.component.testing.tearDown(test) | ||
doc_tests = [ | ||
'storage.rst', | ||
'manager.rst', | ||
] | ||
|
||
|
||
def test_suite(): | ||
from unittest import TestSuite | ||
suite = TestSuite() | ||
suite.addTests(( | ||
DocFileSuite( | ||
'storage.rst', | ||
tearDown=tearDown, | ||
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS, | ||
), | ||
DocFileSuite( | ||
'manager.rst', | ||
tearDown=tearDown, | ||
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS, | ||
), | ||
)) | ||
suite = unittest.TestSuite() | ||
suite.addTests([ | ||
doctest.DocFileSuite( | ||
'tests/{0}'.format(doc_file), | ||
package='plone.app.viewletmanager', | ||
optionflags=optionflags | ||
) | ||
for doc_file in doc_tests | ||
]) | ||
|
||
return suite |
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