[Checkins] SVN: Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/
Get rid of __name__==__main__.
Uli Fouquet
uli at gnufix.de
Sat Feb 2 10:45:55 EST 2008
Log message for revision 83426:
Get rid of __name__==__main__.
Changed:
U Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/functionaldoctestsetup.txt
U Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/testrunner.txt
U Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/cave/samplesetup1.py
U Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/test_testsetup.py
U Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/unitdoctestsetup.txt
-=-
Modified: Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/functionaldoctestsetup.txt
===================================================================
--- Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/functionaldoctestsetup.txt 2008-02-02 15:30:13 UTC (rev 83425)
+++ Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/functionaldoctestsetup.txt 2008-02-02 15:45:54 UTC (rev 83426)
@@ -66,14 +66,22 @@
def test_suite():
setup = grok.testing.FunctionalDocTestSetup(cave)
return setup.getTestSuite()
- if __name__ == '__main__':
- unittest.main(default='test_suite')
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`.
+Note: in many test setups you will find a code fragment like the
+ following at the end of file::
+ if __name__ == '__main__':
+ unittest.main(default='test_suite')
+
+ This is not neccessary for usual testrunner setups. A testrunner
+ will look for appropriate filenames (modules) and if those
+ modules provide a callable ``test_suite`` (usually a function)
+ this callable will be called to deliver a test suite.
+
FunctionalTestSetup default values
----------------------------------
Modified: Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/testrunner.txt
===================================================================
--- Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/testrunner.txt 2008-02-02 15:30:13 UTC (rev 83425)
+++ Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/testrunner.txt 2008-02-02 15:45:54 UTC (rev 83426)
@@ -3,8 +3,8 @@
=============================
Here we discuss complete test setups for the `cave` package contained
-in this directory. We will run the `zope.testing.testrunner` and
-examine their output.
+in thie `tests` directory. We will run the `zope.testing.testrunner`
+and examine their output.
Short setups
------------
@@ -60,11 +60,8 @@
suite.addTest( # Add all functional tests from `cave`
z3c.testsetup.FunctionalDocTestSetup(cave).getTestSuite())
return suite
- <BLANKLINE>
- if __name__ == '__main__':
- unittest.main(default='test_suite')
- <BLANKLINE>
+
As we see, there is a unittest setup and a functional test setup
initialized. Both collect one kind of tests and feed their collection
in the same testsuite (where each kind of tests is setup differently,
Modified: Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/cave/samplesetup1.py
===================================================================
--- Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/cave/samplesetup1.py 2008-02-02 15:30:13 UTC (rev 83425)
+++ Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/cave/samplesetup1.py 2008-02-02 15:45:54 UTC (rev 83426)
@@ -9,6 +9,3 @@
suite.addTest( # Add all functional tests from `cave`
z3c.testsetup.FunctionalDocTestSetup(cave).getTestSuite())
return suite
-
-if __name__ == '__main__':
- unittest.main(default='test_suite')
Modified: Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/test_testsetup.py
===================================================================
--- Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/test_testsetup.py 2008-02-02 15:30:13 UTC (rev 83425)
+++ Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/tests/test_testsetup.py 2008-02-02 15:45:54 UTC (rev 83426)
@@ -70,6 +70,3 @@
suite.addTest(suiteFromFile(name))
suite.addTest(testrunner_suite())
return suite
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
Modified: Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/unitdoctestsetup.txt
===================================================================
--- Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/unitdoctestsetup.txt 2008-02-02 15:30:13 UTC (rev 83425)
+++ Sandbox/ulif/z3c-testsetup/trunk/src/z3c/testsetup/unitdoctestsetup.txt 2008-02-02 15:45:54 UTC (rev 83426)
@@ -66,14 +66,23 @@
def test_suite():
setup = grok.testing.UnitTestSetup(cave)
return setup.getTestSuite()
- if __name__ == '__main__':
- unittest.main(default='test_suite')
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`.
+Note: in many test setups you will find a code fragment like the
+ following at the end of file::
+ if __name__ == '__main__':
+ unittest.main(default='test_suite')
+
+ This is not neccessary for usual testrunner setups. A testrunner
+ will look for appropriate filenames (modules) and if those
+ modules provide a callable ``test_suite`` (usually a function)
+ this callable will be called to deliver a test suite.
+
+
UnitTestSetup default values
----------------------------
More information about the Checkins
mailing list