~verterok/ubuntuone-client/volumemanager_udfs-2

« back to all changes in this revision

Viewing changes to contrib/testing/testcase.py

  • Committer: guillermo.gonzalez at canonical
  • Date: 2010-01-04 18:54:17 UTC
  • mfrom: (294.2.6 trunk)
  • Revision ID: guillermo.gonzalez@canonical.com-20100104185417-is0onxq4znx57u0j
merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
195
195
 
196
196
    def setUp(self):
197
197
        TwistedTestCase.setUp(self)
198
 
        # invalidate the current config
 
198
        # use the config from the branch
 
199
        self.old_get_config_files = config.get_config_files
 
200
        config.get_config_files = lambda: [os.path.join(os.environ['ROOTDIR'],
 
201
                                                   'data', 'syncdaemon.conf')]
 
202
        # fake a very basic config file with sane defaults for the tests
199
203
        config_file = os.path.join(self.mktemp('config'), 'syncdaemon.conf')
200
 
        # fake a very basic config file with sane defaults for the tests
201
204
        with open(config_file, 'w') as fp:
202
205
            fp.write('[bandwidth_throttling]\n')
203
206
            fp.write('on = False\n')
204
207
            fp.write('read_limit = -1\n')
205
208
            fp.write('write_limit = -1\n')
 
209
        # invalidate the current config
206
210
        config._user_config = None
207
211
        config.get_user_config(config_file=config_file)
208
212
 
210
214
        """ cleanup the temp dir. """
211
215
        # invalidate the current config
212
216
        config._user_config = None
213
 
        config.get_user_config()
 
217
        # restore the old get_config_files
 
218
        config.get_config_files = self.old_get_config_files
214
219
        if hasattr(self, '__root'):
215
220
            self.rmtree(self.__root)
216
221
        return TwistedTestCase.tearDown(self)