Skip to content
This repository has been archived by the owner on May 15, 2020. It is now read-only.

Commit

Permalink
Skip some tests if zope.app.testing not working.
Browse files Browse the repository at this point in the history
With Python3 and missing working zope.app.testing we can (and should)
run other tests, but we can skip those tests that are clearly geared
towards accessibility of a working zope.app.testing. These are mainly
the functional tests.

Most tests still fail under Python3 and will have to be separated in
functional and not-functional tests.
  • Loading branch information
ulif committed May 7, 2015
1 parent 2f645a0 commit 22a61ca
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/z3c/testsetup/tests/test_testsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import re
import sys
import gc
import warnings
import unittest
from zope.testing import cleanup, renormalizing
import zope.component.eventtesting
from z3c.testsetup.util import get_package
from z3c.testsetup.util import get_package, got_working_zope_app_testing


TESTFILES = ['basicsetup.txt',
os.path.join('functional', 'functionaldoctestsetup.txt'),
'pythontestsetup.txt',
'unitdoctestsetup.txt',
'util.txt',
Expand All @@ -20,6 +20,12 @@
]


FUNCTIONAL_TESTFILES = [
# These tests make only sense with a working zope.app.testing installed
os.path.join('functional', 'functionaldoctestsetup.txt'),
]


checker = renormalizing.RENormalizing([
# Relevant normalizers from zope.testing.testrunner.tests:
(re.compile(r'(\d minutes )?\d+[.]\d\d\d seconds'), 'N.NNN seconds'),
Expand Down Expand Up @@ -187,6 +193,15 @@ def test_suite():
suite = unittest.TestSuite()
for name in TESTFILES:
suite.addTest(suiteFromFile(name))
if got_working_zope_app_testing():
for name in FUNCTIONAL_TESTFILES:
suite.addTest(suiteFromFile(name))
else:
message = (
"Skipped the following tests due to missing "
"usable `zope.app.testing` package: %s" % FUNCTIONAL_TESTFILES
)
warnings.warn(message)
suite.addTest(testrunner_suite())
suite.addTest(zopeapptestingless_suite())
return suite

0 comments on commit 22a61ca

Please sign in to comment.