[Zope3-checkins] SVN: zope.testing/trunk/src/zope/testing/
Whitespace normalization (ran Python's reindent.py over 'em).
Tim Peters
tim.one at comcast.net
Wed May 25 13:08:58 EDT 2005
Log message for revision 30499:
Whitespace normalization (ran Python's reindent.py over 'em).
Changed:
U zope.testing/trunk/src/zope/testing/doctest.py
U zope.testing/trunk/src/zope/testing/loggingsupport.py
U zope.testing/trunk/src/zope/testing/module.py
U zope.testing/trunk/src/zope/testing/renormalizing.py
U zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sample11/sampletests.py
U zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test11.py
U zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test111.py
U zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test112.py
U zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test12.py
U zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test121.py
U zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test122.py
U zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/sampletests_e.py
U zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/sampletests_f.py
U zope.testing/trunk/src/zope/testing/testrunner-ex/samplelayers.py
U zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test11.py
U zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test111.py
U zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test112.py
U zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test12.py
U zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test121.py
U zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test122.py
U zope.testing/trunk/src/zope/testing/testrunner-ex/sampletestsf.py
U zope.testing/trunk/src/zope/testing/testrunner.py
-=-
Modified: zope.testing/trunk/src/zope/testing/doctest.py
===================================================================
--- zope.testing/trunk/src/zope/testing/doctest.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/doctest.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -2127,10 +2127,10 @@
words = 0
else:
words = 1
-
+
return count or 1
-
+
class DocTestFailureException(AssertionError):
"""Use custom exception for doctest unit test failures
"""
Modified: zope.testing/trunk/src/zope/testing/loggingsupport.py
===================================================================
--- zope.testing/trunk/src/zope/testing/loggingsupport.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/loggingsupport.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -57,14 +57,14 @@
[]
And then log something:
-
+
>>> logging.getLogger('foo.bar').info('blah')
and, sure enough, we still have no output:
-
+
>>> handler.records
[]
-
+
$Id$
"""
@@ -112,11 +112,10 @@
)
for record in self.records]
)
-
+
class InstalledHandler(Handler):
def __init__(self, *names):
Handler.__init__(self, *names)
self.install()
-
Modified: zope.testing/trunk/src/zope/testing/module.py
===================================================================
--- zope.testing/trunk/src/zope/testing/module.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/module.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -29,7 +29,7 @@
def setUp(test, name='README.txt'):
dict = test.globs
- dict['__name__'] = name
+ dict['__name__'] = name
sys.modules[name] = FakeModule(dict)
def tearDown(test, name='README.txt'):
Modified: zope.testing/trunk/src/zope/testing/renormalizing.py
===================================================================
--- zope.testing/trunk/src/zope/testing/renormalizing.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/renormalizing.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,221 +1,221 @@
-##############################################################################
-#
-# Copyright (c) 2004 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-r"""Regular expression pattern normalizing output checker
-
-The pattern-normalizing output checker extends the default output
-checker with an option to normalize expected an actual output.
-
-You specify a sequence of patterns and replacements. The replacements
-are applied to the expected and actual outputs before calling the
-default outputs checker. Let's look at an example. In this example,
-we have some times and addresses:
-
- >>> want = '''\
- ... <object object at 0xb7f14438>
- ... completed in 1.234 seconds.
- ... <BLANKLINE>
- ... <object object at 0xb7f14440>
- ... completed in 123.234 seconds.
- ... <BLANKLINE>
- ... <object object at 0xb7f14448>
- ... completed in .234 seconds.
- ... <BLANKLINE>
- ... <object object at 0xb7f14450>
- ... completed in 1.234 seconds.
- ... <BLANKLINE>
- ... '''
-
- >>> got = '''\
- ... <object object at 0xb7f14458>
- ... completed in 1.235 seconds.
- ...
- ... <object object at 0xb7f14460>
- ... completed in 123.233 seconds.
- ...
- ... <object object at 0xb7f14468>
- ... completed in .231 seconds.
- ...
- ... <object object at 0xb7f14470>
- ... completed in 1.23 seconds.
- ...
- ... '''
-
-We may wish to consider these two strings to match, even though they
-differ in actual addresses and times. The default output checker will
-consider them different:
-
- >>> doctest.OutputChecker().check_output(want, got, 0)
- False
-
-We'll use the RENormalizing to normalize both the
-wanted and gotten strings to ignore differences in times and addresses:
-
- >>> import re
- >>> checker = RENormalizing([
- ... (re.compile('[0-9]*[.][0-9]* seconds'), '<SOME NUMBER OF> seconds'),
- ... (re.compile('at 0x[0-9a-f]+'), 'at <SOME ADDRESS>'),
- ... ])
-
- >>> checker.check_output(want, got, 0)
- True
-
-Usual OutputChecker options work as exected:
-
- >>> want_ellided = '''\
- ... <object object at 0xb7f14438>
- ... completed in 1.234 seconds.
- ... ...
- ... <object object at 0xb7f14450>
- ... completed in 1.234 seconds.
- ... <BLANKLINE>
- ... '''
-
- >>> checker.check_output(want_ellided, got, 0)
- False
-
- >>> checker.check_output(want, got, doctest.ELLIPSIS)
- True
-
-When we get differencs, we output them with normalized text:
-
- >>> source = '''\
- ... >>> do_something()
- ... <object object at 0xb7f14438>
- ... completed in 1.234 seconds.
- ... ...
- ... <object object at 0xb7f14450>
- ... completed in 1.234 seconds.
- ... <BLANKLINE>
- ... '''
-
- >>> example = doctest.Example(source, want_ellided)
-
- >>> print checker.output_difference(example, got, 0)
- Expected:
- <object object at <SOME ADDRESS>>
- completed in <SOME NUMBER OF> seconds.
- ...
- <object object at <SOME ADDRESS>>
- completed in <SOME NUMBER OF> seconds.
- <BLANKLINE>
- Got:
- <object object at <SOME ADDRESS>>
- completed in <SOME NUMBER OF> seconds.
- <BLANKLINE>
- <object object at <SOME ADDRESS>>
- completed in <SOME NUMBER OF> seconds.
- <BLANKLINE>
- <object object at <SOME ADDRESS>>
- completed in <SOME NUMBER OF> seconds.
- <BLANKLINE>
- <object object at <SOME ADDRESS>>
- completed in <SOME NUMBER OF> seconds.
- <BLANKLINE>
- <BLANKLINE>
-
- >>> print checker.output_difference(example, got,
- ... doctest.REPORT_NDIFF)
- Differences (ndiff with -expected +actual):
- - <object object at <SOME ADDRESS>>
- - completed in <SOME NUMBER OF> seconds.
- - ...
- <object object at <SOME ADDRESS>>
- completed in <SOME NUMBER OF> seconds.
- <BLANKLINE>
- + <object object at <SOME ADDRESS>>
- + completed in <SOME NUMBER OF> seconds.
- + <BLANKLINE>
- + <object object at <SOME ADDRESS>>
- + completed in <SOME NUMBER OF> seconds.
- + <BLANKLINE>
- + <object object at <SOME ADDRESS>>
- + completed in <SOME NUMBER OF> seconds.
- + <BLANKLINE>
- <BLANKLINE>
-
- If the wanted text is empty, however, we don't transform the
- actual output. This is usful when writing tests. We leave the
- expected output empty, run the test, and use the actual output ad
- expected, after reviewing it.
-
- >>> source = '''\
- ... '''
-
- >>> example = doctest.Example(source, '\n')
- >>> print checker.output_difference(example, got, 0)
- Expected:
- <BLANKLINE>
- Got:
- <object object at 0xb7f14458>
- completed in 1.235 seconds.
- <BLANKLINE>
- <object object at 0xb7f14460>
- completed in 123.233 seconds.
- <BLANKLINE>
- <object object at 0xb7f14468>
- completed in .231 seconds.
- <BLANKLINE>
- <object object at 0xb7f14470>
- completed in 1.23 seconds.
- <BLANKLINE>
- <BLANKLINE>
-
-$Id$
-"""
-
-import doctest
-
-class RENormalizing(doctest.OutputChecker):
- """Pattern-normalizing outout checker
- """
-
- def __init__(self, patterns):
- self.patterns = patterns
-
- def check_output(self, want, got, optionflags):
- if got == want:
- return True
-
- for pattern, repl in self.patterns:
- want = pattern.sub(repl, want)
- got = pattern.sub(repl, got)
-
- return doctest.OutputChecker.check_output(self, want, got, optionflags)
-
- def output_difference(self, example, got, optionflags):
-
- want = example.want
-
- # If want is empty, use original outputter. This is useful
- # when setting up tests for the first time. In that case, we
- # generally use the differencer to display output, which we evaluate
- # by hand.
- if not want.strip():
- return doctest.OutputChecker.output_difference(
- self, example, got, optionflags)
-
- # Dang, this isn't as easy to override as we might wish
- original = want
-
- for pattern, repl in self.patterns:
- want = pattern.sub(repl, want)
- got = pattern.sub(repl, got)
-
- # temporarily hack example with normalized want:
- example.want = want
- result = doctest.OutputChecker.output_difference(
- self, example, got, optionflags)
- example.want = original
-
- return result
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+r"""Regular expression pattern normalizing output checker
+
+The pattern-normalizing output checker extends the default output
+checker with an option to normalize expected an actual output.
+
+You specify a sequence of patterns and replacements. The replacements
+are applied to the expected and actual outputs before calling the
+default outputs checker. Let's look at an example. In this example,
+we have some times and addresses:
+
+ >>> want = '''\
+ ... <object object at 0xb7f14438>
+ ... completed in 1.234 seconds.
+ ... <BLANKLINE>
+ ... <object object at 0xb7f14440>
+ ... completed in 123.234 seconds.
+ ... <BLANKLINE>
+ ... <object object at 0xb7f14448>
+ ... completed in .234 seconds.
+ ... <BLANKLINE>
+ ... <object object at 0xb7f14450>
+ ... completed in 1.234 seconds.
+ ... <BLANKLINE>
+ ... '''
+
+ >>> got = '''\
+ ... <object object at 0xb7f14458>
+ ... completed in 1.235 seconds.
+ ...
+ ... <object object at 0xb7f14460>
+ ... completed in 123.233 seconds.
+ ...
+ ... <object object at 0xb7f14468>
+ ... completed in .231 seconds.
+ ...
+ ... <object object at 0xb7f14470>
+ ... completed in 1.23 seconds.
+ ...
+ ... '''
+
+We may wish to consider these two strings to match, even though they
+differ in actual addresses and times. The default output checker will
+consider them different:
+
+ >>> doctest.OutputChecker().check_output(want, got, 0)
+ False
+
+We'll use the RENormalizing to normalize both the
+wanted and gotten strings to ignore differences in times and addresses:
+
+ >>> import re
+ >>> checker = RENormalizing([
+ ... (re.compile('[0-9]*[.][0-9]* seconds'), '<SOME NUMBER OF> seconds'),
+ ... (re.compile('at 0x[0-9a-f]+'), 'at <SOME ADDRESS>'),
+ ... ])
+
+ >>> checker.check_output(want, got, 0)
+ True
+
+Usual OutputChecker options work as exected:
+
+ >>> want_ellided = '''\
+ ... <object object at 0xb7f14438>
+ ... completed in 1.234 seconds.
+ ... ...
+ ... <object object at 0xb7f14450>
+ ... completed in 1.234 seconds.
+ ... <BLANKLINE>
+ ... '''
+
+ >>> checker.check_output(want_ellided, got, 0)
+ False
+
+ >>> checker.check_output(want, got, doctest.ELLIPSIS)
+ True
+
+When we get differencs, we output them with normalized text:
+
+ >>> source = '''\
+ ... >>> do_something()
+ ... <object object at 0xb7f14438>
+ ... completed in 1.234 seconds.
+ ... ...
+ ... <object object at 0xb7f14450>
+ ... completed in 1.234 seconds.
+ ... <BLANKLINE>
+ ... '''
+
+ >>> example = doctest.Example(source, want_ellided)
+
+ >>> print checker.output_difference(example, got, 0)
+ Expected:
+ <object object at <SOME ADDRESS>>
+ completed in <SOME NUMBER OF> seconds.
+ ...
+ <object object at <SOME ADDRESS>>
+ completed in <SOME NUMBER OF> seconds.
+ <BLANKLINE>
+ Got:
+ <object object at <SOME ADDRESS>>
+ completed in <SOME NUMBER OF> seconds.
+ <BLANKLINE>
+ <object object at <SOME ADDRESS>>
+ completed in <SOME NUMBER OF> seconds.
+ <BLANKLINE>
+ <object object at <SOME ADDRESS>>
+ completed in <SOME NUMBER OF> seconds.
+ <BLANKLINE>
+ <object object at <SOME ADDRESS>>
+ completed in <SOME NUMBER OF> seconds.
+ <BLANKLINE>
+ <BLANKLINE>
+
+ >>> print checker.output_difference(example, got,
+ ... doctest.REPORT_NDIFF)
+ Differences (ndiff with -expected +actual):
+ - <object object at <SOME ADDRESS>>
+ - completed in <SOME NUMBER OF> seconds.
+ - ...
+ <object object at <SOME ADDRESS>>
+ completed in <SOME NUMBER OF> seconds.
+ <BLANKLINE>
+ + <object object at <SOME ADDRESS>>
+ + completed in <SOME NUMBER OF> seconds.
+ + <BLANKLINE>
+ + <object object at <SOME ADDRESS>>
+ + completed in <SOME NUMBER OF> seconds.
+ + <BLANKLINE>
+ + <object object at <SOME ADDRESS>>
+ + completed in <SOME NUMBER OF> seconds.
+ + <BLANKLINE>
+ <BLANKLINE>
+
+ If the wanted text is empty, however, we don't transform the
+ actual output. This is usful when writing tests. We leave the
+ expected output empty, run the test, and use the actual output ad
+ expected, after reviewing it.
+
+ >>> source = '''\
+ ... '''
+
+ >>> example = doctest.Example(source, '\n')
+ >>> print checker.output_difference(example, got, 0)
+ Expected:
+ <BLANKLINE>
+ Got:
+ <object object at 0xb7f14458>
+ completed in 1.235 seconds.
+ <BLANKLINE>
+ <object object at 0xb7f14460>
+ completed in 123.233 seconds.
+ <BLANKLINE>
+ <object object at 0xb7f14468>
+ completed in .231 seconds.
+ <BLANKLINE>
+ <object object at 0xb7f14470>
+ completed in 1.23 seconds.
+ <BLANKLINE>
+ <BLANKLINE>
+
+$Id$
+"""
+
+import doctest
+
+class RENormalizing(doctest.OutputChecker):
+ """Pattern-normalizing outout checker
+ """
+
+ def __init__(self, patterns):
+ self.patterns = patterns
+
+ def check_output(self, want, got, optionflags):
+ if got == want:
+ return True
+
+ for pattern, repl in self.patterns:
+ want = pattern.sub(repl, want)
+ got = pattern.sub(repl, got)
+
+ return doctest.OutputChecker.check_output(self, want, got, optionflags)
+
+ def output_difference(self, example, got, optionflags):
+
+ want = example.want
+
+ # If want is empty, use original outputter. This is useful
+ # when setting up tests for the first time. In that case, we
+ # generally use the differencer to display output, which we evaluate
+ # by hand.
+ if not want.strip():
+ return doctest.OutputChecker.output_difference(
+ self, example, got, optionflags)
+
+ # Dang, this isn't as easy to override as we might wish
+ original = want
+
+ for pattern, repl in self.patterns:
+ want = pattern.sub(repl, want)
+ got = pattern.sub(repl, got)
+
+ # temporarily hack example with normalized want:
+ example.want = want
+ result = doctest.OutputChecker.output_difference(
+ self, example, got, optionflags)
+ example.want = original
+
+ return result
Modified: zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sample11/sampletests.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sample11/sampletests.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sample11/sampletests.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,123 +1,123 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import unittest
-from zope.testing import doctest
-
-x=0
-y=0
-z=0
-
-class TestA(unittest.TestCase):
- def setUp(self):
- global x
- x = 1
- def tearDown(self):
- global x
- x = 0
- def test_x1(self):
- self.assertEqual(x, 1)
- def test_y0(self):
- self.assertEqual(y, 0)
- def test_z0(self):
- self.assertEqual(z, 0)
-
-class TestA3(unittest.TestCase):
-
- level = 3
-
- def setUp(self):
- global x
- x = 1
- def tearDown(self):
- global x
- x = 0
- def test_x1(self):
- self.assertEqual(x, 1)
- def test_y0(self):
- self.assertEqual(y, 0)
- def test_z0(self):
- self.assertEqual(z, 0)
-
-class TestB(unittest.TestCase):
- def setUp(self):
- global y
- y = 1
- def tearDown(self):
- global y
- y = 0
- def test_y1(self):
- self.assertEqual(y, 1)
- def test_x0(self):
- self.assertEqual(x, 0)
- def test_z0(self):
- self.assertEqual(z, 0)
-
-class TestB2(unittest.TestCase):
- level = 2
-
- def setUp(self):
- global y
- y = 1
- def tearDown(self):
- global y
- y = 0
- def test_y1(self):
- self.assertEqual(y, 1)
- def test_x0(self):
- self.assertEqual(x, 0)
- def test_z0(self):
- self.assertEqual(z, 0)
-
-
-class TestNotMuch(unittest.TestCase):
- def test_1(self):
- pass
- def test_2(self):
- pass
- def test_3(self):
- pass
-
-def setUp(test):
- test.globs['z'] = 1
-
-def test_y0(self):
- """
- >>> y
- 0
- """
-
-def test_x0(self):
- """
- >>> x
- 0
- """
-
-def test_z1(self):
- """
- >>> z
- 1
- """
-
-def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestA))
- suite.addTest(unittest.makeSuite(TestA3))
- suite.addTest(unittest.makeSuite(TestB))
- suite.addTest(unittest.makeSuite(TestB2))
- suite.addTest(unittest.makeSuite(TestNotMuch))
- suite.addTest(doctest.DocTestSuite(setUp=setUp))
- suite.addTest(doctest.DocFileSuite('../../sampletests.txt',
- setUp=setUp))
- return suite
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+from zope.testing import doctest
+
+x=0
+y=0
+z=0
+
+class TestA(unittest.TestCase):
+ def setUp(self):
+ global x
+ x = 1
+ def tearDown(self):
+ global x
+ x = 0
+ def test_x1(self):
+ self.assertEqual(x, 1)
+ def test_y0(self):
+ self.assertEqual(y, 0)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+
+class TestA3(unittest.TestCase):
+
+ level = 3
+
+ def setUp(self):
+ global x
+ x = 1
+ def tearDown(self):
+ global x
+ x = 0
+ def test_x1(self):
+ self.assertEqual(x, 1)
+ def test_y0(self):
+ self.assertEqual(y, 0)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+
+class TestB(unittest.TestCase):
+ def setUp(self):
+ global y
+ y = 1
+ def tearDown(self):
+ global y
+ y = 0
+ def test_y1(self):
+ self.assertEqual(y, 1)
+ def test_x0(self):
+ self.assertEqual(x, 0)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+
+class TestB2(unittest.TestCase):
+ level = 2
+
+ def setUp(self):
+ global y
+ y = 1
+ def tearDown(self):
+ global y
+ y = 0
+ def test_y1(self):
+ self.assertEqual(y, 1)
+ def test_x0(self):
+ self.assertEqual(x, 0)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+
+
+class TestNotMuch(unittest.TestCase):
+ def test_1(self):
+ pass
+ def test_2(self):
+ pass
+ def test_3(self):
+ pass
+
+def setUp(test):
+ test.globs['z'] = 1
+
+def test_y0(self):
+ """
+ >>> y
+ 0
+ """
+
+def test_x0(self):
+ """
+ >>> x
+ 0
+ """
+
+def test_z1(self):
+ """
+ >>> z
+ 1
+ """
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestA))
+ suite.addTest(unittest.makeSuite(TestA3))
+ suite.addTest(unittest.makeSuite(TestB))
+ suite.addTest(unittest.makeSuite(TestB2))
+ suite.addTest(unittest.makeSuite(TestNotMuch))
+ suite.addTest(doctest.DocTestSuite(setUp=setUp))
+ suite.addTest(doctest.DocFileSuite('../../sampletests.txt',
+ setUp=setUp))
+ return suite
Modified: zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test11.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test11.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test11.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,127 +1,127 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import unittest
-from zope.testing import doctest
-import samplelayers
-
-layername = 'samplelayers.Layer11'
-layer = samplelayers.Layer11
-
-x=0
-y=0
-z=0
-
-class TestA(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global x
- x = 1
- def tearDown(self):
- global x
- x = 0
- def test_x1(self):
- self.assertEqual(x, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_y0(self):
- self.assertEqual(y, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-class TestB(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global y
- y = 1
- def tearDown(self):
- global y
- y = 0
- def test_y1(self):
- self.assertEqual(y, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_x0(self):
- self.assertEqual(x, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-
-class TestNotMuch(unittest.TestCase):
- layer = layername
-
- def test_1(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_2(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_3(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-def setUp(test):
- test.globs['z'] = 1
- test.globs['layer'] = layer.layer
- test.globs['layerx'] = layer.layerx
-
-def test_y0(self):
- """
- >>> y
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_x0(self):
- """
- >>> x
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_z1(self):
- """
- >>> z
- 1
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestA))
- suite.addTest(unittest.makeSuite(TestB))
- suite.addTest(unittest.makeSuite(TestNotMuch))
- s = doctest.DocTestSuite(setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- s = doctest.DocFileSuite('../../sampletestsl.txt', setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- return suite
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+from zope.testing import doctest
+import samplelayers
+
+layername = 'samplelayers.Layer11'
+layer = samplelayers.Layer11
+
+x=0
+y=0
+z=0
+
+class TestA(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global x
+ x = 1
+ def tearDown(self):
+ global x
+ x = 0
+ def test_x1(self):
+ self.assertEqual(x, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_y0(self):
+ self.assertEqual(y, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+class TestB(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global y
+ y = 1
+ def tearDown(self):
+ global y
+ y = 0
+ def test_y1(self):
+ self.assertEqual(y, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_x0(self):
+ self.assertEqual(x, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+
+class TestNotMuch(unittest.TestCase):
+ layer = layername
+
+ def test_1(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_2(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_3(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+def setUp(test):
+ test.globs['z'] = 1
+ test.globs['layer'] = layer.layer
+ test.globs['layerx'] = layer.layerx
+
+def test_y0(self):
+ """
+ >>> y
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_x0(self):
+ """
+ >>> x
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_z1(self):
+ """
+ >>> z
+ 1
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestA))
+ suite.addTest(unittest.makeSuite(TestB))
+ suite.addTest(unittest.makeSuite(TestNotMuch))
+ s = doctest.DocTestSuite(setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ s = doctest.DocFileSuite('../../sampletestsl.txt', setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ return suite
Modified: zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test111.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test111.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test111.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,127 +1,127 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import unittest
-from zope.testing import doctest
-import samplelayers
-
-layername = 'samplelayers.Layer111'
-layer = samplelayers.Layer111
-
-x=0
-y=0
-z=0
-
-class TestA(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global x
- x = 1
- def tearDown(self):
- global x
- x = 0
- def test_x1(self):
- self.assertEqual(x, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_y0(self):
- self.assertEqual(y, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-class TestB(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global y
- y = 1
- def tearDown(self):
- global y
- y = 0
- def test_y1(self):
- self.assertEqual(y, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_x0(self):
- self.assertEqual(x, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-
-class TestNotMuch(unittest.TestCase):
- layer = layername
-
- def test_1(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_2(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_3(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-def setUp(test):
- test.globs['z'] = 1
- test.globs['layer'] = layer.layer
- test.globs['layerx'] = layer.layerx
-
-def test_y0(self):
- """
- >>> y
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_x0(self):
- """
- >>> x
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_z1(self):
- """
- >>> z
- 1
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestA))
- suite.addTest(unittest.makeSuite(TestB))
- suite.addTest(unittest.makeSuite(TestNotMuch))
- s = doctest.DocTestSuite(setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- s = doctest.DocFileSuite('../../sampletestsl.txt', setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- return suite
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+from zope.testing import doctest
+import samplelayers
+
+layername = 'samplelayers.Layer111'
+layer = samplelayers.Layer111
+
+x=0
+y=0
+z=0
+
+class TestA(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global x
+ x = 1
+ def tearDown(self):
+ global x
+ x = 0
+ def test_x1(self):
+ self.assertEqual(x, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_y0(self):
+ self.assertEqual(y, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+class TestB(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global y
+ y = 1
+ def tearDown(self):
+ global y
+ y = 0
+ def test_y1(self):
+ self.assertEqual(y, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_x0(self):
+ self.assertEqual(x, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+
+class TestNotMuch(unittest.TestCase):
+ layer = layername
+
+ def test_1(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_2(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_3(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+def setUp(test):
+ test.globs['z'] = 1
+ test.globs['layer'] = layer.layer
+ test.globs['layerx'] = layer.layerx
+
+def test_y0(self):
+ """
+ >>> y
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_x0(self):
+ """
+ >>> x
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_z1(self):
+ """
+ >>> z
+ 1
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestA))
+ suite.addTest(unittest.makeSuite(TestB))
+ suite.addTest(unittest.makeSuite(TestNotMuch))
+ s = doctest.DocTestSuite(setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ s = doctest.DocFileSuite('../../sampletestsl.txt', setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ return suite
Modified: zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test112.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test112.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test112.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,128 +1,128 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import unittest
-from zope.testing import doctest
-import samplelayers
-
-layername = 'samplelayers.Layer112'
-layer = samplelayers.Layer112
-
-
-x=0
-y=0
-z=0
-
-class TestA(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global x
- x = 1
- def tearDown(self):
- global x
- x = 0
- def test_x1(self):
- self.assertEqual(x, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_y0(self):
- self.assertEqual(y, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-class TestB(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global y
- y = 1
- def tearDown(self):
- global y
- y = 0
- def test_y1(self):
- self.assertEqual(y, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_x0(self):
- self.assertEqual(x, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-
-class TestNotMuch(unittest.TestCase):
- layer = layername
-
- def test_1(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_2(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_3(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-def setUp(test):
- test.globs['z'] = 1
- test.globs['layer'] = layer.layer
- test.globs['layerx'] = layer.layerx
-
-def test_y0(self):
- """
- >>> y
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_x0(self):
- """
- >>> x
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_z1(self):
- """
- >>> z
- 1
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestA))
- suite.addTest(unittest.makeSuite(TestB))
- suite.addTest(unittest.makeSuite(TestNotMuch))
- s = doctest.DocTestSuite(setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- s = doctest.DocFileSuite('../../sampletestsl.txt', setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- return suite
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+from zope.testing import doctest
+import samplelayers
+
+layername = 'samplelayers.Layer112'
+layer = samplelayers.Layer112
+
+
+x=0
+y=0
+z=0
+
+class TestA(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global x
+ x = 1
+ def tearDown(self):
+ global x
+ x = 0
+ def test_x1(self):
+ self.assertEqual(x, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_y0(self):
+ self.assertEqual(y, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+class TestB(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global y
+ y = 1
+ def tearDown(self):
+ global y
+ y = 0
+ def test_y1(self):
+ self.assertEqual(y, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_x0(self):
+ self.assertEqual(x, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+
+class TestNotMuch(unittest.TestCase):
+ layer = layername
+
+ def test_1(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_2(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_3(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+def setUp(test):
+ test.globs['z'] = 1
+ test.globs['layer'] = layer.layer
+ test.globs['layerx'] = layer.layerx
+
+def test_y0(self):
+ """
+ >>> y
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_x0(self):
+ """
+ >>> x
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_z1(self):
+ """
+ >>> z
+ 1
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestA))
+ suite.addTest(unittest.makeSuite(TestB))
+ suite.addTest(unittest.makeSuite(TestNotMuch))
+ s = doctest.DocTestSuite(setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ s = doctest.DocFileSuite('../../sampletestsl.txt', setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ return suite
Modified: zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test12.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test12.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test12.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,127 +1,127 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import unittest
-from zope.testing import doctest
-import samplelayers
-
-layername = 'samplelayers.Layer12'
-layer = samplelayers.Layer12
-
-x=0
-y=0
-z=0
-
-class TestA(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global x
- x = 1
- def tearDown(self):
- global x
- x = 0
- def test_x1(self):
- self.assertEqual(x, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_y0(self):
- self.assertEqual(y, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-class TestB(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global y
- y = 1
- def tearDown(self):
- global y
- y = 0
- def test_y1(self):
- self.assertEqual(y, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_x0(self):
- self.assertEqual(x, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-
-class TestNotMuch(unittest.TestCase):
- layer = layername
-
- def test_1(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_2(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_3(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-def setUp(test):
- test.globs['z'] = 1
- test.globs['layer'] = layer.layer
- test.globs['layerx'] = layer.layerx
-
-def test_y0(self):
- """
- >>> y
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_x0(self):
- """
- >>> x
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_z1(self):
- """
- >>> z
- 1
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestA))
- suite.addTest(unittest.makeSuite(TestB))
- suite.addTest(unittest.makeSuite(TestNotMuch))
- s = doctest.DocTestSuite(setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- s = doctest.DocFileSuite('../../sampletestsl.txt', setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- return suite
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+from zope.testing import doctest
+import samplelayers
+
+layername = 'samplelayers.Layer12'
+layer = samplelayers.Layer12
+
+x=0
+y=0
+z=0
+
+class TestA(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global x
+ x = 1
+ def tearDown(self):
+ global x
+ x = 0
+ def test_x1(self):
+ self.assertEqual(x, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_y0(self):
+ self.assertEqual(y, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+class TestB(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global y
+ y = 1
+ def tearDown(self):
+ global y
+ y = 0
+ def test_y1(self):
+ self.assertEqual(y, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_x0(self):
+ self.assertEqual(x, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+
+class TestNotMuch(unittest.TestCase):
+ layer = layername
+
+ def test_1(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_2(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_3(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+def setUp(test):
+ test.globs['z'] = 1
+ test.globs['layer'] = layer.layer
+ test.globs['layerx'] = layer.layerx
+
+def test_y0(self):
+ """
+ >>> y
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_x0(self):
+ """
+ >>> x
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_z1(self):
+ """
+ >>> z
+ 1
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestA))
+ suite.addTest(unittest.makeSuite(TestB))
+ suite.addTest(unittest.makeSuite(TestNotMuch))
+ s = doctest.DocTestSuite(setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ s = doctest.DocFileSuite('../../sampletestsl.txt', setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ return suite
Modified: zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test121.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test121.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test121.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,127 +1,127 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import unittest
-from zope.testing import doctest
-import samplelayers
-
-layername = 'samplelayers.Layer121'
-layer = samplelayers.Layer121
-
-x=0
-y=0
-z=0
-
-class TestA(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global x
- x = 1
- def tearDown(self):
- global x
- x = 0
- def test_x1(self):
- self.assertEqual(x, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_y0(self):
- self.assertEqual(y, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-class TestB(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global y
- y = 1
- def tearDown(self):
- global y
- y = 0
- def test_y1(self):
- self.assertEqual(y, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_x0(self):
- self.assertEqual(x, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-
-class TestNotMuch(unittest.TestCase):
- layer = layername
-
- def test_1(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_2(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_3(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-def setUp(test):
- test.globs['z'] = 1
- test.globs['layer'] = layer.layer
- test.globs['layerx'] = layer.layerx
-
-def test_y0(self):
- """
- >>> y
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_x0(self):
- """
- >>> x
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_z1(self):
- """
- >>> z
- 1
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestA))
- suite.addTest(unittest.makeSuite(TestB))
- suite.addTest(unittest.makeSuite(TestNotMuch))
- s = doctest.DocTestSuite(setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- s = doctest.DocFileSuite('../../sampletestsl.txt', setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- return suite
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+from zope.testing import doctest
+import samplelayers
+
+layername = 'samplelayers.Layer121'
+layer = samplelayers.Layer121
+
+x=0
+y=0
+z=0
+
+class TestA(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global x
+ x = 1
+ def tearDown(self):
+ global x
+ x = 0
+ def test_x1(self):
+ self.assertEqual(x, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_y0(self):
+ self.assertEqual(y, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+class TestB(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global y
+ y = 1
+ def tearDown(self):
+ global y
+ y = 0
+ def test_y1(self):
+ self.assertEqual(y, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_x0(self):
+ self.assertEqual(x, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+
+class TestNotMuch(unittest.TestCase):
+ layer = layername
+
+ def test_1(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_2(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_3(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+def setUp(test):
+ test.globs['z'] = 1
+ test.globs['layer'] = layer.layer
+ test.globs['layerx'] = layer.layerx
+
+def test_y0(self):
+ """
+ >>> y
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_x0(self):
+ """
+ >>> x
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_z1(self):
+ """
+ >>> z
+ 1
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestA))
+ suite.addTest(unittest.makeSuite(TestB))
+ suite.addTest(unittest.makeSuite(TestNotMuch))
+ s = doctest.DocTestSuite(setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ s = doctest.DocFileSuite('../../sampletestsl.txt', setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ return suite
Modified: zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test122.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test122.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sample1/sampletests/test122.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,127 +1,127 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import unittest
-from zope.testing import doctest
-import samplelayers
-
-layername = 'samplelayers.Layer122'
-layer = samplelayers.Layer122
-
-x=0
-y=0
-z=0
-
-class TestA(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global x
- x = 1
- def tearDown(self):
- global x
- x = 0
- def test_x1(self):
- self.assertEqual(x, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_y0(self):
- self.assertEqual(y, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-class TestB(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global y
- y = 1
- def tearDown(self):
- global y
- y = 0
- def test_y1(self):
- self.assertEqual(y, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_x0(self):
- self.assertEqual(x, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-
-class TestNotMuch(unittest.TestCase):
- layer = layername
-
- def test_1(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_2(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_3(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-def setUp(test):
- test.globs['z'] = 1
- test.globs['layer'] = layer.layer
- test.globs['layerx'] = layer.layerx
-
-def test_y0(self):
- """
- >>> y
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_x0(self):
- """
- >>> x
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_z1(self):
- """
- >>> z
- 1
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestA))
- suite.addTest(unittest.makeSuite(TestB))
- suite.addTest(unittest.makeSuite(TestNotMuch))
- s = doctest.DocTestSuite(setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- s = doctest.DocFileSuite('../../sampletestsl.txt', setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- return suite
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+from zope.testing import doctest
+import samplelayers
+
+layername = 'samplelayers.Layer122'
+layer = samplelayers.Layer122
+
+x=0
+y=0
+z=0
+
+class TestA(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global x
+ x = 1
+ def tearDown(self):
+ global x
+ x = 0
+ def test_x1(self):
+ self.assertEqual(x, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_y0(self):
+ self.assertEqual(y, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+class TestB(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global y
+ y = 1
+ def tearDown(self):
+ global y
+ y = 0
+ def test_y1(self):
+ self.assertEqual(y, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_x0(self):
+ self.assertEqual(x, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+
+class TestNotMuch(unittest.TestCase):
+ layer = layername
+
+ def test_1(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_2(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_3(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+def setUp(test):
+ test.globs['z'] = 1
+ test.globs['layer'] = layer.layer
+ test.globs['layerx'] = layer.layerx
+
+def test_y0(self):
+ """
+ >>> y
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_x0(self):
+ """
+ >>> x
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_z1(self):
+ """
+ >>> z
+ 1
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestA))
+ suite.addTest(unittest.makeSuite(TestB))
+ suite.addTest(unittest.makeSuite(TestNotMuch))
+ s = doctest.DocTestSuite(setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ s = doctest.DocFileSuite('../../sampletestsl.txt', setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ return suite
Modified: zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/sampletests_e.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/sampletests_e.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/sampletests_e.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,56 +1,56 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import unittest
-from zope.testing import doctest
-
-def f():
- g()
-
-def g():
- x = 1
- x = x + 1
- x = y + 1
- x = x + 1
-
-
-def eek(self):
- """
- >>> f()
- 1
- """
-
-class Test(unittest.TestCase):
-
- def test1(self):
- pass
-
- def test2(self):
- pass
-
- def test3(self):
- f()
-
- def test4(self):
- pass
-
- def test5(self):
- pass
-
-def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(doctest.DocTestSuite())
- suite.addTest(unittest.makeSuite(Test))
- suite.addTest(doctest.DocFileSuite('e.txt'))
- return suite
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+from zope.testing import doctest
+
+def f():
+ g()
+
+def g():
+ x = 1
+ x = x + 1
+ x = y + 1
+ x = x + 1
+
+
+def eek(self):
+ """
+ >>> f()
+ 1
+ """
+
+class Test(unittest.TestCase):
+
+ def test1(self):
+ pass
+
+ def test2(self):
+ pass
+
+ def test3(self):
+ f()
+
+ def test4(self):
+ pass
+
+ def test5(self):
+ pass
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(doctest.DocTestSuite())
+ suite.addTest(unittest.makeSuite(Test))
+ suite.addTest(doctest.DocFileSuite('e.txt'))
+ return suite
Modified: zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/sampletests_f.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/sampletests_f.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sample2/sampletests_f.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,24 +1,24 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import unittest
-from zope.testing import doctest
-
-class Test(unittest.TestCase):
-
- def test(self):
- self.assertEqual(1,0)
-
-def test_suite():
- return unittest.makeSuite(Test)
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+from zope.testing import doctest
+
+class Test(unittest.TestCase):
+
+ def test(self):
+ self.assertEqual(1,0)
+
+def test_suite():
+ return unittest.makeSuite(Test)
Modified: zope.testing/trunk/src/zope/testing/testrunner-ex/samplelayers.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/samplelayers.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/samplelayers.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,130 +1,130 @@
-##############################################################################
-#
-# Copyright (c) 2004 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Sample test layers
-
-$Id$
-"""
-
-layer = '0' # Internal to samples. Not part of layer API
-layerx = '0'
-
-class Layer1:
- # Internal to samples. Not part of layer API:
- layer = '1'
- base = '0'
- layerx = '0'
-
- def setUp(self):
- global layer
- if layer != self.base:
- raise ValueError("Bad layer, %s, for %s." % (layer, self))
- layer = self.layer
- setUp = classmethod(setUp)
-
- def tearDown(self):
- global layer
- if layer != self.layer:
- raise ValueError("Bad layer, %s, for %s." % (layer, self))
- layer = self.base
- tearDown = classmethod(tearDown)
-
-class Layerx:
- layerx = '1' # Internal to samples. Not part of layer API
- basex = '0'
-
- def setUp(self):
- global layerx
- if layerx != self.basex:
- raise ValueError("Bad layerx, %s, for %s." % (layerx, self))
- layerx = self.layerx
- setUp = classmethod(setUp)
-
- def tearDown(self):
- global layerx
- if layerx != self.layerx:
- raise ValueError("Bad layerx, %s, for %s." % (layerx, self))
- layerx = self.basex
- tearDown = classmethod(tearDown)
-
-class Layer11(Layer1):
- layer = '11' # Internal to samples. Not part of layer API
- base = '1' # Internal to samples. Not part of layer API
-
-class Layer12(Layer1):
- layer = '12' # Internal to samples. Not part of layer API
- base = '1' # Internal to samples. Not part of layer API
-
-class Layer111(Layerx, Layer11):
- layer = '111' # Internal to samples. Not part of layer API
- base = '11' # Internal to samples. Not part of layer API
- layerx = '2' # Internal to samples. Not part of layer API
- basex = '1'
-
- def setUp(self):
- global layer
- if layer != self.base:
- raise ValueError("Bad layer, %s, for %s." % (layer, self))
- layer = self.layer
- global layerx
- if layerx != self.basex:
- raise ValueError("Bad layerx, %s, for %s." % (layerx, self))
- layerx = self.layerx
- setUp = classmethod(setUp)
-
- def tearDown(self):
- global layer
- if layer != self.layer:
- raise ValueError("Bad layer, %s, for %s." % (layer, self))
- layer = self.base
- global layerx
- if layerx != self.layerx:
- raise ValueError("Bad layerx, %s, for %s." % (layerx, self))
- layerx = self.basex
- tearDown = classmethod(tearDown)
-
-class Layer121(Layer12):
- layer = '121' # Internal to samples. Not part of layer API
- base = '12' # Internal to samples. Not part of layer API
-
-class Layer112(Layerx, Layer11):
- layer = '112' # Internal to samples. Not part of layer API
- base = '11' # Internal to samples. Not part of layer API
- layerx = '2' # Internal to samples. Not part of layer API
- basex = '1'
-
- def setUp(self):
- global layer
- if layer != self.base:
- raise ValueError("Bad layer, %s, for %s." % (layer, self))
- layer = self.layer
- global layerx
- if layerx != self.basex:
- raise ValueError("Bad layerx, %s, for %s." % (layerx, self))
- layerx = self.layerx
- setUp = classmethod(setUp)
-
- def tearDown(self):
- global layer
- if layer != self.layer:
- raise ValueError("Bad layer, %s, for %s." % (layer, self))
- layer = self.base
- global layerx
- if layerx != self.layerx:
- raise ValueError("Bad layerx, %s, for %s." % (layerx, self))
- layerx = self.basex
- tearDown = classmethod(tearDown)
-
-class Layer122(Layer12):
- layer = '122' # Internal to samples. Not part of layer API
- base = '12' # Internal to samples. Not part of layer API
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Sample test layers
+
+$Id$
+"""
+
+layer = '0' # Internal to samples. Not part of layer API
+layerx = '0'
+
+class Layer1:
+ # Internal to samples. Not part of layer API:
+ layer = '1'
+ base = '0'
+ layerx = '0'
+
+ def setUp(self):
+ global layer
+ if layer != self.base:
+ raise ValueError("Bad layer, %s, for %s." % (layer, self))
+ layer = self.layer
+ setUp = classmethod(setUp)
+
+ def tearDown(self):
+ global layer
+ if layer != self.layer:
+ raise ValueError("Bad layer, %s, for %s." % (layer, self))
+ layer = self.base
+ tearDown = classmethod(tearDown)
+
+class Layerx:
+ layerx = '1' # Internal to samples. Not part of layer API
+ basex = '0'
+
+ def setUp(self):
+ global layerx
+ if layerx != self.basex:
+ raise ValueError("Bad layerx, %s, for %s." % (layerx, self))
+ layerx = self.layerx
+ setUp = classmethod(setUp)
+
+ def tearDown(self):
+ global layerx
+ if layerx != self.layerx:
+ raise ValueError("Bad layerx, %s, for %s." % (layerx, self))
+ layerx = self.basex
+ tearDown = classmethod(tearDown)
+
+class Layer11(Layer1):
+ layer = '11' # Internal to samples. Not part of layer API
+ base = '1' # Internal to samples. Not part of layer API
+
+class Layer12(Layer1):
+ layer = '12' # Internal to samples. Not part of layer API
+ base = '1' # Internal to samples. Not part of layer API
+
+class Layer111(Layerx, Layer11):
+ layer = '111' # Internal to samples. Not part of layer API
+ base = '11' # Internal to samples. Not part of layer API
+ layerx = '2' # Internal to samples. Not part of layer API
+ basex = '1'
+
+ def setUp(self):
+ global layer
+ if layer != self.base:
+ raise ValueError("Bad layer, %s, for %s." % (layer, self))
+ layer = self.layer
+ global layerx
+ if layerx != self.basex:
+ raise ValueError("Bad layerx, %s, for %s." % (layerx, self))
+ layerx = self.layerx
+ setUp = classmethod(setUp)
+
+ def tearDown(self):
+ global layer
+ if layer != self.layer:
+ raise ValueError("Bad layer, %s, for %s." % (layer, self))
+ layer = self.base
+ global layerx
+ if layerx != self.layerx:
+ raise ValueError("Bad layerx, %s, for %s." % (layerx, self))
+ layerx = self.basex
+ tearDown = classmethod(tearDown)
+
+class Layer121(Layer12):
+ layer = '121' # Internal to samples. Not part of layer API
+ base = '12' # Internal to samples. Not part of layer API
+
+class Layer112(Layerx, Layer11):
+ layer = '112' # Internal to samples. Not part of layer API
+ base = '11' # Internal to samples. Not part of layer API
+ layerx = '2' # Internal to samples. Not part of layer API
+ basex = '1'
+
+ def setUp(self):
+ global layer
+ if layer != self.base:
+ raise ValueError("Bad layer, %s, for %s." % (layer, self))
+ layer = self.layer
+ global layerx
+ if layerx != self.basex:
+ raise ValueError("Bad layerx, %s, for %s." % (layerx, self))
+ layerx = self.layerx
+ setUp = classmethod(setUp)
+
+ def tearDown(self):
+ global layer
+ if layer != self.layer:
+ raise ValueError("Bad layer, %s, for %s." % (layer, self))
+ layer = self.base
+ global layerx
+ if layerx != self.layerx:
+ raise ValueError("Bad layerx, %s, for %s." % (layerx, self))
+ layerx = self.basex
+ tearDown = classmethod(tearDown)
+
+class Layer122(Layer12):
+ layer = '122' # Internal to samples. Not part of layer API
+ base = '12' # Internal to samples. Not part of layer API
Modified: zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test11.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test11.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test11.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,127 +1,127 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import unittest
-from zope.testing import doctest
-import samplelayers
-
-layername = 'samplelayers.Layer11'
-layer = samplelayers.Layer11
-
-x=0
-y=0
-z=0
-
-class TestA(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global x
- x = 1
- def tearDown(self):
- global x
- x = 0
- def test_x1(self):
- self.assertEqual(x, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_y0(self):
- self.assertEqual(y, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-class TestB(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global y
- y = 1
- def tearDown(self):
- global y
- y = 0
- def test_y1(self):
- self.assertEqual(y, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_x0(self):
- self.assertEqual(x, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-
-class TestNotMuch(unittest.TestCase):
- layer = layername
-
- def test_1(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_2(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_3(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-def setUp(test):
- test.globs['z'] = 1
- test.globs['layer'] = layer.layer
- test.globs['layerx'] = layer.layerx
-
-def test_y0(self):
- """
- >>> y
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_x0(self):
- """
- >>> x
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_z1(self):
- """
- >>> z
- 1
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestA))
- suite.addTest(unittest.makeSuite(TestB))
- suite.addTest(unittest.makeSuite(TestNotMuch))
- s = doctest.DocTestSuite(setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- s = doctest.DocFileSuite('../sampletestsl.txt', setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- return suite
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+from zope.testing import doctest
+import samplelayers
+
+layername = 'samplelayers.Layer11'
+layer = samplelayers.Layer11
+
+x=0
+y=0
+z=0
+
+class TestA(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global x
+ x = 1
+ def tearDown(self):
+ global x
+ x = 0
+ def test_x1(self):
+ self.assertEqual(x, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_y0(self):
+ self.assertEqual(y, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+class TestB(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global y
+ y = 1
+ def tearDown(self):
+ global y
+ y = 0
+ def test_y1(self):
+ self.assertEqual(y, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_x0(self):
+ self.assertEqual(x, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+
+class TestNotMuch(unittest.TestCase):
+ layer = layername
+
+ def test_1(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_2(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_3(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+def setUp(test):
+ test.globs['z'] = 1
+ test.globs['layer'] = layer.layer
+ test.globs['layerx'] = layer.layerx
+
+def test_y0(self):
+ """
+ >>> y
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_x0(self):
+ """
+ >>> x
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_z1(self):
+ """
+ >>> z
+ 1
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestA))
+ suite.addTest(unittest.makeSuite(TestB))
+ suite.addTest(unittest.makeSuite(TestNotMuch))
+ s = doctest.DocTestSuite(setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ s = doctest.DocFileSuite('../sampletestsl.txt', setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ return suite
Modified: zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test111.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test111.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test111.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,127 +1,127 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import unittest
-from zope.testing import doctest
-import samplelayers
-
-layername = 'samplelayers.Layer111'
-layer = samplelayers.Layer111
-
-x=0
-y=0
-z=0
-
-class TestA(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global x
- x = 1
- def tearDown(self):
- global x
- x = 0
- def test_x1(self):
- self.assertEqual(x, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_y0(self):
- self.assertEqual(y, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-class TestB(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global y
- y = 1
- def tearDown(self):
- global y
- y = 0
- def test_y1(self):
- self.assertEqual(y, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_x0(self):
- self.assertEqual(x, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-
-class TestNotMuch(unittest.TestCase):
- layer = layername
-
- def test_1(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_2(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_3(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-def setUp(test):
- test.globs['z'] = 1
- test.globs['layer'] = layer.layer
- test.globs['layerx'] = layer.layerx
-
-def test_y0(self):
- """
- >>> y
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_x0(self):
- """
- >>> x
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_z1(self):
- """
- >>> z
- 1
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestA))
- suite.addTest(unittest.makeSuite(TestB))
- suite.addTest(unittest.makeSuite(TestNotMuch))
- s = doctest.DocTestSuite(setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- s = doctest.DocFileSuite('../sampletestsl.txt', setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- return suite
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+from zope.testing import doctest
+import samplelayers
+
+layername = 'samplelayers.Layer111'
+layer = samplelayers.Layer111
+
+x=0
+y=0
+z=0
+
+class TestA(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global x
+ x = 1
+ def tearDown(self):
+ global x
+ x = 0
+ def test_x1(self):
+ self.assertEqual(x, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_y0(self):
+ self.assertEqual(y, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+class TestB(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global y
+ y = 1
+ def tearDown(self):
+ global y
+ y = 0
+ def test_y1(self):
+ self.assertEqual(y, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_x0(self):
+ self.assertEqual(x, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+
+class TestNotMuch(unittest.TestCase):
+ layer = layername
+
+ def test_1(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_2(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_3(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+def setUp(test):
+ test.globs['z'] = 1
+ test.globs['layer'] = layer.layer
+ test.globs['layerx'] = layer.layerx
+
+def test_y0(self):
+ """
+ >>> y
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_x0(self):
+ """
+ >>> x
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_z1(self):
+ """
+ >>> z
+ 1
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestA))
+ suite.addTest(unittest.makeSuite(TestB))
+ suite.addTest(unittest.makeSuite(TestNotMuch))
+ s = doctest.DocTestSuite(setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ s = doctest.DocFileSuite('../sampletestsl.txt', setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ return suite
Modified: zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test112.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test112.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test112.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,128 +1,128 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import unittest
-from zope.testing import doctest
-import samplelayers
-
-layername = 'samplelayers.Layer112'
-layer = samplelayers.Layer112
-
-
-x=0
-y=0
-z=0
-
-class TestA(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global x
- x = 1
- def tearDown(self):
- global x
- x = 0
- def test_x1(self):
- self.assertEqual(x, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_y0(self):
- self.assertEqual(y, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-class TestB(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global y
- y = 1
- def tearDown(self):
- global y
- y = 0
- def test_y1(self):
- self.assertEqual(y, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_x0(self):
- self.assertEqual(x, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-
-class TestNotMuch(unittest.TestCase):
- layer = layername
-
- def test_1(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_2(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_3(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-def setUp(test):
- test.globs['z'] = 1
- test.globs['layer'] = layer.layer
- test.globs['layerx'] = layer.layerx
-
-def test_y0(self):
- """
- >>> y
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_x0(self):
- """
- >>> x
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_z1(self):
- """
- >>> z
- 1
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestA))
- suite.addTest(unittest.makeSuite(TestB))
- suite.addTest(unittest.makeSuite(TestNotMuch))
- s = doctest.DocTestSuite(setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- s = doctest.DocFileSuite('../sampletestsl.txt', setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- return suite
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+from zope.testing import doctest
+import samplelayers
+
+layername = 'samplelayers.Layer112'
+layer = samplelayers.Layer112
+
+
+x=0
+y=0
+z=0
+
+class TestA(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global x
+ x = 1
+ def tearDown(self):
+ global x
+ x = 0
+ def test_x1(self):
+ self.assertEqual(x, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_y0(self):
+ self.assertEqual(y, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+class TestB(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global y
+ y = 1
+ def tearDown(self):
+ global y
+ y = 0
+ def test_y1(self):
+ self.assertEqual(y, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_x0(self):
+ self.assertEqual(x, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+
+class TestNotMuch(unittest.TestCase):
+ layer = layername
+
+ def test_1(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_2(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_3(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+def setUp(test):
+ test.globs['z'] = 1
+ test.globs['layer'] = layer.layer
+ test.globs['layerx'] = layer.layerx
+
+def test_y0(self):
+ """
+ >>> y
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_x0(self):
+ """
+ >>> x
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_z1(self):
+ """
+ >>> z
+ 1
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestA))
+ suite.addTest(unittest.makeSuite(TestB))
+ suite.addTest(unittest.makeSuite(TestNotMuch))
+ s = doctest.DocTestSuite(setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ s = doctest.DocFileSuite('../sampletestsl.txt', setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ return suite
Modified: zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test12.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test12.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test12.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,127 +1,127 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import unittest
-from zope.testing import doctest
-import samplelayers
-
-layername = 'samplelayers.Layer12'
-layer = samplelayers.Layer12
-
-x=0
-y=0
-z=0
-
-class TestA(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global x
- x = 1
- def tearDown(self):
- global x
- x = 0
- def test_x1(self):
- self.assertEqual(x, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_y0(self):
- self.assertEqual(y, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-class TestB(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global y
- y = 1
- def tearDown(self):
- global y
- y = 0
- def test_y1(self):
- self.assertEqual(y, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_x0(self):
- self.assertEqual(x, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-
-class TestNotMuch(unittest.TestCase):
- layer = layername
-
- def test_1(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_2(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_3(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-def setUp(test):
- test.globs['z'] = 1
- test.globs['layer'] = layer.layer
- test.globs['layerx'] = layer.layerx
-
-def test_y0(self):
- """
- >>> y
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_x0(self):
- """
- >>> x
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_z1(self):
- """
- >>> z
- 1
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestA))
- suite.addTest(unittest.makeSuite(TestB))
- suite.addTest(unittest.makeSuite(TestNotMuch))
- s = doctest.DocTestSuite(setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- s = doctest.DocFileSuite('../sampletestsl.txt', setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- return suite
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+from zope.testing import doctest
+import samplelayers
+
+layername = 'samplelayers.Layer12'
+layer = samplelayers.Layer12
+
+x=0
+y=0
+z=0
+
+class TestA(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global x
+ x = 1
+ def tearDown(self):
+ global x
+ x = 0
+ def test_x1(self):
+ self.assertEqual(x, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_y0(self):
+ self.assertEqual(y, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+class TestB(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global y
+ y = 1
+ def tearDown(self):
+ global y
+ y = 0
+ def test_y1(self):
+ self.assertEqual(y, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_x0(self):
+ self.assertEqual(x, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+
+class TestNotMuch(unittest.TestCase):
+ layer = layername
+
+ def test_1(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_2(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_3(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+def setUp(test):
+ test.globs['z'] = 1
+ test.globs['layer'] = layer.layer
+ test.globs['layerx'] = layer.layerx
+
+def test_y0(self):
+ """
+ >>> y
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_x0(self):
+ """
+ >>> x
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_z1(self):
+ """
+ >>> z
+ 1
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestA))
+ suite.addTest(unittest.makeSuite(TestB))
+ suite.addTest(unittest.makeSuite(TestNotMuch))
+ s = doctest.DocTestSuite(setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ s = doctest.DocFileSuite('../sampletestsl.txt', setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ return suite
Modified: zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test121.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test121.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test121.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,127 +1,127 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import unittest
-from zope.testing import doctest
-import samplelayers
-
-layername = 'samplelayers.Layer121'
-layer = samplelayers.Layer121
-
-x=0
-y=0
-z=0
-
-class TestA(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global x
- x = 1
- def tearDown(self):
- global x
- x = 0
- def test_x1(self):
- self.assertEqual(x, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_y0(self):
- self.assertEqual(y, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-class TestB(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global y
- y = 1
- def tearDown(self):
- global y
- y = 0
- def test_y1(self):
- self.assertEqual(y, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_x0(self):
- self.assertEqual(x, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-
-class TestNotMuch(unittest.TestCase):
- layer = layername
-
- def test_1(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_2(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_3(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-def setUp(test):
- test.globs['z'] = 1
- test.globs['layer'] = layer.layer
- test.globs['layerx'] = layer.layerx
-
-def test_y0(self):
- """
- >>> y
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_x0(self):
- """
- >>> x
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_z1(self):
- """
- >>> z
- 1
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestA))
- suite.addTest(unittest.makeSuite(TestB))
- suite.addTest(unittest.makeSuite(TestNotMuch))
- s = doctest.DocTestSuite(setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- s = doctest.DocFileSuite('../sampletestsl.txt', setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- return suite
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+from zope.testing import doctest
+import samplelayers
+
+layername = 'samplelayers.Layer121'
+layer = samplelayers.Layer121
+
+x=0
+y=0
+z=0
+
+class TestA(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global x
+ x = 1
+ def tearDown(self):
+ global x
+ x = 0
+ def test_x1(self):
+ self.assertEqual(x, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_y0(self):
+ self.assertEqual(y, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+class TestB(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global y
+ y = 1
+ def tearDown(self):
+ global y
+ y = 0
+ def test_y1(self):
+ self.assertEqual(y, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_x0(self):
+ self.assertEqual(x, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+
+class TestNotMuch(unittest.TestCase):
+ layer = layername
+
+ def test_1(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_2(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_3(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+def setUp(test):
+ test.globs['z'] = 1
+ test.globs['layer'] = layer.layer
+ test.globs['layerx'] = layer.layerx
+
+def test_y0(self):
+ """
+ >>> y
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_x0(self):
+ """
+ >>> x
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_z1(self):
+ """
+ >>> z
+ 1
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestA))
+ suite.addTest(unittest.makeSuite(TestB))
+ suite.addTest(unittest.makeSuite(TestNotMuch))
+ s = doctest.DocTestSuite(setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ s = doctest.DocFileSuite('../sampletestsl.txt', setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ return suite
Modified: zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test122.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test122.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sampletests/test122.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,127 +1,127 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import unittest
-from zope.testing import doctest
-import samplelayers
-
-layername = 'samplelayers.Layer122'
-layer = samplelayers.Layer122
-
-x=0
-y=0
-z=0
-
-class TestA(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global x
- x = 1
- def tearDown(self):
- global x
- x = 0
- def test_x1(self):
- self.assertEqual(x, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_y0(self):
- self.assertEqual(y, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-class TestB(unittest.TestCase):
- layer = layername
-
- def setUp(self):
- global y
- y = 1
- def tearDown(self):
- global y
- y = 0
- def test_y1(self):
- self.assertEqual(y, 1)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_x0(self):
- self.assertEqual(x, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-
-class TestNotMuch(unittest.TestCase):
- layer = layername
-
- def test_1(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_2(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
- def test_3(self):
- self.assertEqual(samplelayers.layer, layer.layer)
- self.assertEqual(samplelayers.layerx, layer.layerx)
-
-def setUp(test):
- test.globs['z'] = 1
- test.globs['layer'] = layer.layer
- test.globs['layerx'] = layer.layerx
-
-def test_y0(self):
- """
- >>> y
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_x0(self):
- """
- >>> x
- 0
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_z1(self):
- """
- >>> z
- 1
-
- >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
- (True, True)
- """
-
-def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestA))
- suite.addTest(unittest.makeSuite(TestB))
- suite.addTest(unittest.makeSuite(TestNotMuch))
- s = doctest.DocTestSuite(setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- s = doctest.DocFileSuite('../sampletestsl.txt', setUp=setUp)
- s.layer = layer
- suite.addTest(s)
- return suite
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+from zope.testing import doctest
+import samplelayers
+
+layername = 'samplelayers.Layer122'
+layer = samplelayers.Layer122
+
+x=0
+y=0
+z=0
+
+class TestA(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global x
+ x = 1
+ def tearDown(self):
+ global x
+ x = 0
+ def test_x1(self):
+ self.assertEqual(x, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_y0(self):
+ self.assertEqual(y, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+class TestB(unittest.TestCase):
+ layer = layername
+
+ def setUp(self):
+ global y
+ y = 1
+ def tearDown(self):
+ global y
+ y = 0
+ def test_y1(self):
+ self.assertEqual(y, 1)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_x0(self):
+ self.assertEqual(x, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+
+class TestNotMuch(unittest.TestCase):
+ layer = layername
+
+ def test_1(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_2(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+ def test_3(self):
+ self.assertEqual(samplelayers.layer, layer.layer)
+ self.assertEqual(samplelayers.layerx, layer.layerx)
+
+def setUp(test):
+ test.globs['z'] = 1
+ test.globs['layer'] = layer.layer
+ test.globs['layerx'] = layer.layerx
+
+def test_y0(self):
+ """
+ >>> y
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_x0(self):
+ """
+ >>> x
+ 0
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_z1(self):
+ """
+ >>> z
+ 1
+
+ >>> (layer == samplelayers.layer), (layerx == samplelayers.layerx)
+ (True, True)
+ """
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestA))
+ suite.addTest(unittest.makeSuite(TestB))
+ suite.addTest(unittest.makeSuite(TestNotMuch))
+ s = doctest.DocTestSuite(setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ s = doctest.DocFileSuite('../sampletestsl.txt', setUp=setUp)
+ s.layer = layer
+ suite.addTest(s)
+ return suite
Modified: zope.testing/trunk/src/zope/testing/testrunner-ex/sampletestsf.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner-ex/sampletestsf.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/testrunner-ex/sampletestsf.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,172 +1,172 @@
-##############################################################################
-#
-# Copyright (c) 2003 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import unittest
-from zope.testing import doctest
-
-x=0
-y=0
-z=0
-
-class TestA(unittest.TestCase):
- def setUp(self):
- global x
- x = 1
- def tearDown(self):
- global x
- x = 0
- def test_x1(self):
- self.assertEqual(x, 1)
- def test_y0(self):
- self.assertEqual(y, 0)
- def test_z0(self):
- self.assertEqual(z, 0)
-
-class TestA2(unittest.TestCase):
- level = 2
-
- def setUp(self):
- global x
- x = 1
- def tearDown(self):
- global x
- x = 0
- def test_x1(self):
- self.assertEqual(x, 1)
- def test_y0(self):
- self.assertEqual(y, 0)
- def test_z0(self):
- self.assertEqual(z, 0)
-
-class TestB(unittest.TestCase):
- def setUp(self):
- global y
- y = 1
- def tearDown(self):
- global y
- y = 0
- def test_y1(self):
- self.assertEqual(y, 1)
- def test_x0(self):
- self.assertEqual(x, 0)
- def test_z0(self):
- self.assertEqual(z, 0)
-
-
-class TestNotMuch(unittest.TestCase):
- def test_1(self):
- pass
- def test_2(self):
- pass
- def test_3(self):
- pass
-
-
-def setUp(test):
- test.globs['z'] = 1
-
-
-def test_y0(self):
- """
- >>> y
- 0
- """
-
-def test_x0(self):
- """
- >>> x
- 0
- """
-
-def test_z1(self):
- """
- >>> z
- 1
- """
-
-import samplelayers
-
-class Layered:
-
- layer = 'samplelayers.Layer1'
- layerv = '1'
- layerx = '0'
-
-class TestA1(unittest.TestCase, Layered):
-
- def setUp(self):
- global x
- x = 1
- def tearDown(self):
- global x
- x = 0
- def test_x1(self):
- self.assertEqual(x, 1)
- self.assertEqual(samplelayers.layer, self.layerv)
- self.assertEqual(samplelayers.layerx, self.layerx)
- def test_y0(self):
- self.assertEqual(y, 0)
- self.assertEqual(samplelayers.layer, self.layerv)
- self.assertEqual(samplelayers.layerx, self.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, self.layerv)
- self.assertEqual(samplelayers.layerx, self.layerx)
-
-class TestB1(unittest.TestCase, Layered):
- def setUp(self):
- global y
- y = 1
- def tearDown(self):
- global y
- y = 0
- def test_y1(self):
- self.assertEqual(y, 1)
- self.assertEqual(samplelayers.layer, self.layerv)
- self.assertEqual(samplelayers.layerx, self.layerx)
- def test_x0(self):
- self.assertEqual(x, 0)
- self.assertEqual(samplelayers.layer, self.layerv)
- self.assertEqual(samplelayers.layerx, self.layerx)
- def test_z0(self):
- self.assertEqual(z, 0)
- self.assertEqual(samplelayers.layer, self.layerv)
- self.assertEqual(samplelayers.layerx, self.layerx)
-
-
-class TestNotMuch1(unittest.TestCase, Layered):
- def test_1(self):
- self.assertEqual(samplelayers.layer, self.layerv)
- self.assertEqual(samplelayers.layerx, self.layerx)
- def test_2(self):
- self.assertEqual(samplelayers.layer, self.layerv)
- self.assertEqual(samplelayers.layerx, self.layerx)
- def test_3(self):
- self.assertEqual(samplelayers.layer, self.layerv)
- self.assertEqual(samplelayers.layerx, self.layerx)
-
-
-
-def test_suite():
- suite = unittest.TestSuite()
- suite.addTest(unittest.makeSuite(TestA))
- suite.addTest(unittest.makeSuite(TestA2))
- suite.addTest(unittest.makeSuite(TestB))
- suite.addTest(unittest.makeSuite(TestNotMuch))
- suite.addTest(doctest.DocTestSuite(setUp=setUp))
- suite.addTest(doctest.DocFileSuite('sampletests.txt', setUp=setUp))
- suite.addTest(unittest.makeSuite(TestA1))
- suite.addTest(unittest.makeSuite(TestB1))
- suite.addTest(unittest.makeSuite(TestNotMuch1))
- return suite
+##############################################################################
+#
+# Copyright (c) 2003 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+import unittest
+from zope.testing import doctest
+
+x=0
+y=0
+z=0
+
+class TestA(unittest.TestCase):
+ def setUp(self):
+ global x
+ x = 1
+ def tearDown(self):
+ global x
+ x = 0
+ def test_x1(self):
+ self.assertEqual(x, 1)
+ def test_y0(self):
+ self.assertEqual(y, 0)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+
+class TestA2(unittest.TestCase):
+ level = 2
+
+ def setUp(self):
+ global x
+ x = 1
+ def tearDown(self):
+ global x
+ x = 0
+ def test_x1(self):
+ self.assertEqual(x, 1)
+ def test_y0(self):
+ self.assertEqual(y, 0)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+
+class TestB(unittest.TestCase):
+ def setUp(self):
+ global y
+ y = 1
+ def tearDown(self):
+ global y
+ y = 0
+ def test_y1(self):
+ self.assertEqual(y, 1)
+ def test_x0(self):
+ self.assertEqual(x, 0)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+
+
+class TestNotMuch(unittest.TestCase):
+ def test_1(self):
+ pass
+ def test_2(self):
+ pass
+ def test_3(self):
+ pass
+
+
+def setUp(test):
+ test.globs['z'] = 1
+
+
+def test_y0(self):
+ """
+ >>> y
+ 0
+ """
+
+def test_x0(self):
+ """
+ >>> x
+ 0
+ """
+
+def test_z1(self):
+ """
+ >>> z
+ 1
+ """
+
+import samplelayers
+
+class Layered:
+
+ layer = 'samplelayers.Layer1'
+ layerv = '1'
+ layerx = '0'
+
+class TestA1(unittest.TestCase, Layered):
+
+ def setUp(self):
+ global x
+ x = 1
+ def tearDown(self):
+ global x
+ x = 0
+ def test_x1(self):
+ self.assertEqual(x, 1)
+ self.assertEqual(samplelayers.layer, self.layerv)
+ self.assertEqual(samplelayers.layerx, self.layerx)
+ def test_y0(self):
+ self.assertEqual(y, 0)
+ self.assertEqual(samplelayers.layer, self.layerv)
+ self.assertEqual(samplelayers.layerx, self.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, self.layerv)
+ self.assertEqual(samplelayers.layerx, self.layerx)
+
+class TestB1(unittest.TestCase, Layered):
+ def setUp(self):
+ global y
+ y = 1
+ def tearDown(self):
+ global y
+ y = 0
+ def test_y1(self):
+ self.assertEqual(y, 1)
+ self.assertEqual(samplelayers.layer, self.layerv)
+ self.assertEqual(samplelayers.layerx, self.layerx)
+ def test_x0(self):
+ self.assertEqual(x, 0)
+ self.assertEqual(samplelayers.layer, self.layerv)
+ self.assertEqual(samplelayers.layerx, self.layerx)
+ def test_z0(self):
+ self.assertEqual(z, 0)
+ self.assertEqual(samplelayers.layer, self.layerv)
+ self.assertEqual(samplelayers.layerx, self.layerx)
+
+
+class TestNotMuch1(unittest.TestCase, Layered):
+ def test_1(self):
+ self.assertEqual(samplelayers.layer, self.layerv)
+ self.assertEqual(samplelayers.layerx, self.layerx)
+ def test_2(self):
+ self.assertEqual(samplelayers.layer, self.layerv)
+ self.assertEqual(samplelayers.layerx, self.layerx)
+ def test_3(self):
+ self.assertEqual(samplelayers.layer, self.layerv)
+ self.assertEqual(samplelayers.layerx, self.layerx)
+
+
+
+def test_suite():
+ suite = unittest.TestSuite()
+ suite.addTest(unittest.makeSuite(TestA))
+ suite.addTest(unittest.makeSuite(TestA2))
+ suite.addTest(unittest.makeSuite(TestB))
+ suite.addTest(unittest.makeSuite(TestNotMuch))
+ suite.addTest(doctest.DocTestSuite(setUp=setUp))
+ suite.addTest(doctest.DocFileSuite('sampletests.txt', setUp=setUp))
+ suite.addTest(unittest.makeSuite(TestA1))
+ suite.addTest(unittest.makeSuite(TestB1))
+ suite.addTest(unittest.makeSuite(TestNotMuch1))
+ return suite
Modified: zope.testing/trunk/src/zope/testing/testrunner.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner.py 2005-05-25 15:54:07 UTC (rev 30498)
+++ zope.testing/trunk/src/zope/testing/testrunner.py 2005-05-25 17:08:28 UTC (rev 30499)
@@ -1,979 +1,979 @@
-##############################################################################
-#
-# Copyright (c) 2004 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Test runner
-
-$Id$
-"""
-
-# Too bad: For now, we depend on zope.testing. This is because
-# we want to use the latest, greatest doctest, which zope.testing
-# provides. Then again, zope.testing is generally useful.
-from zope.testing import doctest
-import gc
-import logging
-import optparse
-import os
-import pdb
-import re
-import sys
-import time
-import traceback
-import threading
-import unittest
-
-
-def run(defaults=None, args=None):
- options = get_options(args, defaults)
- run_with_options(options)
-
-def run_with_options(options):
-
- if options.verbose:
- if options.all:
- print "Running tests at all levels"
- else:
- print "Running tests at level %d" % options.at_level
-
-
- # XXX add tracing later
-
- # Add directories to the path
- for path in options.path:
- if path not in sys.path:
- sys.path.append(path)
-
- remove_stale_bytecode(options)
-
- configure_logging()
-
- tests_by_layer_name = find_tests(options)
-
-
- ran = 0
- failures = []
- errors = []
- nlayers = 0
- if 'unit' in tests_by_layer_name:
- tests = tests_by_layer_name.pop('unit')
- if not options.non_unit:
- if options.layer:
- should_run = False
- for pat in options.layer:
- if pat('unit'):
- should_run = True
- break
- else:
- should_run = True
-
- if should_run:
- print "Running unit tests:"
- nlayers += 1
- ran += run_tests(options, tests, 'unit', failures, errors)
-
- setup_layers = {}
- for layer_name, layer, tests in ordered_layers(tests_by_layer_name):
- if options.layer:
- should_run = False
- for pat in options.layer:
- if pat(layer_name):
- should_run = True
- break
- else:
- should_run = True
-
- if should_run:
- nlayers += 1
- ran += run_layer(options, layer_name, layer, tests, setup_layers,
- failures, errors)
-
- if setup_layers:
- print "Tearing down left over layers:"
- tear_down_unneeded((), setup_layers)
-
- if options.verbose > 1:
- if errors:
- print
- print "Tests with errors:"
- for test, exc_info in errors:
- print " ", test
-
- if failures:
- print
- print "Tests with failures:"
- for test, exc_info in failures:
- print " ", test
-
- if nlayers != 1:
- print "Total: %s tests, %s failures, %s errors" % (
- ran, len(failures), len(errors))
-
-
-def run_tests(options, tests, name, failures, errors):
- repeat = options.repeat or 1
- ran = 0
- for i in range(repeat):
- if repeat > 1:
- print "Iteration", i+1
-
- if options.verbose > 0 or options.progress:
- print ' Running:'
- if options.verbose == 1 and not options.progress:
- print ' ',
- result = TestResult(options, tests)
- t = time.time()
- tests(result)
- t = time.time() - t
- if options.verbose == 1 or options.progress:
- print
- failures.extend(result.failures)
- errors.extend(result.errors)
- print (
- " Ran %s tests with %s failures and %s errors in %.3f seconds." %
- (result.testsRun, len(result.failures), len(result.errors), t)
- )
- ran += result.testsRun
-
- return ran
-
-
-def run_layer(options, layer_name, layer, tests, setup_layers,
- failures, errors):
- print "Running %s tests:" % layer_name
-
- gathered = []
- gather_layers(layer, gathered)
- needed = dict([(l, 1) for l in gathered])
- tear_down_unneeded(needed, setup_layers)
-
- setup_layer(layer, setup_layers)
- return run_tests(options, tests, layer_name, failures, errors)
-
-def tear_down_unneeded(needed, setup_layers):
- # Tear down any layers not needed for these tests. The unneeded
- # layers might interfere.
- unneeded = [l for l in setup_layers if l not in needed]
- unneeded = order_by_bases(unneeded)
- unneeded.reverse()
- for l in unneeded:
- print " Tear down %s" % name_from_layer(l),
- t = time.time()
- l.tearDown()
- del setup_layers[l]
- print "in %.3f seconds." % (time.time() - t)
-
-
-def setup_layer(layer, setup_layers):
- if layer not in setup_layers:
- for base in layer.__bases__:
- setup_layer(base, setup_layers)
- print " Set up %s.%s" % (layer.__module__, layer.__name__),
- t = time.time()
- layer.setUp()
- print "in %.3f seconds." % (time.time() - t)
- setup_layers[layer] = 1
-
-def dependencies(bases, result):
- for base in bases:
- result[base] = 1
- dependencies(base.__bases__, result)
-
-
-
-class TestResult(unittest.TestResult):
-
- def __init__(self, options, tests):
- unittest.TestResult.__init__(self)
- self.options = options
- if options.progress:
- count = 0
- for test in tests:
- count += test.countTestCases()
- self.count = count
- self.last_width = 0
-
- def startTest(self, test):
- unittest.TestResult.startTest(self, test)
- testsRun = self.testsRun - 1
- count = test.countTestCases()
- self.testsRun = testsRun + count
- options = self.options
- self.test_width = 0
-
- if options.progress:
- s = " %d/%d (%.1f%%)" % (
- self.testsRun, self.count,
- (self.testsRun) * 100.0 / self.count
- )
- sys.stdout.write(s)
- self.test_width += len(s)
-
- elif options.verbose == 1:
- for i in range(count):
- sys.stdout.write('.')
- testsRun += 1
- if (testsRun % 50) == 0:
- print
- print ' ',
- elif options.verbose > 1:
- print ' ',
-
- if options.verbose > 1:
- s = str(test)
- sys.stdout.write(' ')
- sys.stdout.write(s)
- self.test_width += len(s) + 1
-
- sys.stdout.flush()
-
- self._threads = threading.enumerate()
- self._start_time = time.time()
-
- def addSuccess(self, test):
- if self.options.verbose > 2:
- t = max(time.time() - self._start_time, 0.0)
- s = " (%.3f ms)" % t
- sys.stdout.write(s)
- self.test_width += len(s) + 1
-
- def addError(self, test, exc_info):
- if self.options.verbose > 2:
- print " (%.3f ms)" % (time.time() - self._start_time)
-
- unittest.TestResult.addError(self, test, exc_info)
- print
- self._print_traceback("Error in test %s" % test, exc_info)
-
- if self.options.post_mortem:
- post_mortem(exc_info)
-
- self.test_width = self.last_width = 0
-
- def addFailure(self, test, exc_info):
-
- if self.options.verbose > 2:
- print " (%.3f ms)" % (time.time() - self._start_time)
-
- unittest.TestResult.addFailure(self, test, exc_info)
- print
- self._print_traceback("Failure in test %s" % test, exc_info)
-
- if self.options.post_mortem:
- post_mortem(exc_info)
-
- self.test_width = self.last_width = 0
-
-
- def _print_traceback(self, msg, exc_info):
- print
- print msg
-
- v = exc_info[1]
- if isinstance(v, doctest.DocTestFailureException):
- tb = v.args[0]
- else:
- tb = "".join(traceback.format_exception(*exc_info))
-
- print tb
-
- def stopTest(self, test):
- if self.options.progress:
- sys.stdout.write(' ' * (self.last_width - self.test_width) + "\r")
- self.last_width = self.test_width
- elif self.options.verbose > 1:
- print
-
- if gc.garbage:
- print "The following test left garbage:"
- print test
- print gc.garbage
- # TODO: Perhaps eat the garbage here, so that the garbage isn't
- # printed for every subsequent test.
-
- # Did the test leave any new threads behind?
- new_threads = [t for t in threading.enumerate()
- if (t.isAlive()
- and
- t not in self._threads)]
- if new_threads:
- print "The following test left new threads behind:"
- print test
- print "New thread(s):", new_threads
-
- sys.stdout.flush()
-
-def post_mortem(exc_info):
- err = exc_info[1]
- if isinstance(err, (doctest.UnexpectedException, doctest.DocTestFailure)):
-
- if isinstance(err, doctest.UnexpectedException):
- exc_info = err.exc_info
-
- # Print out location info if the error was in a doctest
- if exc_info[2].tb_frame.f_code.co_filename == '<string>':
- print_doctest_location(err)
-
- else:
- print_doctest_location(err)
- # Hm, we have a DocTestFailure exception. We need to
- # generate our own traceback
- try:
- exec ('raise ValueError'
- '("Expected and actual output are different")'
- ) in err.test.globs
- except:
- exc_info = sys.exc_info()
-
- print "%s:" % (exc_info[0], )
- print exc_info[1]
- pdb.post_mortem(exc_info[2])
- sys.exit()
-
-def print_doctest_location(err):
- # This mimicks pdb's output, which gives way cool results in emacs :)
- filename = err.test.filename
- if filename.endswith('.pyc'):
- filename = filename[:-1]
- print "> %s(%s)_()" % (filename, err.test.lineno+err.example.lineno+1)
-
-def ordered_layers(tests_by_layer_name):
- layer_names = dict([(layer_from_name(layer_name), layer_name)
- for layer_name in tests_by_layer_name])
- for layer in order_by_bases(layer_names):
- layer_name = layer_names[layer]
- yield layer_name, layer, tests_by_layer_name[layer_name]
-
-def gather_layers(layer, result):
- result.append(layer)
- for b in layer.__bases__:
- gather_layers(b, result)
-
-def layer_from_name(layer_name):
- layer_names = layer_name.split('.')
- layer_module, module_layer_name = layer_names[:-1], layer_names[-1]
- return getattr(import_name('.'.join(layer_module)), module_layer_name)
-
-
-def order_by_bases(layers):
- """Order the layers from least to most specific (bottom to top)
- """
- named_layers = [(name_from_layer(layer), layer) for layer in layers]
- named_layers.sort()
- gathered = []
- for name, layer in named_layers:
- gather_layers(layer, gathered)
- gathered.reverse()
- seen = {}
- result = []
- for layer in gathered:
- if layer not in seen:
- seen[layer] = 1
- if layer in layers:
- result.append(layer)
- return result
-
-def name_from_layer(layer):
- return layer.__module__ + '.' + layer.__name__
-
-def find_tests(options):
- suites = {}
- for suite in find_suites(options):
- for test, layer_name in tests_from_suite(suite, options):
- suite = suites.get(layer_name)
- if not suite:
- suite = suites[layer_name] = unittest.TestSuite()
- suite.addTest(test)
- return suites
-
-def tests_from_suite(suite, options, dlevel=1, dlayer='unit'):
- level = getattr(suite, 'level', dlevel)
- layer = getattr(suite, 'layer', dlayer)
- if not isinstance(layer, basestring):
- layer = layer.__module__ + '.' + layer.__name__
-
- if isinstance(suite, unittest.TestSuite):
- for possible_suite in suite:
- for r in tests_from_suite(possible_suite, options, level, layer):
- yield r
- else:
- if level <= options.at_level:
- for pat in options.test:
- if pat(str(suite)):
- yield (suite, layer)
- break
-
-def find_suites(options):
- for fpath in find_test_files(options):
- for prefix in options.prefix:
- if fpath.startswith(prefix):
- # strip prefix, strip .py suffix and convert separator to dots
- module_name = fpath[len(prefix):-3].replace(os.path.sep, '.')
- try:
- module = import_name(module_name)
- suite = getattr(module, options.suite_name)()
- except:
- suite = StartUpFailure(
- options,
- "Couldn't get suite for %s" % module_name,
- sys.exc_info()
- )
-
- yield suite
- break
-
-class StartUpFailure(unittest.TestCase):
-
- def __init__(self, options, message, exc_info):
- if options.post_mortem:
- post_mortem(exc_info)
- unittest.TestCase.__init__(self)
- self.message = message
- self.exc_info = exc_info
-
- def __str__(self):
- return "Startup failure: %s" % self.message
-
- def runTest(self):
- raise self.exc_info[0], self.exc_info[1], self.exc_info[2]
-
-
-def find_test_files(options):
- found = {}
- for f in find_test_files_(options):
- for filter in options.module:
- if filter(f):
- if f not in found:
- found[f] = 1
- yield f
- break
-
-def find_test_files_(options):
- tests_pattern = options.tests_pattern
- test_file_pattern = options.test_file_pattern
- for p in test_dirs(options, {}):
- for dirname, dirs, files in walk_with_symlinks(options, p):
- d = os.path.split(dirname)[1]
- if tests_pattern(d) and ('__init__.py' in files):
- # tests directory
- for file in files:
- if file.endswith('.py') and test_file_pattern(file[:-3]):
- f = os.path.join(dirname, file)
- yield f
-
- for file in files:
- if file.endswith('.py') and tests_pattern(file[:-3]):
- f = os.path.join(dirname, file)
- yield f
-
-
-def walk_with_symlinks(options, dir):
- for dirpath, dirs, files in os.walk(dir):
- dirs.sort()
- files.sort()
- dirs[:] = [d for d in dirs if d not in options.ignore_dir]
- yield (dirpath, dirs, files)
- for d in dirs:
- p = os.path.join(dirpath, d)
- if os.path.islink(p):
- for dirpath, dirs, files in walk_with_symlinks(options, p):
- yield (dirpath, dirs, files)
-
-compiled_sufixes = '.pyc', '.pyo'
-def remove_stale_bytecode(options):
- if options.keepbytecode:
- return
- for p in options.path:
- for dirname, dirs, files in walk_with_symlinks(options, p):
- for file in files:
- if file[-4:] in compiled_sufixes and file[:-1] not in files:
- fullname = os.path.join(dirname, file)
- print "Removing stale bytecode file", fullname
- os.unlink(fullname)
-
-
-def test_dirs(options, seen):
- if options.package:
- for p in options.package:
- p = import_name(p)
- for p in p.__path__:
- p = os.path.abspath(p)
- if p in seen:
- continue
- for prefix in options.prefix:
- if p.startswith(prefix):
- seen[p] = 1
- yield p
- break
- else:
- for dpath in options.path:
- yield dpath
-
-
-def import_name(name):
- __import__(name)
- return sys.modules[name]
-
-def configure_logging():
- """Initialize the logging module."""
- import logging.config
-
- # Get the log.ini file from the current directory instead of
- # possibly buried in the build directory. TODO: This isn't
- # perfect because if log.ini specifies a log file, it'll be
- # relative to the build directory. Hmm... logini =
- # os.path.abspath("log.ini")
-
- logini = os.path.abspath("log.ini")
- if os.path.exists(logini):
- logging.config.fileConfig(logini)
- else:
- # If there's no log.ini, cause the logging package to be
- # silent during testing.
- root = logging.getLogger()
- root.addHandler(NullHandler())
- logging.basicConfig()
-
- if os.environ.has_key("LOGGING"):
- level = int(os.environ["LOGGING"])
- logging.getLogger().setLevel(level)
-
-class NullHandler(logging.Handler):
- """Logging handler that drops everything on the floor.
-
- We require silence in the test environment. Hush.
- """
-
- def emit(self, record):
- pass
-
-
-
-###############################################################################
-# Command-line UI
-
-parser = optparse.OptionParser("Usage: %prog [options] [MODULE] [TEST]")
-
-######################################################################
-# Searching and filtering
-
-searching = optparse.OptionGroup(parser, "Searching and filtering", """\
-Options in this group are used to define which tests to run.
-""")
-
-searching.add_option(
- '--package', '--dir', '-s', action="append", dest='package',
- help="""\
-Search the given package's directories for tests. This can be
-specified more than once to run tests in multiple parts of the source
-tree. For example, if refactoring interfaces, you don't want to see
-the way you have broken setups for tests in other packages. You *just*
-want to run the interface tests.
-
-Packages are supplied as dotted names. For compatibility with the old
-test runner, forward and backward slashed in package names are
-converted to dots.
-
-(In the special case of packages spread over multiple directories,
-only directories within the test search path are searched. See the
---path option.)
-
-""")
-
-searching.add_option(
- '--module', '-m', action="append", dest='module',
- help="""\
-Specify a test-module filter as a regular expression. This is a
-case-sensitive regular expression, used in search (not match) mode, to
-limit which test modules are searched for tests. In an extension of
-Python regexp notation, a leading "!" is stripped and causes the sense
-of the remaining regexp to be negated (so "!bc" matches any string
-that does not match "bc", and vice versa). The option can be
-specified multiple test-module filters. Test modules matching any of
-the test filters are searched. If no test-module filter is specified,
-then all test moduless are used.
-""")
-
-searching.add_option(
- '--test', '-t', action="append", dest='test',
- help="""\
-Specify a test filter as a regular expression. This is a
-case-sensitive regular expression, used in search (not match) mode, to
-limit which tests are run. In an extension of Python regexp notation,
-a leading "!" is stripped and causes the sense of the remaining regexp
-to be negated (so "!bc" matches any string that does not match "bc",
-and vice versa). The option can be specified multiple test filters.
-Tests matching any of the test filters are included. If no test
-filter is specified, then all tests are run.
-""")
-
-searching.add_option(
- '--unit', '-u', action="store_true", dest='unit',
- help="""\
-Run only unit tests, ignoring any layer options.
-""")
-
-searching.add_option(
- '--non-unit', '-f', action="store_true", dest='non_unit',
- help="""\
-Run tests other than unit tests.
-""")
-
-searching.add_option(
- '--layer', action="append", dest='layer',
- help="""\
-Specify a test layer to run. The option can be given multiple times
-to specify more than one layer. If not specified, all layers are run.
-It is common for the running script to provide default values for this
-option. Layers are specified regular expressions, used in search
-mode, for dotted names of objects that define a layer. In an
-extension of Python regexp notation, a leading "!" is stripped and
-causes the sense of the remaining regexp to be negated (so "!bc"
-matches any string that does not match "bc", and vice versa). The
-layer named 'unit' is reserved for unit tests, however, take note of
-the --unit and non-unit options.
-""")
-
-searching.add_option(
- '-a', '--at-level', type='int', dest='at_level',
- help="""\
-Run the tests at the given level. Any test at a level at or below
-this is run, any test at a level above this is not run. Level 0
-runs all tests.
-""")
-
-searching.add_option(
- '--all', action="store_true", dest='all',
- help="Run tests at all levels.")
-
-parser.add_option_group(searching)
-
-######################################################################
-# Reporting
-
-reporting = optparse.OptionGroup(parser, "Reporting", """\
-Reporting options control basic aspects of test-runner output
-""")
-
-reporting.add_option(
- '--verbose', '-v', action="count", dest='verbose',
- help="""\
-Increment the verbosity level.
-""")
-
-reporting.add_option(
- '--progress', '-p', action="store_true", dest='progress',
- help="""\
-Output progress status
-""")
-
-def report_only_first_failure(*args):
- old = doctest.set_unittest_reportflags(0)
- doctest.set_unittest_reportflags(old | doctest.REPORT_ONLY_FIRST_FAILURE)
-
-reporting.add_option(
- '-1', action="callback", callback=report_only_first_failure,
- help="""\
-Report only the first failure in a doctest. (Examples after the
-failure are still executed, in case they do any cleanup.)
-""")
-
-parser.add_option_group(reporting)
-
-######################################################################
-# Analysis
-
-analysis = optparse.OptionGroup(parser, "Analysis", """\
-Analysis options provide tools for analysing test output.
-""")
-
-
-analysis.add_option(
- '--post-mortem', '-D', action="store_true", dest='post_mortem',
- help="Enable post-mortem debugging of test failures"
- )
-
-
-def gc_callback(option, opt, GC_THRESHOLD, *args):
- import gc
- if GC_THRESHOLD == 0:
- gc.disable()
- print "gc disabled"
- else:
- gc.set_threshold(GC_THRESHOLD)
- print "gc threshold:", gc.get_threshold()
-
-analysis.add_option(
- '--gc', action="callback", callback=gc_callback, dest='gc', type="int",
- help="""\
-Set the garbage collector generation0 threshold. This can be used
-to stress memory and gc correctness. Some crashes are only
-reproducible when the threshold is set to 1 (agressive garbage
-collection). Do "--gc 0" to disable garbage collection altogether.
-""")
-
-analysis.add_option(
- '--repeat', action="store", type="int", dest='repeat',
- help="""\
-Repeat the testst the given number of times. This option is used to
-make sure that tests leave thier environment in the state they found
-it and, with the --refcount option to look for memory leaks.
-""")
-
-def refcount_available(*args):
- if not hasattr(sys, "gettotalrefcount"):
- raise optparse.OptionValueError("""\
-The Python you are running was not configured with --with-pydebug.
-This is required to use the --refount option.
-""")
-
-analysis.add_option(
- '--refcount',
- action="callback", callback=refcount_available,
- dest='refcount',
- help="""\
-After each run of the tests, output a report summarizing changes in
-refcounts by object type. This option that requires that Python was
-built with the --with-pydebug option to configure.
-""")
-
-analysis.add_option(
- '--coverage', action="store", dest='coverage',
- help="""\
-Perform code-coverage analysis, saving trace data to the directory
-with the given anme. A code coverage summary is printed to standard
-out.
-""")
-
-def do_pychecker(*args):
- if not os.environ.get("PYCHECKER"):
- os.environ["PYCHECKER"] = "-q"
- import pychecker.checker
-
-analysis.add_option(
- '--pychecker', action="callback", callback=do_pychecker,
- help="""\
-Run the tests under pychecker
-""")
-
-parser.add_option_group(analysis)
-
-######################################################################
-# Setup
-
-setup = optparse.OptionGroup(parser, "Setup", """\
-Setup options are normally supplied by the testrunner script, although
-they can be overridden by users.
-""")
-
-setup.add_option(
- '--path', action="append", dest='path',
- help="""\
-Specify a path to be added to Python's search path. This option can
-be used multiple times to specify multiple search paths. The path is
-usually specified by the test-runner script itself, rather than by
-users of the script, although it can be overridden by users. Only
-tests found in the path will be run.
-""")
-
-setup.add_option(
- '--tests-pattern', action="store", dest='tests_pattern',
- help="""\
-Specify the pattern for identifying tests modules. Tests modules are
-packages containing test modules or modules containing tests. When
-searching for tests, the test runner looks for modules or packages
-with this name.
-""")
-
-setup.add_option(
- '--suite-name', action="store", dest='suite_name',
- help="""\
-Specify the name of the object in each test_module that contains the
-module's test suite.
-""")
-
-setup.add_option(
- '--test-file-pattern', action="store", dest='test_file_pattern',
- help="""\
-Specify the name of tests modules. Tests modules are packages
-containing test files or modules containing tests. When searching for
-tests, the test runner looks for modules or packages with this name.
-""")
-
-setup.add_option(
- '--ignore_dir', action="append", dest='ignore_dir',
- help="""\
-Specifies the name of a directory to ignore when looking for tests.
-""")
-
-parser.add_option_group(setup)
-
-######################################################################
-# Other
-
-other = optparse.OptionGroup(parser, "Other", "Other options")
-
-other.add_option(
- '--keepbytecode', '-k', action="store_true", dest='keepbytecode',
- help="""\
-Normally, the test runner scans the test paths and the test
-directories looking for and deleting pyc or pyo files without
-corresponding py files. This is to prevent spurious test failures due
-to finding compiled moudules where source modules have been deleted.
-This scan can be time consuming. Using this option disables this
-scan. If you know you haven't removed any modules since last running
-the tests, can make the test run go much faster.
-""")
-
-parser.add_option_group(other)
-
-######################################################################
-# Command-line processing
-
-def compile_filter(pattern):
- if pattern.startswith('!'):
- pattern = re.compile(pattern[1:]).search
- return (lambda s: not pattern(s))
- return re.compile(pattern).search
-
-def merge_options(options, defaults):
- odict = options.__dict__
- for name, value in defaults.__dict__.items():
- if (value is not None) and (odict[name] is None):
- odict[name] = value
-
-default_setup_args = [
- '--tests-pattern', '^tests$',
- '--at-level', 1,
- '--ignore', '.svn',
- '--ignore', 'CVS',
- '--ignore', '{arch}',
- '--ignore', '.arch-ids',
- '--ignore', '_darcs',
- '--test-file-pattern', '^test',
- '--suite-name', 'test_suite',
- ]
-
-def get_options(args=None, defaults=None):
-
- default_setup, _ = parser.parse_args(default_setup_args)
- assert not _
- if defaults:
- defaults, _ = parser.parse_args(defaults)
- assert not _
- merge_options(defaults, default_setup)
- else:
- defaults = default_setup
-
- if args is None:
- args = sys.argv[1:]
- options, positional = parser.parse_args(args)
- merge_options(options, defaults)
-
- if positional:
- module_filter = positional.pop()
- if module_filter != '.':
- if options.module:
- options.module.append(module_filter)
- else:
- options.module = [module_filter]
-
- if positional:
- test_filter = [positional]
- if options.test:
- options.test.append(test_filter)
- else:
- options.test = [test_filter]
-
- options.ignore_dir = dict([(d,1) for d in options.ignore_dir])
- options.test_file_pattern = re.compile(options.test_file_pattern).search
- options.tests_pattern = re.compile(options.tests_pattern).search
- options.test = map(compile_filter, options.test or ('.'))
- options.module = map(compile_filter, options.module or ('.'))
-
- if options.package:
- options.package = [p.replace('/', '.').replace('\\', '.')
- for p in options.package]
- options.path = map(os.path.abspath, options.path)
- options.prefix = [p + os.path.sep for p in options.path]
- if options.all:
- options.at_level = sys.maxint
-
- if options.unit:
- options.layer = ['unit']
- if options.layer:
- options.layer = map(compile_filter, options.layer)
-
- options.layer = options.layer and dict([(l, 1) for l in options.layer])
-
- return options
-
-# Command-line UI
-###############################################################################
-
-###############################################################################
-# Install 2.4 TestSuite __iter__ into earlier versions
-
-if sys.version_info < (2, 4):
- def __iter__(suite):
- return iter(suite._tests)
- unittest.TestSuite.__iter__ = __iter__
- del __iter__
-
-# Install 2.4 TestSuite __iter__ into earlier versions
-###############################################################################
-
-###############################################################################
-# Test the testrunner
-
-def test_suite():
-
- import renormalizing
- checker = renormalizing.RENormalizing([
- (re.compile('\\\\'), '/'), # hopefully, we'll make windows happy
- (re.compile('/r'), '\\\\r'), # undo damage from previous
- (re.compile(r'\r'), '\\\\r\n'),
- (re.compile(r'0[.]\d\d\d seconds'), '0.NNN seconds'),
- (re.compile(r'\d+[.]\d\d\d ms'), 'N.NNN ms'),
- (re.compile('( |")[^\n]+testrunner-ex'), r'\1testrunner-ex'),
-
- # omit traceback entries for unittest.py or doctest.py from
- # output:
- (re.compile(r'\n +File "[^\n]+(doc|unit)test.py", [^\n]+\n[^\n]+\n'),
- r'\n'),
-
-
- ])
-
- def setUp(test):
- test.globs['saved-sys-info'] = sys.path, sys.argv
- test.globs['this_directory'] = os.path.split(__file__)[0]
-
- def tearDown(test):
- sys.path, sys.argv = test.globs['saved-sys-info']
-
- return doctest.DocFileSuite('testrunner.txt',
- setUp=setUp, tearDown=tearDown,
- checker=checker)
-
-def main():
- default = [
- '--path', os.path.split(sys.argv[0])[0],
- '--tests-pattern', '^testrunner$',
- ]
- run(default)
-
-if __name__ == '__main__':
- main()
-
-# Test the testrunner
-###############################################################################
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Test runner
+
+$Id$
+"""
+
+# Too bad: For now, we depend on zope.testing. This is because
+# we want to use the latest, greatest doctest, which zope.testing
+# provides. Then again, zope.testing is generally useful.
+from zope.testing import doctest
+import gc
+import logging
+import optparse
+import os
+import pdb
+import re
+import sys
+import time
+import traceback
+import threading
+import unittest
+
+
+def run(defaults=None, args=None):
+ options = get_options(args, defaults)
+ run_with_options(options)
+
+def run_with_options(options):
+
+ if options.verbose:
+ if options.all:
+ print "Running tests at all levels"
+ else:
+ print "Running tests at level %d" % options.at_level
+
+
+ # XXX add tracing later
+
+ # Add directories to the path
+ for path in options.path:
+ if path not in sys.path:
+ sys.path.append(path)
+
+ remove_stale_bytecode(options)
+
+ configure_logging()
+
+ tests_by_layer_name = find_tests(options)
+
+
+ ran = 0
+ failures = []
+ errors = []
+ nlayers = 0
+ if 'unit' in tests_by_layer_name:
+ tests = tests_by_layer_name.pop('unit')
+ if not options.non_unit:
+ if options.layer:
+ should_run = False
+ for pat in options.layer:
+ if pat('unit'):
+ should_run = True
+ break
+ else:
+ should_run = True
+
+ if should_run:
+ print "Running unit tests:"
+ nlayers += 1
+ ran += run_tests(options, tests, 'unit', failures, errors)
+
+ setup_layers = {}
+ for layer_name, layer, tests in ordered_layers(tests_by_layer_name):
+ if options.layer:
+ should_run = False
+ for pat in options.layer:
+ if pat(layer_name):
+ should_run = True
+ break
+ else:
+ should_run = True
+
+ if should_run:
+ nlayers += 1
+ ran += run_layer(options, layer_name, layer, tests, setup_layers,
+ failures, errors)
+
+ if setup_layers:
+ print "Tearing down left over layers:"
+ tear_down_unneeded((), setup_layers)
+
+ if options.verbose > 1:
+ if errors:
+ print
+ print "Tests with errors:"
+ for test, exc_info in errors:
+ print " ", test
+
+ if failures:
+ print
+ print "Tests with failures:"
+ for test, exc_info in failures:
+ print " ", test
+
+ if nlayers != 1:
+ print "Total: %s tests, %s failures, %s errors" % (
+ ran, len(failures), len(errors))
+
+
+def run_tests(options, tests, name, failures, errors):
+ repeat = options.repeat or 1
+ ran = 0
+ for i in range(repeat):
+ if repeat > 1:
+ print "Iteration", i+1
+
+ if options.verbose > 0 or options.progress:
+ print ' Running:'
+ if options.verbose == 1 and not options.progress:
+ print ' ',
+ result = TestResult(options, tests)
+ t = time.time()
+ tests(result)
+ t = time.time() - t
+ if options.verbose == 1 or options.progress:
+ print
+ failures.extend(result.failures)
+ errors.extend(result.errors)
+ print (
+ " Ran %s tests with %s failures and %s errors in %.3f seconds." %
+ (result.testsRun, len(result.failures), len(result.errors), t)
+ )
+ ran += result.testsRun
+
+ return ran
+
+
+def run_layer(options, layer_name, layer, tests, setup_layers,
+ failures, errors):
+ print "Running %s tests:" % layer_name
+
+ gathered = []
+ gather_layers(layer, gathered)
+ needed = dict([(l, 1) for l in gathered])
+ tear_down_unneeded(needed, setup_layers)
+
+ setup_layer(layer, setup_layers)
+ return run_tests(options, tests, layer_name, failures, errors)
+
+def tear_down_unneeded(needed, setup_layers):
+ # Tear down any layers not needed for these tests. The unneeded
+ # layers might interfere.
+ unneeded = [l for l in setup_layers if l not in needed]
+ unneeded = order_by_bases(unneeded)
+ unneeded.reverse()
+ for l in unneeded:
+ print " Tear down %s" % name_from_layer(l),
+ t = time.time()
+ l.tearDown()
+ del setup_layers[l]
+ print "in %.3f seconds." % (time.time() - t)
+
+
+def setup_layer(layer, setup_layers):
+ if layer not in setup_layers:
+ for base in layer.__bases__:
+ setup_layer(base, setup_layers)
+ print " Set up %s.%s" % (layer.__module__, layer.__name__),
+ t = time.time()
+ layer.setUp()
+ print "in %.3f seconds." % (time.time() - t)
+ setup_layers[layer] = 1
+
+def dependencies(bases, result):
+ for base in bases:
+ result[base] = 1
+ dependencies(base.__bases__, result)
+
+
+
+class TestResult(unittest.TestResult):
+
+ def __init__(self, options, tests):
+ unittest.TestResult.__init__(self)
+ self.options = options
+ if options.progress:
+ count = 0
+ for test in tests:
+ count += test.countTestCases()
+ self.count = count
+ self.last_width = 0
+
+ def startTest(self, test):
+ unittest.TestResult.startTest(self, test)
+ testsRun = self.testsRun - 1
+ count = test.countTestCases()
+ self.testsRun = testsRun + count
+ options = self.options
+ self.test_width = 0
+
+ if options.progress:
+ s = " %d/%d (%.1f%%)" % (
+ self.testsRun, self.count,
+ (self.testsRun) * 100.0 / self.count
+ )
+ sys.stdout.write(s)
+ self.test_width += len(s)
+
+ elif options.verbose == 1:
+ for i in range(count):
+ sys.stdout.write('.')
+ testsRun += 1
+ if (testsRun % 50) == 0:
+ print
+ print ' ',
+ elif options.verbose > 1:
+ print ' ',
+
+ if options.verbose > 1:
+ s = str(test)
+ sys.stdout.write(' ')
+ sys.stdout.write(s)
+ self.test_width += len(s) + 1
+
+ sys.stdout.flush()
+
+ self._threads = threading.enumerate()
+ self._start_time = time.time()
+
+ def addSuccess(self, test):
+ if self.options.verbose > 2:
+ t = max(time.time() - self._start_time, 0.0)
+ s = " (%.3f ms)" % t
+ sys.stdout.write(s)
+ self.test_width += len(s) + 1
+
+ def addError(self, test, exc_info):
+ if self.options.verbose > 2:
+ print " (%.3f ms)" % (time.time() - self._start_time)
+
+ unittest.TestResult.addError(self, test, exc_info)
+ print
+ self._print_traceback("Error in test %s" % test, exc_info)
+
+ if self.options.post_mortem:
+ post_mortem(exc_info)
+
+ self.test_width = self.last_width = 0
+
+ def addFailure(self, test, exc_info):
+
+ if self.options.verbose > 2:
+ print " (%.3f ms)" % (time.time() - self._start_time)
+
+ unittest.TestResult.addFailure(self, test, exc_info)
+ print
+ self._print_traceback("Failure in test %s" % test, exc_info)
+
+ if self.options.post_mortem:
+ post_mortem(exc_info)
+
+ self.test_width = self.last_width = 0
+
+
+ def _print_traceback(self, msg, exc_info):
+ print
+ print msg
+
+ v = exc_info[1]
+ if isinstance(v, doctest.DocTestFailureException):
+ tb = v.args[0]
+ else:
+ tb = "".join(traceback.format_exception(*exc_info))
+
+ print tb
+
+ def stopTest(self, test):
+ if self.options.progress:
+ sys.stdout.write(' ' * (self.last_width - self.test_width) + "\r")
+ self.last_width = self.test_width
+ elif self.options.verbose > 1:
+ print
+
+ if gc.garbage:
+ print "The following test left garbage:"
+ print test
+ print gc.garbage
+ # TODO: Perhaps eat the garbage here, so that the garbage isn't
+ # printed for every subsequent test.
+
+ # Did the test leave any new threads behind?
+ new_threads = [t for t in threading.enumerate()
+ if (t.isAlive()
+ and
+ t not in self._threads)]
+ if new_threads:
+ print "The following test left new threads behind:"
+ print test
+ print "New thread(s):", new_threads
+
+ sys.stdout.flush()
+
+def post_mortem(exc_info):
+ err = exc_info[1]
+ if isinstance(err, (doctest.UnexpectedException, doctest.DocTestFailure)):
+
+ if isinstance(err, doctest.UnexpectedException):
+ exc_info = err.exc_info
+
+ # Print out location info if the error was in a doctest
+ if exc_info[2].tb_frame.f_code.co_filename == '<string>':
+ print_doctest_location(err)
+
+ else:
+ print_doctest_location(err)
+ # Hm, we have a DocTestFailure exception. We need to
+ # generate our own traceback
+ try:
+ exec ('raise ValueError'
+ '("Expected and actual output are different")'
+ ) in err.test.globs
+ except:
+ exc_info = sys.exc_info()
+
+ print "%s:" % (exc_info[0], )
+ print exc_info[1]
+ pdb.post_mortem(exc_info[2])
+ sys.exit()
+
+def print_doctest_location(err):
+ # This mimicks pdb's output, which gives way cool results in emacs :)
+ filename = err.test.filename
+ if filename.endswith('.pyc'):
+ filename = filename[:-1]
+ print "> %s(%s)_()" % (filename, err.test.lineno+err.example.lineno+1)
+
+def ordered_layers(tests_by_layer_name):
+ layer_names = dict([(layer_from_name(layer_name), layer_name)
+ for layer_name in tests_by_layer_name])
+ for layer in order_by_bases(layer_names):
+ layer_name = layer_names[layer]
+ yield layer_name, layer, tests_by_layer_name[layer_name]
+
+def gather_layers(layer, result):
+ result.append(layer)
+ for b in layer.__bases__:
+ gather_layers(b, result)
+
+def layer_from_name(layer_name):
+ layer_names = layer_name.split('.')
+ layer_module, module_layer_name = layer_names[:-1], layer_names[-1]
+ return getattr(import_name('.'.join(layer_module)), module_layer_name)
+
+
+def order_by_bases(layers):
+ """Order the layers from least to most specific (bottom to top)
+ """
+ named_layers = [(name_from_layer(layer), layer) for layer in layers]
+ named_layers.sort()
+ gathered = []
+ for name, layer in named_layers:
+ gather_layers(layer, gathered)
+ gathered.reverse()
+ seen = {}
+ result = []
+ for layer in gathered:
+ if layer not in seen:
+ seen[layer] = 1
+ if layer in layers:
+ result.append(layer)
+ return result
+
+def name_from_layer(layer):
+ return layer.__module__ + '.' + layer.__name__
+
+def find_tests(options):
+ suites = {}
+ for suite in find_suites(options):
+ for test, layer_name in tests_from_suite(suite, options):
+ suite = suites.get(layer_name)
+ if not suite:
+ suite = suites[layer_name] = unittest.TestSuite()
+ suite.addTest(test)
+ return suites
+
+def tests_from_suite(suite, options, dlevel=1, dlayer='unit'):
+ level = getattr(suite, 'level', dlevel)
+ layer = getattr(suite, 'layer', dlayer)
+ if not isinstance(layer, basestring):
+ layer = layer.__module__ + '.' + layer.__name__
+
+ if isinstance(suite, unittest.TestSuite):
+ for possible_suite in suite:
+ for r in tests_from_suite(possible_suite, options, level, layer):
+ yield r
+ else:
+ if level <= options.at_level:
+ for pat in options.test:
+ if pat(str(suite)):
+ yield (suite, layer)
+ break
+
+def find_suites(options):
+ for fpath in find_test_files(options):
+ for prefix in options.prefix:
+ if fpath.startswith(prefix):
+ # strip prefix, strip .py suffix and convert separator to dots
+ module_name = fpath[len(prefix):-3].replace(os.path.sep, '.')
+ try:
+ module = import_name(module_name)
+ suite = getattr(module, options.suite_name)()
+ except:
+ suite = StartUpFailure(
+ options,
+ "Couldn't get suite for %s" % module_name,
+ sys.exc_info()
+ )
+
+ yield suite
+ break
+
+class StartUpFailure(unittest.TestCase):
+
+ def __init__(self, options, message, exc_info):
+ if options.post_mortem:
+ post_mortem(exc_info)
+ unittest.TestCase.__init__(self)
+ self.message = message
+ self.exc_info = exc_info
+
+ def __str__(self):
+ return "Startup failure: %s" % self.message
+
+ def runTest(self):
+ raise self.exc_info[0], self.exc_info[1], self.exc_info[2]
+
+
+def find_test_files(options):
+ found = {}
+ for f in find_test_files_(options):
+ for filter in options.module:
+ if filter(f):
+ if f not in found:
+ found[f] = 1
+ yield f
+ break
+
+def find_test_files_(options):
+ tests_pattern = options.tests_pattern
+ test_file_pattern = options.test_file_pattern
+ for p in test_dirs(options, {}):
+ for dirname, dirs, files in walk_with_symlinks(options, p):
+ d = os.path.split(dirname)[1]
+ if tests_pattern(d) and ('__init__.py' in files):
+ # tests directory
+ for file in files:
+ if file.endswith('.py') and test_file_pattern(file[:-3]):
+ f = os.path.join(dirname, file)
+ yield f
+
+ for file in files:
+ if file.endswith('.py') and tests_pattern(file[:-3]):
+ f = os.path.join(dirname, file)
+ yield f
+
+
+def walk_with_symlinks(options, dir):
+ for dirpath, dirs, files in os.walk(dir):
+ dirs.sort()
+ files.sort()
+ dirs[:] = [d for d in dirs if d not in options.ignore_dir]
+ yield (dirpath, dirs, files)
+ for d in dirs:
+ p = os.path.join(dirpath, d)
+ if os.path.islink(p):
+ for dirpath, dirs, files in walk_with_symlinks(options, p):
+ yield (dirpath, dirs, files)
+
+compiled_sufixes = '.pyc', '.pyo'
+def remove_stale_bytecode(options):
+ if options.keepbytecode:
+ return
+ for p in options.path:
+ for dirname, dirs, files in walk_with_symlinks(options, p):
+ for file in files:
+ if file[-4:] in compiled_sufixes and file[:-1] not in files:
+ fullname = os.path.join(dirname, file)
+ print "Removing stale bytecode file", fullname
+ os.unlink(fullname)
+
+
+def test_dirs(options, seen):
+ if options.package:
+ for p in options.package:
+ p = import_name(p)
+ for p in p.__path__:
+ p = os.path.abspath(p)
+ if p in seen:
+ continue
+ for prefix in options.prefix:
+ if p.startswith(prefix):
+ seen[p] = 1
+ yield p
+ break
+ else:
+ for dpath in options.path:
+ yield dpath
+
+
+def import_name(name):
+ __import__(name)
+ return sys.modules[name]
+
+def configure_logging():
+ """Initialize the logging module."""
+ import logging.config
+
+ # Get the log.ini file from the current directory instead of
+ # possibly buried in the build directory. TODO: This isn't
+ # perfect because if log.ini specifies a log file, it'll be
+ # relative to the build directory. Hmm... logini =
+ # os.path.abspath("log.ini")
+
+ logini = os.path.abspath("log.ini")
+ if os.path.exists(logini):
+ logging.config.fileConfig(logini)
+ else:
+ # If there's no log.ini, cause the logging package to be
+ # silent during testing.
+ root = logging.getLogger()
+ root.addHandler(NullHandler())
+ logging.basicConfig()
+
+ if os.environ.has_key("LOGGING"):
+ level = int(os.environ["LOGGING"])
+ logging.getLogger().setLevel(level)
+
+class NullHandler(logging.Handler):
+ """Logging handler that drops everything on the floor.
+
+ We require silence in the test environment. Hush.
+ """
+
+ def emit(self, record):
+ pass
+
+
+
+###############################################################################
+# Command-line UI
+
+parser = optparse.OptionParser("Usage: %prog [options] [MODULE] [TEST]")
+
+######################################################################
+# Searching and filtering
+
+searching = optparse.OptionGroup(parser, "Searching and filtering", """\
+Options in this group are used to define which tests to run.
+""")
+
+searching.add_option(
+ '--package', '--dir', '-s', action="append", dest='package',
+ help="""\
+Search the given package's directories for tests. This can be
+specified more than once to run tests in multiple parts of the source
+tree. For example, if refactoring interfaces, you don't want to see
+the way you have broken setups for tests in other packages. You *just*
+want to run the interface tests.
+
+Packages are supplied as dotted names. For compatibility with the old
+test runner, forward and backward slashed in package names are
+converted to dots.
+
+(In the special case of packages spread over multiple directories,
+only directories within the test search path are searched. See the
+--path option.)
+
+""")
+
+searching.add_option(
+ '--module', '-m', action="append", dest='module',
+ help="""\
+Specify a test-module filter as a regular expression. This is a
+case-sensitive regular expression, used in search (not match) mode, to
+limit which test modules are searched for tests. In an extension of
+Python regexp notation, a leading "!" is stripped and causes the sense
+of the remaining regexp to be negated (so "!bc" matches any string
+that does not match "bc", and vice versa). The option can be
+specified multiple test-module filters. Test modules matching any of
+the test filters are searched. If no test-module filter is specified,
+then all test moduless are used.
+""")
+
+searching.add_option(
+ '--test', '-t', action="append", dest='test',
+ help="""\
+Specify a test filter as a regular expression. This is a
+case-sensitive regular expression, used in search (not match) mode, to
+limit which tests are run. In an extension of Python regexp notation,
+a leading "!" is stripped and causes the sense of the remaining regexp
+to be negated (so "!bc" matches any string that does not match "bc",
+and vice versa). The option can be specified multiple test filters.
+Tests matching any of the test filters are included. If no test
+filter is specified, then all tests are run.
+""")
+
+searching.add_option(
+ '--unit', '-u', action="store_true", dest='unit',
+ help="""\
+Run only unit tests, ignoring any layer options.
+""")
+
+searching.add_option(
+ '--non-unit', '-f', action="store_true", dest='non_unit',
+ help="""\
+Run tests other than unit tests.
+""")
+
+searching.add_option(
+ '--layer', action="append", dest='layer',
+ help="""\
+Specify a test layer to run. The option can be given multiple times
+to specify more than one layer. If not specified, all layers are run.
+It is common for the running script to provide default values for this
+option. Layers are specified regular expressions, used in search
+mode, for dotted names of objects that define a layer. In an
+extension of Python regexp notation, a leading "!" is stripped and
+causes the sense of the remaining regexp to be negated (so "!bc"
+matches any string that does not match "bc", and vice versa). The
+layer named 'unit' is reserved for unit tests, however, take note of
+the --unit and non-unit options.
+""")
+
+searching.add_option(
+ '-a', '--at-level', type='int', dest='at_level',
+ help="""\
+Run the tests at the given level. Any test at a level at or below
+this is run, any test at a level above this is not run. Level 0
+runs all tests.
+""")
+
+searching.add_option(
+ '--all', action="store_true", dest='all',
+ help="Run tests at all levels.")
+
+parser.add_option_group(searching)
+
+######################################################################
+# Reporting
+
+reporting = optparse.OptionGroup(parser, "Reporting", """\
+Reporting options control basic aspects of test-runner output
+""")
+
+reporting.add_option(
+ '--verbose', '-v', action="count", dest='verbose',
+ help="""\
+Increment the verbosity level.
+""")
+
+reporting.add_option(
+ '--progress', '-p', action="store_true", dest='progress',
+ help="""\
+Output progress status
+""")
+
+def report_only_first_failure(*args):
+ old = doctest.set_unittest_reportflags(0)
+ doctest.set_unittest_reportflags(old | doctest.REPORT_ONLY_FIRST_FAILURE)
+
+reporting.add_option(
+ '-1', action="callback", callback=report_only_first_failure,
+ help="""\
+Report only the first failure in a doctest. (Examples after the
+failure are still executed, in case they do any cleanup.)
+""")
+
+parser.add_option_group(reporting)
+
+######################################################################
+# Analysis
+
+analysis = optparse.OptionGroup(parser, "Analysis", """\
+Analysis options provide tools for analysing test output.
+""")
+
+
+analysis.add_option(
+ '--post-mortem', '-D', action="store_true", dest='post_mortem',
+ help="Enable post-mortem debugging of test failures"
+ )
+
+
+def gc_callback(option, opt, GC_THRESHOLD, *args):
+ import gc
+ if GC_THRESHOLD == 0:
+ gc.disable()
+ print "gc disabled"
+ else:
+ gc.set_threshold(GC_THRESHOLD)
+ print "gc threshold:", gc.get_threshold()
+
+analysis.add_option(
+ '--gc', action="callback", callback=gc_callback, dest='gc', type="int",
+ help="""\
+Set the garbage collector generation0 threshold. This can be used
+to stress memory and gc correctness. Some crashes are only
+reproducible when the threshold is set to 1 (agressive garbage
+collection). Do "--gc 0" to disable garbage collection altogether.
+""")
+
+analysis.add_option(
+ '--repeat', action="store", type="int", dest='repeat',
+ help="""\
+Repeat the testst the given number of times. This option is used to
+make sure that tests leave thier environment in the state they found
+it and, with the --refcount option to look for memory leaks.
+""")
+
+def refcount_available(*args):
+ if not hasattr(sys, "gettotalrefcount"):
+ raise optparse.OptionValueError("""\
+The Python you are running was not configured with --with-pydebug.
+This is required to use the --refount option.
+""")
+
+analysis.add_option(
+ '--refcount',
+ action="callback", callback=refcount_available,
+ dest='refcount',
+ help="""\
+After each run of the tests, output a report summarizing changes in
+refcounts by object type. This option that requires that Python was
+built with the --with-pydebug option to configure.
+""")
+
+analysis.add_option(
+ '--coverage', action="store", dest='coverage',
+ help="""\
+Perform code-coverage analysis, saving trace data to the directory
+with the given anme. A code coverage summary is printed to standard
+out.
+""")
+
+def do_pychecker(*args):
+ if not os.environ.get("PYCHECKER"):
+ os.environ["PYCHECKER"] = "-q"
+ import pychecker.checker
+
+analysis.add_option(
+ '--pychecker', action="callback", callback=do_pychecker,
+ help="""\
+Run the tests under pychecker
+""")
+
+parser.add_option_group(analysis)
+
+######################################################################
+# Setup
+
+setup = optparse.OptionGroup(parser, "Setup", """\
+Setup options are normally supplied by the testrunner script, although
+they can be overridden by users.
+""")
+
+setup.add_option(
+ '--path', action="append", dest='path',
+ help="""\
+Specify a path to be added to Python's search path. This option can
+be used multiple times to specify multiple search paths. The path is
+usually specified by the test-runner script itself, rather than by
+users of the script, although it can be overridden by users. Only
+tests found in the path will be run.
+""")
+
+setup.add_option(
+ '--tests-pattern', action="store", dest='tests_pattern',
+ help="""\
+Specify the pattern for identifying tests modules. Tests modules are
+packages containing test modules or modules containing tests. When
+searching for tests, the test runner looks for modules or packages
+with this name.
+""")
+
+setup.add_option(
+ '--suite-name', action="store", dest='suite_name',
+ help="""\
+Specify the name of the object in each test_module that contains the
+module's test suite.
+""")
+
+setup.add_option(
+ '--test-file-pattern', action="store", dest='test_file_pattern',
+ help="""\
+Specify the name of tests modules. Tests modules are packages
+containing test files or modules containing tests. When searching for
+tests, the test runner looks for modules or packages with this name.
+""")
+
+setup.add_option(
+ '--ignore_dir', action="append", dest='ignore_dir',
+ help="""\
+Specifies the name of a directory to ignore when looking for tests.
+""")
+
+parser.add_option_group(setup)
+
+######################################################################
+# Other
+
+other = optparse.OptionGroup(parser, "Other", "Other options")
+
+other.add_option(
+ '--keepbytecode', '-k', action="store_true", dest='keepbytecode',
+ help="""\
+Normally, the test runner scans the test paths and the test
+directories looking for and deleting pyc or pyo files without
+corresponding py files. This is to prevent spurious test failures due
+to finding compiled moudules where source modules have been deleted.
+This scan can be time consuming. Using this option disables this
+scan. If you know you haven't removed any modules since last running
+the tests, can make the test run go much faster.
+""")
+
+parser.add_option_group(other)
+
+######################################################################
+# Command-line processing
+
+def compile_filter(pattern):
+ if pattern.startswith('!'):
+ pattern = re.compile(pattern[1:]).search
+ return (lambda s: not pattern(s))
+ return re.compile(pattern).search
+
+def merge_options(options, defaults):
+ odict = options.__dict__
+ for name, value in defaults.__dict__.items():
+ if (value is not None) and (odict[name] is None):
+ odict[name] = value
+
+default_setup_args = [
+ '--tests-pattern', '^tests$',
+ '--at-level', 1,
+ '--ignore', '.svn',
+ '--ignore', 'CVS',
+ '--ignore', '{arch}',
+ '--ignore', '.arch-ids',
+ '--ignore', '_darcs',
+ '--test-file-pattern', '^test',
+ '--suite-name', 'test_suite',
+ ]
+
+def get_options(args=None, defaults=None):
+
+ default_setup, _ = parser.parse_args(default_setup_args)
+ assert not _
+ if defaults:
+ defaults, _ = parser.parse_args(defaults)
+ assert not _
+ merge_options(defaults, default_setup)
+ else:
+ defaults = default_setup
+
+ if args is None:
+ args = sys.argv[1:]
+ options, positional = parser.parse_args(args)
+ merge_options(options, defaults)
+
+ if positional:
+ module_filter = positional.pop()
+ if module_filter != '.':
+ if options.module:
+ options.module.append(module_filter)
+ else:
+ options.module = [module_filter]
+
+ if positional:
+ test_filter = [positional]
+ if options.test:
+ options.test.append(test_filter)
+ else:
+ options.test = [test_filter]
+
+ options.ignore_dir = dict([(d,1) for d in options.ignore_dir])
+ options.test_file_pattern = re.compile(options.test_file_pattern).search
+ options.tests_pattern = re.compile(options.tests_pattern).search
+ options.test = map(compile_filter, options.test or ('.'))
+ options.module = map(compile_filter, options.module or ('.'))
+
+ if options.package:
+ options.package = [p.replace('/', '.').replace('\\', '.')
+ for p in options.package]
+ options.path = map(os.path.abspath, options.path)
+ options.prefix = [p + os.path.sep for p in options.path]
+ if options.all:
+ options.at_level = sys.maxint
+
+ if options.unit:
+ options.layer = ['unit']
+ if options.layer:
+ options.layer = map(compile_filter, options.layer)
+
+ options.layer = options.layer and dict([(l, 1) for l in options.layer])
+
+ return options
+
+# Command-line UI
+###############################################################################
+
+###############################################################################
+# Install 2.4 TestSuite __iter__ into earlier versions
+
+if sys.version_info < (2, 4):
+ def __iter__(suite):
+ return iter(suite._tests)
+ unittest.TestSuite.__iter__ = __iter__
+ del __iter__
+
+# Install 2.4 TestSuite __iter__ into earlier versions
+###############################################################################
+
+###############################################################################
+# Test the testrunner
+
+def test_suite():
+
+ import renormalizing
+ checker = renormalizing.RENormalizing([
+ (re.compile('\\\\'), '/'), # hopefully, we'll make windows happy
+ (re.compile('/r'), '\\\\r'), # undo damage from previous
+ (re.compile(r'\r'), '\\\\r\n'),
+ (re.compile(r'0[.]\d\d\d seconds'), '0.NNN seconds'),
+ (re.compile(r'\d+[.]\d\d\d ms'), 'N.NNN ms'),
+ (re.compile('( |")[^\n]+testrunner-ex'), r'\1testrunner-ex'),
+
+ # omit traceback entries for unittest.py or doctest.py from
+ # output:
+ (re.compile(r'\n +File "[^\n]+(doc|unit)test.py", [^\n]+\n[^\n]+\n'),
+ r'\n'),
+
+
+ ])
+
+ def setUp(test):
+ test.globs['saved-sys-info'] = sys.path, sys.argv
+ test.globs['this_directory'] = os.path.split(__file__)[0]
+
+ def tearDown(test):
+ sys.path, sys.argv = test.globs['saved-sys-info']
+
+ return doctest.DocFileSuite('testrunner.txt',
+ setUp=setUp, tearDown=tearDown,
+ checker=checker)
+
+def main():
+ default = [
+ '--path', os.path.split(sys.argv[0])[0],
+ '--tests-pattern', '^testrunner$',
+ ]
+ run(default)
+
+if __name__ == '__main__':
+ main()
+
+# Test the testrunner
+###############################################################################
More information about the Zope3-Checkins
mailing list