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 2005/07/08 17:03:09 UTC
svn commit: r209807 - in /gump/branches/Gump3/pygump/python/gump/test:
testConfig.py testEngineObjectifier.py testPluginsDynagumper.py
Author: leosimons
Date: Fri Jul 8 08:03:08 2005
New Revision: 209807
URL: http://svn.apache.org/viewcvs?rev=209807&view=rev
Log:
Start unit tests on the objectifier
Modified:
gump/branches/Gump3/pygump/python/gump/test/testConfig.py
gump/branches/Gump3/pygump/python/gump/test/testEngineObjectifier.py
gump/branches/Gump3/pygump/python/gump/test/testPluginsDynagumper.py
Modified: gump/branches/Gump3/pygump/python/gump/test/testConfig.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/test/testConfig.py?rev=209807&r1=209806&r2=209807&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/test/testConfig.py (original)
+++ gump/branches/Gump3/pygump/python/gump/test/testConfig.py Fri Jul 8 08:03:08 2005
@@ -36,9 +36,13 @@
return True
def __getattr__(self, name):
+ if name == "paths_work":
+ return ConfigTestCase.wd
return name
class ConfigTestCase(MockTestCase):
+ wd = os.path.join(os.environ["GUMP_HOME"], "pygump", "unittest")
+
def setUp(self):
# replace various methods with mockup versions
def newfileconfig(filename):
@@ -58,11 +62,18 @@
self.old_shutdown = logging.shutdown
logging.shutdown = new_shutdown_logging
-
+
+ # set up working directory
+ if not os.path.isdir(self.wd):
+ os.makedirs(self.wd)
+
def tearDown(self):
logging.config.fileConfig = self.old_fileConfig
logging.shutdown = self.old_shutdown
gump.config.get_logger = self.old_get_logger
+
+ import shutil
+ shutil.rmtree(self.wd)
def get_mock_logger(self, config, name):
self.failUnless(unittest.TestCase,
Modified: gump/branches/Gump3/pygump/python/gump/test/testEngineObjectifier.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/test/testEngineObjectifier.py?rev=209807&r1=209806&r2=209807&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/test/testEngineObjectifier.py (original)
+++ gump/branches/Gump3/pygump/python/gump/test/testEngineObjectifier.py Fri Jul 8 08:03:08 2005
@@ -22,12 +22,73 @@
import unittest
from pmock import *
+import os
+
from gump.engine.objectifier import *
class EngineObjectifierTestCase(MockTestCase):
def setUp(self):
- pass
+ self.log = self.mock()
+ self.log.stubs().method("debug")
+ self.log.stubs().method("info")
+ self.log.stubs().method("warning")
+ self.log.stubs().method("warn")
+ self.log.stubs().method("error")
+ self.log.stubs().method("critical")
+ self.log.stubs().method("log")
+ self.log.stubs().method("exception")
+ self.log.stubs().method("close")
+
+ self.workdir = os.path.join(os.environ["GUMP_HOME"], "pygump", "unittest", "work")
+ if not os.path.isdir(self.workdir):
+ os.makedirs(self.workdir)
+
+ self.o = Objectifier(self.log,self.workdir)
+
+ self.samplexml = """<?xml version="1.0"?>
+<workspace>
+ blah
+ <elem>contents</elem>
+ <stuff>ignore</stuff>
+ <elem>ignore</elem>
+ <blah></blah>
+ <repositories>
+ </repositories>
+ <modules>
+ </modules>
+ <projects>
+ <project>
+ <nested>
+ <uniquetaghere>
+ <foo/>
+ </uniquetaghere>
+ </nested>
+ </project>
+ </projects>
+</workspace>
+"""
+ self.sampledom = minidom.parseString(self.samplexml)
+
+ def tearDown(self):
+ import shutil
+ shutil.rmtree(self.workdir)
- def test_something(self):
- # TODO replace with something useful
- pass
+ def test_MissingDependencyError(self):
+ p = "someprojectname"
+ d = "somedependencyname"
+ e = MissingDependencyError(p,d)
+ self.assertEqual(e.project,p)
+ self.assertEqual(e.dependency_name,d)
+ self.assertTrue(e.__str__().index(p) > 0)
+ self.assertTrue(e.__str__().index(d) > 0)
+
+ def test_Objectifier__init__(self):
+ o = Objectifier(self.log,self.workdir)
+ self.assertEqual(self.log,o.log)
+ self.assertEqual(self.workdir,o.workdir)
+
+ self.assertRaises(AssertionError, Objectifier, self.log, "")
+ self.assertRaises(AssertionError, Objectifier, "", self.workdir)
+
+ def test_Objectifier_get_workspace(self):
+ w = self.o.get_workspace(self.sampledom)
\ No newline at end of file
Modified: gump/branches/Gump3/pygump/python/gump/test/testPluginsDynagumper.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/test/testPluginsDynagumper.py?rev=209807&r1=209806&r2=209807&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/test/testPluginsDynagumper.py (original)
+++ gump/branches/Gump3/pygump/python/gump/test/testPluginsDynagumper.py Fri Jul 8 08:03:08 2005
@@ -32,6 +32,7 @@
self.log.stubs().method("debug")
self.log.stubs().method("info")
self.log.stubs().method("warning")
+ self.log.stubs().method("warn")
self.log.stubs().method("error")
self.log.stubs().method("critical")
self.log.stubs().method("log")