Author: Antonio Cuni <[email protected]>
Branch: 0.8.4-compat
Changeset: r569:30b605eaa294
Date: 2011-08-08 12:43 +0200
http://bitbucket.org/pypy/buildbot/changeset/30b605eaa294/

Log:    refactor the mock objects, tests now pass again

diff --git a/bot2/pypybuildbot/test/test_summary.py 
b/bot2/pypybuildbot/test/test_summary.py
--- a/bot2/pypybuildbot/test/test_summary.py
+++ b/bot2/pypybuildbot/test/test_summary.py
@@ -357,14 +357,26 @@
              'factory': process_factory.BuildFactory() }
     return process_builder.Builder(setup, status)
 
-class FakeRequest(object):
 
-    def __init__(self, builders, args={}):
-        status = status_builder.Status(self, '/tmp')
-        status.basedir = None
-        self.status = status
-        self.args = args
+class FakeMaster(object):
+    basedir = None
+    buildbotURL = "http://buildbot/";
 
+    def __init__(self, builders):
+        self.botmaster = FakeBotMaster(builders)
+
+    def subscribeToBuildsetCompletions(self, callback):
+        pass
+
+    def subscribeToBuildsets(self, callback):
+        pass
+
+    def subscribeToBuildRequests(self, callback):
+        pass
+
+class FakeBotMaster(object):
+
+    def __init__(self, builders):
         self.builderNames = []
         self.builders = {}
         for builder in builders:
@@ -372,14 +384,28 @@
             self.builderNames.append(name)
             self.builders[name] = _BuilderToStatus(builder)
 
-        self.site = self
-        self.buildbot_service = self
-        self.parent = self
-        self.buildbotURL = "http://buildbot/";
+class FakeSite(object):
+
+    def __init__(self, status):
+        self.buildbot_service = FakeService(status)
+
+class FakeService(object):
+    
+    def __init__(self, status):
+        self.status = status
 
     def getStatus(self):
         return self.status
 
+class FakeRequest(object):
+
+    def __init__(self, builders, args={}):
+        master = FakeMaster(builders)
+        status = status_builder.Status(master)
+        self.args = args
+        self.site = FakeSite(status)
+
+
 def witness_cat_branch(summary):
     ref = [None]
     recentRuns = summary.recentRuns
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to