gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leosim...@apache.org
Subject svn commit: r156235 - in gump/branches/Gump3: gump pygump/main.py pygump/python/gump/test/testDynagumper.py pygump/python/gump/test/testExample.py
Date Sat, 05 Mar 2005 08:44:39 GMT
Author: leosimons
Date: Sat Mar  5 00:44:36 2005
New Revision: 156235

URL: http://svn.apache.org/viewcvs?view=rev&rev=156235
Log:
There is finally a decent mock objects framework for python in development: http://pmock.sourceforge.net/.
Let's start using it.

Modified:
    gump/branches/Gump3/gump
    gump/branches/Gump3/pygump/main.py
    gump/branches/Gump3/pygump/python/gump/test/testDynagumper.py
    gump/branches/Gump3/pygump/python/gump/test/testExample.py

Modified: gump/branches/Gump3/gump
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/gump?view=diff&r1=156234&r2=156235
==============================================================================
--- gump/branches/Gump3/gump (original)
+++ gump/branches/Gump3/gump Sat Mar  5 00:44:36 2005
@@ -575,6 +575,7 @@
 # Run pygump unit tests
 function test
 {
+  check_pylib "pmock" "http://pmock.sourceforge.net/"
   lock
   
   # add pygump to python path
@@ -584,6 +585,7 @@
   else
     export PYTHONPATH="$GUMP_HOME/pygump/python:$GUMP_HOME/pygump:$PYTHONPATH"
   fi
+  
 
   local current=`pwd`
   cd "$GUMP_HOME/pygump/python"

Modified: gump/branches/Gump3/pygump/main.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/main.py?view=diff&r1=156234&r2=156235
==============================================================================
--- gump/branches/Gump3/pygump/main.py (original)
+++ gump/branches/Gump3/pygump/main.py Sat Mar  5 00:44:36 2005
@@ -398,8 +398,8 @@
             log.level = DEBUG
     
         # print some basic debug info...
-        log.info("Pygump version %s starting..." % (options.version) )
-        log.info("  (the detailed log is written to %s)" % (log.filename) )
+        log.debug("Pygump version %s starting..." % (options.version) )
+        log.debug("  (the detailed log is written to %s)" % (log.filename) )
         log.debug('  - hostname           : ' + options.hostname)
         log.debug('  - homedir            : ' + options.homedir)
         log.debug('  - current time       : ' + options.starttime)

Modified: gump/branches/Gump3/pygump/python/gump/test/testDynagumper.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/test/testDynagumper.py?view=diff&r1=156234&r2=156235
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/test/testDynagumper.py (original)
+++ gump/branches/Gump3/pygump/python/gump/test/testDynagumper.py Sat Mar  5 00:44:36 2005
@@ -18,35 +18,49 @@
 __license__   = "http://www.apache.org/licenses/LICENSE-2.0"
 
 import unittest
+import pmock
+from pmock import *
 
-from gump.test.mockobjects import *
 from gump.plugins.dynagumper import Dynagumper
-from gump.model import Project
 
-mock = MockObjects()
-
-class DynagumperTestCase(unittest.TestCase):
+class DynagumperTestCase(pmock.MockTestCase):
     def setUp(self):
-        self.dynagumper = Dynagumper(mock.database,mock.log)
-        self.project = Project("blah", "blah")
-        self.project.startdate = "21 June 2005"
-        self.project.enddate = "22 June 2005"
+        self.log = self.mock()
+        self.log.stubs().method("debug")
+        self.log.stubs().method("info")
+        self.log.stubs().method("warning")
+        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.db = self.mock()
     
-    def testEnsureThisHostIsInDatabase(self):
+    def test_ensureThisHostIsInDatabase(self):
         #TODO actual tests
-        self.dynagumper.ensureThisHostIsInDatabase()
+        db = self.mock()
+        db.expects(once()).method("execute")
+        dynagumper = Dynagumper(db,self.log)
+        dynagumper.ensureThisHostIsInDatabase()
 
-    def testVisitWorkSpace(self):
+    def test_visit_workspace(self):
         #TODO
-        self.dynagumper.visit_workspace("blah")
+        dynagumper = Dynagumper(self.db,self.log)
+        dynagumper.visit_workspace("blah")
     
-    def testVisitModule(self):
+    def test_visit_module(self):
         #TODO
-        self.dynagumper.visit_module("blah")
+        dynagumper = Dynagumper(self.db,self.log)
+        dynagumper.visit_module("blah")
     
-    def testVisitProject(self):
+    def test_visit_project(self):
         #TODO
-        self.dynagumper.visit_project(self.project)
+        dynagumper = Dynagumper(self.db,self.log)
+        self.project = self.mock()
+        self.project.name = "blah"
+        self.project.startdate = "21 June 2005"
+        self.project.enddate = "22 June 2005"
+        dynagumper.visit_project(self.project)
 
 # this is used by testrunner.py to determine what tests to run
 def test_suite():

Modified: gump/branches/Gump3/pygump/python/gump/test/testExample.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/test/testExample.py?view=diff&r1=156234&r2=156235
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/test/testExample.py (original)
+++ gump/branches/Gump3/pygump/python/gump/test/testExample.py Sat Mar  5 00:44:36 2005
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Copyright 2004-2005 The Apache Software Foundation
+# Copyright 2005 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.
@@ -39,7 +39,7 @@
         # clean up after tests here
         pass
         
-    def testSomething(self):
+    def test_something(self):
         # you can do anything inside a test
         # use the assertXXX methods on TestCase
         # to check conditions



Mime
View raw message