[Checkins] SVN: z3c.testsetup/trunk/ Fix tests to work also under Python 2.7.
Uli Fouquet
uli at gnufix.de
Mon Jul 26 17:25:28 EDT 2010
Log message for revision 115105:
Fix tests to work also under Python 2.7.
Changed:
U z3c.testsetup/trunk/CHANGES.txt
U z3c.testsetup/trunk/src/z3c/testsetup/functional/functionaldoctestsetup.txt
U z3c.testsetup/trunk/src/z3c/testsetup/pythontestsetup.txt
U z3c.testsetup/trunk/src/z3c/testsetup/testgetter.txt
U z3c.testsetup/trunk/src/z3c/testsetup/unitdoctestsetup.txt
U z3c.testsetup/trunk/src/z3c/testsetup/unittestsetup.txt
-=-
Modified: z3c.testsetup/trunk/CHANGES.txt
===================================================================
--- z3c.testsetup/trunk/CHANGES.txt 2010-07-26 14:06:20 UTC (rev 115104)
+++ z3c.testsetup/trunk/CHANGES.txt 2010-07-26 21:25:27 UTC (rev 115105)
@@ -7,6 +7,8 @@
- Fixed tests not to fail when some buildbot takes minutes to run the
tests.
+- Fix tests to work also under Python 2.7.
+
0.8.1 (2010-07-25)
==================
Modified: z3c.testsetup/trunk/src/z3c/testsetup/functional/functionaldoctestsetup.txt
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/functional/functionaldoctestsetup.txt 2010-07-26 14:06:20 UTC (rev 115104)
+++ z3c.testsetup/trunk/src/z3c/testsetup/functional/functionaldoctestsetup.txt 2010-07-26 21:25:27 UTC (rev 115105)
@@ -38,7 +38,8 @@
settings of instance attributes.
2) The tests contained in the found docfiles are setup as functional
- tests and added to a ``unittest.TestSuite`` instance.
+ tests and added to a ``unittest.TestSuite`` (or
+ ``unittest.suite.TestSuite`` for Python 2.7)instance.
There are plenty of default values active, if you use instances of
this class without further modifications. Therefore we will first
@@ -70,7 +71,7 @@
>>> suite = setup.getTestSuite()
>>> suite
- <unittest.TestSuite tests=[...]>
+ <unittest...TestSuite tests=[...]>
To sum it up, writing a test setup for a project now can be that
short::
@@ -82,7 +83,8 @@
This will find all .rst and .txt files in the package that provide a
certain signature (see below), register the contained tests as
-functional tests and run them as part of a `unittest.TestSuite`.
+functional tests and run them as part of a `unittest.TestSuite` (or
+``unittest.suite.TestSuite`` for Python 2.7).
Note: in many test setups you will find a code fragment like the
following at the end of file::
Modified: z3c.testsetup/trunk/src/z3c/testsetup/pythontestsetup.txt
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/pythontestsetup.txt 2010-07-26 14:06:20 UTC (rev 115104)
+++ z3c.testsetup/trunk/src/z3c/testsetup/pythontestsetup.txt 2010-07-26 21:25:27 UTC (rev 115105)
@@ -21,8 +21,9 @@
1) A given package is searched for appropriate modules, based on the
settings of instance attributes.
-2) The tests contained in the found modules are added to one
- `unittest.TestSuite`, which can be passed to a testrunner.
+2) The tests contained in the found modules are added to a
+ `unittest.TestSuite` (or ``unittest.suite.TestSuite`` for Python
+ 2.7) instance, which can be passed to a testrunner.
Setting up a simple test suite
@@ -50,7 +51,7 @@
>>> suite = setup.getTestSuite()
>>> suite
- <unittest.TestSuite tests=[...]>
+ <unittest...TestSuite tests=[...]>
To sum it up, writing a test setup for a project now can be that
short::
@@ -62,7 +63,8 @@
This will find all modules in the given package that provide a certain
signature (see below), register the contained tests cases and run them
-as part of a `unittest.TestSuite`.
+as part of a `unittest.TestSuite` (or ``unittest.suite.TestSuite`` for
+Python 2.7).
Note: in many test setups you will find a code fragment like the
following at the end of file::
Modified: z3c.testsetup/trunk/src/z3c/testsetup/testgetter.txt
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/testgetter.txt 2010-07-26 14:06:20 UTC (rev 115104)
+++ z3c.testsetup/trunk/src/z3c/testsetup/testgetter.txt 2010-07-26 21:25:27 UTC (rev 115105)
@@ -9,13 +9,15 @@
TestGetters are wrappers for TestSetups, that filter any keyword
parameters passed to the constructor and return a
-``unittest.TestSuite`` if called::
+``unittest.TestSuite`` (or `unittest.suite.TestSuite` for Python 2.7)
+if called. In the following, when ``unittest.TestSuite`` is mentioned,
+please read ``unittest.suite.TestSuite`` if you use Python 2.7.
>>> import z3c.testsetup
>>> from z3c.testsetup.tests import cave
>>> getter = z3c.testsetup.PythonTestGetter(cave)
>>> getter()
- <unittest.TestSuite tests=[...]>
+ <unittest...TestSuite tests=[...]>
>>> get_basenames_from_suite(getter())
['file1.py']
@@ -32,7 +34,7 @@
>>> collector = z3c.testsetup.TestCollector(cave)
>>> collector()
- <unittest.TestSuite tests=[...]>
+ <unittest...TestSuite tests=[...]>
>>> get_basenames_from_suite(collector())
['file1.py', 'file1.rst', 'file1.txt', 'subdirfile.txt']
@@ -318,7 +320,7 @@
>>> collector = CustomTestCollector(cave)
>>> suite = collector()
>>> suite
- <unittest.TestSuite tests=[...]>
+ <unittest...TestSuite tests=[...]>
The tests delivered are determined by the involved
TestGetters. Because we are wrapping the CustomGetter, we should get a
@@ -410,7 +412,7 @@
``unittest.TestSuite``::
>>> test_suite()
- <unittest.TestSuite tests=[...]>
+ <unittest...TestSuite tests=[...]>
To tweak the tests run, we can pass keyword parameters to the
``register_all_tests`` function. But what, if we maintain a package,
@@ -442,7 +444,7 @@
>>> suite = collector()
>>> suite
- <unittest.TestSuite tests=[...]>
+ <unittest...TestSuite tests=[...]>
This standard suite does not include the functional doctest file
``notatest1.foo`` which is in the cave package::
Modified: z3c.testsetup/trunk/src/z3c/testsetup/unitdoctestsetup.txt
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/unitdoctestsetup.txt 2010-07-26 14:06:20 UTC (rev 115104)
+++ z3c.testsetup/trunk/src/z3c/testsetup/unitdoctestsetup.txt 2010-07-26 21:25:27 UTC (rev 115105)
@@ -39,7 +39,8 @@
settings of instcance attributes.
2) The tests contained in the found docfiles are setup as unit tests
- and added to a ``unittest.TestSuite`` instance.
+ and added to a ``unittest.TestSuite`` (or
+ ``unittest.suite.TestSuite`` for Python 2.7) instance.
There are plenty of default values active, if you use instances of
this class without further modifications. Therefore we will first
@@ -71,7 +72,7 @@
>>> suite = setup.getTestSuite()
>>> suite
- <unittest.TestSuite tests=[...]>
+ <unittest...TestSuite tests=[...]>
To sum it up, writing a test setup for a project now can be that
short::
@@ -83,7 +84,8 @@
This will find all .rst and .txt files in the package that provide a
certain signature (see below), register the contained tests as unit
-tests and run them as part of a `unittest.TestSuite`.
+tests and run them as part of a `unittest.TestSuite` (or
+`unittest.suite.TestSuite` for Python 2.7).
Note: in many test setups you will find a code fragment like the
following at the end of file::
Modified: z3c.testsetup/trunk/src/z3c/testsetup/unittestsetup.txt
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/unittestsetup.txt 2010-07-26 14:06:20 UTC (rev 115104)
+++ z3c.testsetup/trunk/src/z3c/testsetup/unittestsetup.txt 2010-07-26 21:25:27 UTC (rev 115105)
@@ -30,7 +30,8 @@
settings of instcance attributes.
2) The tests contained in the found modules are setup as unit tests
- and added to a ``unittest.TestSuite`` instance.
+ and added to a ``unittest.TestSuite`` (or
+ ``unittest.suite.TestSuite`` for Python 2.7) instance.
There are some default values active, if you use instances of
this class without further modifications. Therefore we will first
@@ -58,7 +59,7 @@
>>> suite = setup.getTestSuite()
>>> suite
- <unittest.TestSuite tests=[...]>
+ <unittest...TestSuite tests=[...]>
To sum it up, writing a test setup for a zope 3 project now can be that
short::
@@ -72,7 +73,8 @@
This will find all modules in the package that provide a
certain signature (see below), register the contained tests as unit
-tests and run them as part of a `unittest.TestSuite`.
+tests and run them as part of a `unittest.TestSuite` (or
+`unittest.suite.TestSuite` for Python 2.7).
Note: in many test setups you will find a code fragment like the
following at the end of file::
More information about the checkins
mailing list