2010-10-06 17:12:11 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""Functional Doctests for plone.app.discussion.
|
2010-09-28 18:35:45 +02:00
|
|
|
|
2010-10-06 17:12:11 +02:00
|
|
|
These test are only triggered when Plone 4 (and plone.testing) is installed.
|
|
|
|
"""
|
|
|
|
import doctest
|
2010-09-28 18:35:45 +02:00
|
|
|
|
2010-10-06 17:12:11 +02:00
|
|
|
try:
|
|
|
|
import unittest2 as unittest
|
|
|
|
import pprint
|
|
|
|
import interlude
|
2010-12-16 00:52:56 +01:00
|
|
|
|
2010-10-06 17:12:11 +02:00
|
|
|
from plone.testing import layered
|
2010-12-16 00:52:56 +01:00
|
|
|
|
2010-10-06 17:12:11 +02:00
|
|
|
from plone.app.discussion.testing import \
|
|
|
|
PLONE_APP_DISCUSSION_FUNCTIONAL_TESTING
|
|
|
|
PLONE4 = True
|
|
|
|
except:
|
|
|
|
import unittest
|
|
|
|
PLONE4 = False
|
2010-09-28 18:35:45 +02:00
|
|
|
|
|
|
|
optionflags = (doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE | doctest.REPORT_ONLY_FIRST_FAILURE)
|
|
|
|
normal_testfiles = [
|
2010-10-06 15:52:11 +02:00
|
|
|
'functional_test_comments.txt',
|
|
|
|
'functional_test_comment_review_workflow.txt'
|
2010-09-28 18:35:45 +02:00
|
|
|
]
|
|
|
|
|
2010-10-06 17:12:11 +02:00
|
|
|
if PLONE4:
|
2010-12-16 00:52:56 +01:00
|
|
|
|
2010-10-06 17:12:11 +02:00
|
|
|
def test_suite():
|
|
|
|
suite = unittest.TestSuite()
|
|
|
|
suite.addTests([
|
|
|
|
layered(doctest.DocFileSuite(test ,
|
|
|
|
optionflags=optionflags,
|
|
|
|
globs={'interact': interlude.interact,
|
|
|
|
'pprint': pprint.pprint,
|
|
|
|
}
|
|
|
|
),
|
|
|
|
layer=PLONE_APP_DISCUSSION_FUNCTIONAL_TESTING)
|
|
|
|
for test in normal_testfiles])
|
|
|
|
return suite
|
|
|
|
|
|
|
|
else:
|
2010-12-16 00:52:56 +01:00
|
|
|
|
2010-10-06 17:12:11 +02:00
|
|
|
def test_suite():
|
|
|
|
return unittest.TestSuite([])
|
2010-12-16 00:52:56 +01:00
|
|
|
|
2010-10-06 17:12:11 +02:00
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main(defaultTest='test_suite')
|