You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gump.apache.org by le...@apache.org on 2004/12/06 21:59:09 UTC
svn commit: r110027 - in gump/trunk: . python/gump/test python/gump/tool/svg
Author: leosimons
Date: Mon Dec 6 12:59:09 2004
New Revision: 110027
URL: http://svn.apache.org/viewcvs?view=rev&rev=110027
Log:
Can now run all our tests using ./gump test. And easily add tests by creating files named gump/test/testSomething.py. Just see gump/test/testExample.py for an example (duh).
Added:
gump/trunk/python/gump/test/gump.log.config
gump/trunk/python/gump/test/testAllPyUnitTests.py
gump/trunk/python/gump/test/testExample.py
Modified:
gump/trunk/gump
gump/trunk/python/gump/test/ (props changed)
gump/trunk/python/gump/test/pyunit.py
gump/trunk/python/gump/tool/svg/ (props changed)
Modified: gump/trunk/gump
Url: http://svn.apache.org/viewcvs/gump/trunk/gump?view=diff&rev=110027&p1=gump/trunk/gump&r1=110026&p2=gump/trunk/gump&r2=110027
==============================================================================
--- gump/trunk/gump (original)
+++ gump/trunk/gump Mon Dec 6 12:59:09 2004
@@ -243,7 +243,7 @@
#./test/gumptest.sh
cd python
- python ../bin/testrunner.py -f ../python/gump/test/pyunit.py $@
+ python ../bin/testrunner.py -d ../python/gump/test $@
cd ..
export PYTHONPATH=$oldpythonpath
Added: gump/trunk/python/gump/test/gump.log.config
Url: http://svn.apache.org/viewcvs/gump/trunk/python/gump/test/gump.log.config?view=auto&rev=110027
==============================================================================
--- (empty file)
+++ gump/trunk/python/gump/test/gump.log.config Mon Dec 6 12:59:09 2004
@@ -0,0 +1,25 @@
+[loggers]
+keys=root
+
+[handlers]
+keys=stdout
+
+[formatters]
+keys=simple
+
+[logger_root]
+level=INFO
+handlers=stdout
+propagate=1
+qualname=gump
+
+[handler_stdout]
+class=StreamHandler
+level=NOTSET
+formatter=simple
+args=(sys.stdout,)
+
+[formatter_simple]
+format=%(message)s
+datefmt=
+
Modified: gump/trunk/python/gump/test/pyunit.py
Url: http://svn.apache.org/viewcvs/gump/trunk/python/gump/test/pyunit.py?view=diff&rev=110027&p1=gump/trunk/python/gump/test/pyunit.py&r1=110026&p2=gump/trunk/python/gump/test/pyunit.py&r2=110027
==============================================================================
--- gump/trunk/python/gump/test/pyunit.py (original)
+++ gump/trunk/python/gump/test/pyunit.py Mon Dec 6 12:59:09 2004
@@ -299,10 +299,9 @@
invokeGarbageCollection('Done Testing')
if problems: sys.exit(1)
- sys.exit(0)
+ #sys.exit(0)
-if __name__=='__main__':
-
+def doRun(patterns):
gumpinit()
runner=TestRunner()
@@ -391,11 +390,12 @@
#runner.addSuite(RDFDescriberTestSuite())
- # Any args are pattern matches
- patterns=list(sys.argv)
- del patterns[0:1]
-
# Perform the tests...
runner.run(patterns)
+if __name__=='__main__':
+ # Any args are pattern matches
+ patterns=list(sys.argv)
+ del patterns[0:1]
+ doRun(patterns)
Added: gump/trunk/python/gump/test/testAllPyUnitTests.py
Url: http://svn.apache.org/viewcvs/gump/trunk/python/gump/test/testAllPyUnitTests.py?view=auto&rev=110027
==============================================================================
--- (empty file)
+++ gump/trunk/python/gump/test/testAllPyUnitTests.py Mon Dec 6 12:59:09 2004
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+
+# Copyright 2003-2004 The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+"""
+ This module contains a wrapper from the standard unittest package
+ to the pyunit.py stuff some of the gump tests use.
+"""
+import unittest
+import gump.test.pyunit
+from unittest import TestCase
+
+import warnings
+warnings.filterwarnings('ignore')
+
+class AllTestCases(TestCase):
+ def testEverything(self):
+ gump.test.pyunit.doRun("*")
+
+# used by testrunner.py
+def test_suite():
+ return unittest.makeSuite(AllTestCases,'test')
+
+if __name__ == '__main__':
+ import os
+ gumpHome=os.path.abspath(os.path.join(os.getcwd(),'..'))
+ os.environ['GUMP_HOME']=gumpHome
+ os.chdir(gumpHome)
+ unittest.main()
\ No newline at end of file
Added: gump/trunk/python/gump/test/testExample.py
Url: http://svn.apache.org/viewcvs/gump/trunk/python/gump/test/testExample.py?view=auto&rev=110027
==============================================================================
--- (empty file)
+++ gump/trunk/python/gump/test/testExample.py Mon Dec 6 12:59:09 2004
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+
+# Copyright 2003-2004 The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+ This is an example of a testcase. Simply copy and rename this file
+ (the filename has to start with "test"), then rename the class below,
+ update the reference to the classname in the test_suite() method,
+ and write your test methods.
+
+ See the documentation for the unittest package for more help with
+ tests. You can run all tests from the commandline using "./gump test".
+"""
+
+import unittest
+from unittest import TestCase
+
+class ExampleTestCase(TestCase):
+ def setUp(self):
+ # initialize tests here
+ pass
+
+ def tearDown(self):
+ # clean up after tests here
+ pass
+
+ def testSomething(self):
+ # you can do anything inside a test
+ # use the assertXXX methods on TestCase
+ # to check conditions
+ self.assert_( True )
+ self.assertEquals( type({}), type({}) )
+
+# this is used by testrunner.py to determine what tests to run
+def test_suite():
+ # be sure to change the referenceto the TestCase class you create above!
+ return unittest.makeSuite(ExampleTestCase,'test')
+
+# this allows us to run this test by itself from the commandline
+if __name__ == '__main__':
+ unittest.main()
\ No newline at end of file