diff options
Diffstat (limited to 'lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/test/util/connector_component.py')
-rw-r--r-- | lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/test/util/connector_component.py | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/test/util/connector_component.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/test/util/connector_component.py deleted file mode 100644 index 159e824c..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/test/util/connector_component.py +++ /dev/null @@ -1,54 +0,0 @@ -# This file is part of Buildbot. Buildbot is free software: you can -# redistribute it and/or modify it under the terms of the GNU General Public -# License as published by the Free Software Foundation, version 2. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Copyright Buildbot Team Members - -from buildbot.db import model -from buildbot.test.util import db -from buildbot.test.fake import fakemaster - -class FakeDBConnector(object): - pass - -class ConnectorComponentMixin(db.RealDatabaseMixin): - """ - Implements a mock DBConnector object, replete with a thread pool and a DB - model. This includes a RealDatabaseMixin, so subclasses should not - instantiate that class directly. The connector appears at C{self.db}, and - the component should be attached to it as an attribute. - - @ivar db: fake database connector - @ivar db.pool: DB thread pool - @ivar db.model: DB model - """ - def setUpConnectorComponent(self, table_names=[], basedir='basedir'): - """Set up C{self.db}, using the given db_url and basedir.""" - d = self.setUpRealDatabase(table_names=table_names, basedir=basedir) - def finish_setup(_): - self.db = FakeDBConnector() - self.db.pool = self.db_pool - self.db.model = model.Model(self.db) - self.db.master = fakemaster.make_master() - d.addCallback(finish_setup) - return d - - def tearDownConnectorComponent(self): - d = self.tearDownRealDatabase() - def finish_cleanup(_): - self.db_pool.shutdown() - # break some reference loops, just for fun - del self.db.pool - del self.db.model - del self.db - d.addCallback(finish_cleanup) - return d |