diff options
Diffstat (limited to 'lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/test/util/change_import.py')
-rw-r--r-- | lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/test/util/change_import.py | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/test/util/change_import.py b/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/test/util/change_import.py deleted file mode 100644 index e461dda6..00000000 --- a/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/test/util/change_import.py +++ /dev/null @@ -1,62 +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 __future__ import with_statement - -import os -import shutil -import cPickle -from buildbot.test.util import db - -from buildbot.changes.changes import Change, OldChangeMaster - -class ChangeImportMixin(db.RealDatabaseMixin): - """ - We have a number of tests that examine the results of importing particular - flavors of Change objects. This class uses some pickling to make this easy - to test. - - This is a subclass of RealDatabaseMixin, so do not inherit from that class - separately! - - >>> self.make_pickle(self.make_change(who=u'jimmy'), self.make_change(who='johnny')) - """ - def make_pickle(self, *changes, **kwargs): - recode_fn = kwargs.pop('recode_fn', None) - cm = OldChangeMaster() - cm.changes = changes - if recode_fn: - recode_fn(cm) - with open(self.changes_pickle, "wb") as f: - cPickle.dump(cm, f) - - def make_change(self, **kwargs): - return Change(**kwargs) - - def setUpChangeImport(self): - self.basedir = os.path.abspath("basedir") - if os.path.exists(self.basedir): - shutil.rmtree(self.basedir) - os.makedirs(self.basedir) - self.changes_pickle = os.path.join(self.basedir, "changes.pck") - return self.setUpRealDatabase() - - def tearDownChangeImport(self): - d = self.tearDownRealDatabase() - def rmtree(_): - if os.path.exists(self.basedir): - shutil.rmtree(self.basedir) - d.addCallback(rmtree) - return d |