[Checkins] SVN: z3c.testsetup/branches/reinout-teardown/src/z3c/testsetup/tests/ Added os.environ['TERM'] hack to fix invisible character issue.
Reinout van Rees
reinout at vanrees.org
Fri Aug 14 14:42:39 EDT 2009
Log message for revision 102788:
Added os.environ['TERM'] hack to fix invisible character issue.
See http://reinout.vanrees.org/weblog/2009/07/16/invisible-test-diff.html
Changed:
U z3c.testsetup/branches/reinout-teardown/src/z3c/testsetup/tests/setupininit.txt
U z3c.testsetup/branches/reinout-teardown/src/z3c/testsetup/tests/test_testsetup.py
-=-
Modified: z3c.testsetup/branches/reinout-teardown/src/z3c/testsetup/tests/setupininit.txt
===================================================================
--- z3c.testsetup/branches/reinout-teardown/src/z3c/testsetup/tests/setupininit.txt 2009-08-14 16:31:14 UTC (rev 102787)
+++ z3c.testsetup/branches/reinout-teardown/src/z3c/testsetup/tests/setupininit.txt 2009-08-14 18:42:39 UTC (rev 102788)
@@ -41,6 +41,3 @@
Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
Total: 4 tests, 0 failures, 0 errors in 1.854 seconds.
False
-
-TODO Note on ^^^: I copy-pasted the real output and I'm still getting some
-invisible error on the last "ran 2 tests" line.
\ No newline at end of file
Modified: z3c.testsetup/branches/reinout-teardown/src/z3c/testsetup/tests/test_testsetup.py
===================================================================
--- z3c.testsetup/branches/reinout-teardown/src/z3c/testsetup/tests/test_testsetup.py 2009-08-14 16:31:14 UTC (rev 102787)
+++ z3c.testsetup/branches/reinout-teardown/src/z3c/testsetup/tests/test_testsetup.py 2009-08-14 18:42:39 UTC (rev 102788)
@@ -1,27 +1,38 @@
import os
import sys
import gc
-import re
import unittest
from zope.testing import doctest, cleanup, renormalizing
from zope.testing.testrunner.tests import checker
import zope.component.eventtesting
from z3c.testsetup.util import get_package
+
+# Begin hack to fix
+# http://reinout.vanrees.org/weblog/2009/07/16/invisible-test-diff.html
+# Everything apart from 'xterm' is OK.
+os.environ['TERM'] = 'linux'
+# End hack.
+
+
TESTFILES = ['basicsetup.txt',
os.path.join('functional', 'functionaldoctestsetup.txt'),
- 'pythontestsetup.txt', 'unitdoctestsetup.txt', 'util.txt',
+ 'pythontestsetup.txt',
+ 'unitdoctestsetup.txt',
+ 'util.txt',
'unittestsetup.txt',
os.path.join('tests', 'setupininit.txt'),
os.path.join('tests', 'util.txt'),
]
+
def pnorm(path):
"""Normalization of paths to use forward slashes. This is needed
to make sure the tests work on windows.
"""
return path.replace(os.sep, '/')
+
def get_testcases_from_suite(suite):
result=[]
for elem in list(suite):
@@ -45,11 +56,13 @@
result.sort()
return result
+
def get_basenames_from_suite(suite):
basenames = [os.path.basename(x) for x in get_filenames_from_suite(suite)]
basenames.sort()
return basenames
+
def print_file(path):
"""Prints file contents with leading bar on each line.
@@ -59,15 +72,17 @@
print '| ' + '\n| '.join(contents.split('\n'))
return
+
def setUpZope(test):
zope.component.eventtesting.setUp(test)
+
def cleanUpZope(test):
cleanup.cleanUp()
+def testrunner_suite():
-def testrunner_suite():
def setUp(test):
test.globs['saved-sys-info'] = (
sys.path[:],
@@ -85,19 +100,25 @@
gc.set_threshold(*test.globs['saved-sys-info'][3])
sys.modules.clear()
sys.modules.update(test.globs['saved-sys-info'][2])
+
suites = [
doctest.DocFileSuite(
- 'tests/README_OLD.txt', 'testgetter.txt', 'testrunner.txt', 'README.txt',
+ 'tests/README_OLD.txt', 'testgetter.txt',
+ 'testrunner.txt', 'README.txt',
package='z3c.testsetup',
setUp=setUp, tearDown=tearDown,
- optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE+doctest.REPORT_NDIFF,
+ optionflags=(doctest.ELLIPSIS|
+ doctest.NORMALIZE_WHITESPACE|
+ doctest.REPORT_NDIFF),
checker=checker),
]
suite = unittest.TestSuite(suites)
return suite
+
def zopeapptestingless_suite():
+
def setUp(test):
test.globs['saved-sys-info'] = (
sys.path[:],
@@ -122,12 +143,15 @@
gc.set_threshold(*test.globs['saved-sys-info'][3])
sys.modules.clear()
sys.modules.update(test.globs['saved-sys-info'][2])
+
suites = [
doctest.DocFileSuite(
'nozopeapptesting.txt',
package='z3c.testsetup',
setUp=setUp, tearDown=tearDown,
- optionflags=doctest.ELLIPSIS+doctest.NORMALIZE_WHITESPACE+doctest.REPORT_NDIFF,
+ optionflags=(doctest.ELLIPSIS|
+ doctest.NORMALIZE_WHITESPACE|
+ doctest.REPORT_NDIFF),
checker=checker),
]
@@ -141,18 +165,19 @@
package = 'z3c.testsetup',
setUp=setUpZope,
tearDown=cleanUpZope,
- globs={'pnorm':pnorm,
+ globs={'pnorm': pnorm,
'get_basenames_from_suite':
get_basenames_from_suite,
- 'print_file':print_file,},
+ 'print_file': print_file},
checker=checker,
- optionflags=doctest.ELLIPSIS+
- doctest.NORMALIZE_WHITESPACE+
- doctest.REPORT_NDIFF)
+ optionflags=(doctest.ELLIPSIS|
+ doctest.NORMALIZE_WHITESPACE|
+ doctest.REPORT_NDIFF))
suite.addTest(test)
return suite
+
def test_suite():
suite = unittest.TestSuite()
for name in TESTFILES:
More information about the Checkins
mailing list