~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testconfig.py

  • Committer: Robert Collins
  • Date: 2005-10-17 04:27:17 UTC
  • mto: This revision was merged to the branch mainline in revision 1459.
  • Revision ID: robertc@lifelesslap.robertcollins.net-20051017042717-6f94bc63b0c04a01
move environment preservation up to the root test case, making it available to all tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
153
153
 
154
154
    def tearDown(self):
155
155
        os.environ['HOME'] = self.oldenv
 
156
        super(TestConfigPath, self).tearDown()
156
157
    
157
158
    def test_config_dir(self):
158
159
        self.assertEqual(config.config_dir(), '/home/bogus/.bazaar')
218
219
        self.failUnless(location_config is my_config._get_location_config())
219
220
 
220
221
 
221
 
class TestConfigItems(TestCase):
222
 
 
223
 
    def setUp(self):
224
 
        super(TestConfigItems, self).setUp()
225
 
        self.bzr_email = os.environ.get('BZREMAIL')
226
 
        if self.bzr_email is not None:
227
 
            del os.environ['BZREMAIL']
228
 
        self.email = os.environ.get('EMAIL')
229
 
        if self.email is not None:
230
 
            del os.environ['EMAIL']
231
 
        self.oldenv = os.environ.get('HOME', None)
232
 
        os.environ['HOME'] = os.getcwd()
233
 
 
234
 
    def tearDown(self):
235
 
        os.environ['HOME'] = self.oldenv
236
 
        if os.environ.get('BZREMAIL') is not None:
237
 
            del os.environ['BZREMAIL']
238
 
        if self.bzr_email is not None:
239
 
            os.environ['BZREMAIL'] = self.bzr_email
240
 
        if self.email is not None:
241
 
            os.environ['EMAIL'] = self.email
242
 
        super(TestConfigItems, self).tearDown()
243
 
 
244
 
 
245
 
class TestGlobalConfigItems(TestConfigItems):
 
222
class TestGlobalConfigItems(TestCase):
246
223
 
247
224
    def test_user_id(self):
248
225
        config_file = StringIO(sample_config_text)
288
265
        self.assertEqual(False, my_config.signature_needed())
289
266
 
290
267
 
291
 
class TestLocationConfig(TestConfigItems):
 
268
class TestLocationConfig(TestCase):
292
269
 
293
270
    def test_constructs(self):
294
271
        my_config = config.LocationConfig('http://example.com')
408
385
                         self.my_config.signature_checking())
409
386
        
410
387
 
411
 
class TestBranchConfigItems(TestConfigItems):
 
388
class TestBranchConfigItems(TestCase):
412
389
 
413
390
    def test_user_id(self):
414
391
        branch = FakeBranch()