diff cmd2.py @ 326:237a89d5a4a9

run() working
author catherine@dellzilla
date Thu, 11 Feb 2010 17:47:29 -0500
parents 4172feeddf76
children e9eea93c777c
line wrap: on
line diff
--- a/cmd2.py	Thu Feb 11 17:03:45 2010 -0500
+++ b/cmd2.py	Thu Feb 11 17:47:29 2010 -0500
@@ -1430,7 +1430,7 @@
             self.outputTrap = OutputTrap()
             self.cmdapp = self.CmdApp()
             self.fetchTranscripts()
-    def testall(self):
+    def runTest(self): # was testall
         if self.CmdApp:
             its = sorted(self.transcripts.items())
             for (fname, transcript) in its:
@@ -1485,9 +1485,12 @@
                       help='Test against transcript(s) in FILE (wildcards OK)')
     (callopts, callargs) = parser.parse_args()
     if callopts.test:
-        app.testfiles = callargs
+        app.__class__.testfiles = callargs
         sys.argv = [sys.argv[0]] # the --test argument upsets unittest.main()
-        unittest.main()
+        testcase = TestMyAppCase()
+        runner = unittest.TextTestRunner()
+        result = runner.run(testcase)
+        result.printErrors()
     else:
         app.cmdloop()