Run functional tests only with Plone 4 (and plone.testing).
svn path=/plone.app.discussion/trunk/; revision=40537
This commit is contained in:
parent
94584429fd
commit
43d3222086
@ -1,12 +1,23 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""Functional Doctests for plone.app.discussion.
|
||||||
|
|
||||||
|
These test are only triggered when Plone 4 (and plone.testing) is installed.
|
||||||
|
"""
|
||||||
import doctest
|
import doctest
|
||||||
import unittest2 as unittest
|
|
||||||
import pprint
|
|
||||||
import interlude
|
|
||||||
|
|
||||||
from plone.testing import layered
|
try:
|
||||||
|
import unittest2 as unittest
|
||||||
|
import pprint
|
||||||
|
import interlude
|
||||||
|
|
||||||
from plone.app.discussion.testing import \
|
from plone.testing import layered
|
||||||
PLONE_APP_DISCUSSION_FUNCTIONAL_TESTING
|
|
||||||
|
from plone.app.discussion.testing import \
|
||||||
|
PLONE_APP_DISCUSSION_FUNCTIONAL_TESTING
|
||||||
|
PLONE4 = True
|
||||||
|
except:
|
||||||
|
import unittest
|
||||||
|
PLONE4 = False
|
||||||
|
|
||||||
optionflags = (doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_ONLY_FIRST_FAILURE)
|
optionflags = (doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_ONLY_FIRST_FAILURE)
|
||||||
normal_testfiles = [
|
normal_testfiles = [
|
||||||
@ -14,15 +25,25 @@ normal_testfiles = [
|
|||||||
'functional_test_comment_review_workflow.txt'
|
'functional_test_comment_review_workflow.txt'
|
||||||
]
|
]
|
||||||
|
|
||||||
def test_suite():
|
if PLONE4:
|
||||||
suite = unittest.TestSuite()
|
|
||||||
suite.addTests([
|
def test_suite():
|
||||||
layered(doctest.DocFileSuite(test ,
|
suite = unittest.TestSuite()
|
||||||
optionflags=optionflags,
|
suite.addTests([
|
||||||
globs={'interact': interlude.interact,
|
layered(doctest.DocFileSuite(test ,
|
||||||
'pprint': pprint.pprint,
|
optionflags=optionflags,
|
||||||
}
|
globs={'interact': interlude.interact,
|
||||||
),
|
'pprint': pprint.pprint,
|
||||||
layer=PLONE_APP_DISCUSSION_FUNCTIONAL_TESTING)
|
}
|
||||||
for test in normal_testfiles])
|
),
|
||||||
return suite
|
layer=PLONE_APP_DISCUSSION_FUNCTIONAL_TESTING)
|
||||||
|
for test in normal_testfiles])
|
||||||
|
return suite
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
def test_suite():
|
||||||
|
return unittest.TestSuite([])
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main(defaultTest='test_suite')
|
||||||
|
Loading…
Reference in New Issue
Block a user