Run functional tests only with Plone 4 (and plone.testing).

svn path=/plone.app.discussion/trunk/; revision=40537
This commit is contained in:
Timo Stollenwerk 2010-10-06 15:12:11 +00:00
parent 94584429fd
commit 43d3222086
1 changed files with 40 additions and 19 deletions

View File

@ -1,4 +1,11 @@
# -*- coding: utf-8 -*-
"""Functional Doctests for plone.app.discussion.
These test are only triggered when Plone 4 (and plone.testing) is installed.
"""
import doctest
try:
import unittest2 as unittest
import pprint
import interlude
@ -7,6 +14,10 @@ from plone.testing import layered
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)
normal_testfiles = [
@ -14,6 +25,8 @@ normal_testfiles = [
'functional_test_comment_review_workflow.txt'
]
if PLONE4:
def test_suite():
suite = unittest.TestSuite()
suite.addTests([
@ -26,3 +39,11 @@ def test_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')