[Zodb-checkins] SVN: ZODB/trunk/setup.py Wrap the zope testrunner for ZODB in something that can be invoked using "setup.py test". The ultimate result is:

Chris McDonough chrism at plope.com
Sun Nov 11 22:14:06 EST 2007


Log message for revision 81760:
  Wrap the zope testrunner for ZODB in something that can be invoked using "setup.py test".  The ultimate result is:
  
    Ran 2510 tests in 629.115s
  
    OK
  
  Although when I do:
  
    python bootstrap.py
    bin/buildout
    bin/test
  
  I get:
  
    Ran 2821 tests with 0 failures and 0 errors in 6 minutes 55.513 seconds.
  
  I'm not entirely sure how to account for the difference in # of tests yet.
  

Changed:
  U   ZODB/trunk/setup.py

-=-
Modified: ZODB/trunk/setup.py
===================================================================
--- ZODB/trunk/setup.py	2007-11-12 02:44:00 UTC (rev 81759)
+++ ZODB/trunk/setup.py	2007-11-12 03:14:06 UTC (rev 81760)
@@ -210,9 +210,24 @@
         self.cmdclass['build_py'] = MyPyBuilder
         self.cmdclass['install_lib'] = MyLibInstaller
 
+def alltests():
+    # use the zope.testing testrunner machinery to find all the
+    # test suites we've put under ourselves
+    from zope.testing.testrunner import get_options
+    from zope.testing.testrunner import find_suites
+    from zope.testing.testrunner import configure_logging
+    configure_logging()
+    from unittest import TestSuite
+    here = os.path.abspath(os.path.dirname(sys.argv[0]))
+    args = sys.argv[:]
+    src = os.path.join(here, 'src')
+    defaults = ['--test-path', src]
+    options = get_options(args, defaults)
+    suites = list(find_suites(options))
+    return TestSuite(suites)
+
 doclines = __doc__.split("\n")
 
-
 setup(name="ZODB3",
       version=VERSION,
       maintainer="Zope Corporation",
@@ -229,6 +244,14 @@
       classifiers = filter(None, classifiers.split("\n")),
       long_description = "\n".join(doclines[2:]),
       distclass = MyDistribution,
+      test_suite="__main__.alltests", # to support "setup.py test"
+      tests_require = [
+        'zope.interface',
+        'zope.proxy',
+        'zope.testing',
+        'transaction',
+        'zdaemon',
+        ],
       install_requires = [
         'zope.interface',
         'zope.proxy',



More information about the Zodb-checkins mailing list