changeset 1:32e9f0e94c69

Fix running the unit tests from distutils.
author cmlenz
date Sun, 22 May 2005 16:19:04 +0000
parents 0b2a3581c48d
children 3ba3fb6f0054
files bitten/distutils/testrunner.py bitten/tests/__init__.py setup.cfg setup.py
diffstat 4 files changed, 9 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/distutils/testrunner.py
+++ b/bitten/distutils/testrunner.py
@@ -80,6 +80,7 @@
         self.test_descriptions = None
 
     def finalize_options(self):
+        assert self.test_suite, 'Missing required attribute "test-suite"'
         if self.xml_output is not None:
             self.xml_output = open(self.xml_output, 'w')
 
new file mode 100644
--- /dev/null
+++ b/bitten/tests/__init__.py
@@ -0,0 +1,5 @@
+import unittest
+
+def suite():
+    suite = unittest.TestSuite()
+    return suite
new file mode 100644
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,2 @@
+[test]
+test-suite = bitten.tests
--- a/setup.py
+++ b/setup.py
@@ -1,24 +1,5 @@
 from distutils.core import setup, Command
-from unittest import TextTestRunner
-
-
-class test(Command):
-    description = "Runs the unit tests"
-    user_options = [('test-suite=', 's', "Name of the unittest suite to run")]
-
-    def initialize_options(self):
-        self.test_suite = None
-
-    def finalize_options(self):
-        pass
-
-    def run(self):
-        print 'Hey yo'
-        print self.test_suite
-        suite = __import__(self.test_suite, locals(), globals())
-        runner = unittest.TextTestRunner()
-        TextTestRunner.run(suite)
-
+from bitten.distutils.testrunner import test
 
 setup(name='bitten', version='1.0',
       packages=['bitten', 'bitten.general', 'bitten.python'],
Copyright (C) 2012-2017 Edgewall Software