Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

implemented the 'cheetah' wrapper script and refactored

unittest_local_copy.TestProgram a bit
  • Loading branch information...
commit 01300fd47277dd07ba912c6d8736f2e90155edb1 1 parent f78d83a
tavis_rudd authored
View
1  SetupConfig.py
@@ -30,6 +30,7 @@
## Data Files and Scripts
scripts = ['bin/cheetah-compile',
+ 'bin/cheetah',
]
data_files = ['recursive: src *.tmpl *.txt LICENSE README TODO CHANGES',
]
View
9 src/Tests/Template.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# $Id: Template.py,v 1.5 2002/03/06 22:01:36 tavis_rudd Exp $
+# $Id: Template.py,v 1.6 2002/03/07 04:39:55 tavis_rudd Exp $
"""Tests of the Template class API
THIS TEST MODULE IS JUST A SHELL AT THE MOMENT. Feel like filling it in??
@@ -7,12 +7,12 @@
Meta-Data
================================================================================
Author: Tavis Rudd <tavis@calrudd.com>,
-Version: $Revision: 1.5 $
+Version: $Revision: 1.6 $
Start Date: 2001/10/01
-Last Revision Date: $Date: 2002/03/06 22:01:36 $
+Last Revision Date: $Date: 2002/03/07 04:39:55 $
"""
__author__ = "Tavis Rudd <tavis@calrudd.com>"
-__revision__ = "$Revision: 1.5 $"[11:-2]
+__revision__ = "$Revision: 1.6 $"[11:-2]
##################################################
@@ -23,6 +23,7 @@
import os
import os.path
+
import unittest_local_copy as unittest
from Cheetah.Template import Template
View
48 src/Tests/Test.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# $Id: Test.py,v 1.34 2002/03/07 04:02:42 tavis_rudd Exp $
+# $Id: Test.py,v 1.35 2002/03/07 04:39:55 tavis_rudd Exp $
"""Core module of Cheetah's Unit-testing framework
TODO
@@ -14,12 +14,12 @@
Author: Tavis Rudd <tavis@calrudd.com>,
License: This software is released for unlimited distribution under the
terms of the Python license.
-Version: $Revision: 1.34 $
+Version: $Revision: 1.35 $
Start Date: 2001/03/30
-Last Revision Date: $Date: 2002/03/07 04:02:42 $
+Last Revision Date: $Date: 2002/03/07 04:39:55 $
"""
__author__ = "Tavis Rudd <tavis@calrudd.com>"
-__revision__ = "$Revision: 1.34 $"[11:-2]
+__revision__ = "$Revision: 1.35 $"[11:-2]
##################################################
@@ -35,29 +35,25 @@
False = (0==1)
##################################################
-## CLASSES
-class RunTests:
- def __init__(self):
- pass
- def run(self):
- import SyntaxAndOutput
- suite = unittest.findTestCases(SyntaxAndOutput)
-
- import NameMapper
- suite.addTest( unittest.findTestCases(NameMapper) )
-
- import Template
- suite.addTest( unittest.findTestCases(Template) )
-
- import CheetahCompile
- suite.addTest( unittest.findTestCases(CheetahCompile) )
-
- import FileRefresh
- suite.addTest( unittest.findTestCases(FileRefresh) )
-
- unittest.TextTestRunner().run(suite)
+## TESTS
+
+import SyntaxAndOutput
+import NameMapper
+import Template
+import CheetahCompile
+import FileRefresh
+
+testSuite = unittest.findTestCases(SyntaxAndOutput)
+testSuite.addTest( unittest.findTestCases(NameMapper) )
+testSuite.addTest( unittest.findTestCases(Template) )
+testSuite.addTest( unittest.findTestCases(CheetahCompile) )
+testSuite.addTest( unittest.findTestCases(FileRefresh) )
##################################################
## if run from the command line
if __name__ == '__main__':
- Tests().run()
+ unittest.main(testSuite=testSuite)
+ #unittest.TextTestRunner().run(testSuite)
+
+
+
View
13 src/Tests/unittest_local_copy.py
@@ -78,7 +78,7 @@ def testMultiply(self);
__author__ = "Steve Purcell"
__email__ = "stephen_purcell at yahoo dot com"
-__revision__ = "$Revision: 1.4 $"[11:-2]
+__revision__ = "$Revision: 1.5 $"[11:-2]
##################################################
@@ -827,7 +827,8 @@ class TestProgram:
in MyTestCase
"""
def __init__(self, module='__main__', defaultTest=None,
- argv=None, testRunner=None, testLoader=defaultTestLoader):
+ argv=None, testRunner=None, testLoader=defaultTestLoader,
+ testSuite=None):
if type(module) == type(''):
self.module = __import__(module)
for part in string.split(module,'.')[1:]:
@@ -836,6 +837,7 @@ def __init__(self, module='__main__', defaultTest=None,
self.module = module
if argv is None:
argv = sys.argv
+ self.test = testSuite
self.verbosity = 1
self.explain = 0
self.defaultTest = defaultTest
@@ -864,7 +866,7 @@ def parseArgs(self, argv):
self.verbosity = 2
if opt in ('-e','--explain'):
self.explain = True
- if len(args) == 0 and self.defaultTest is None:
+ if len(args) == 0 and self.defaultTest is None and self.test is None:
self.test = self.testLoader.loadTestsFromModule(self.module)
return
if len(args) > 0:
@@ -876,8 +878,9 @@ def parseArgs(self, argv):
self.usageExit(msg)
def createTests(self):
- self.test = self.testLoader.loadTestsFromNames(self.testNames,
- self.module)
+ if self.test == None:
+ self.test = self.testLoader.loadTestsFromNames(self.testNames,
+ self.module)
def runTests(self):
if self.testRunner is None:
Please sign in to comment.
Something went wrong with that request. Please try again.