/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Jelmer Vernooij
  • Date: 2011-01-19 18:40:15 UTC
  • mfrom: (5622 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5624.
  • Revision ID: jelmer@samba.org-20110119184015-ahycpz0yduideif0
merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
402
402
 
403
403
    def setUp(self):
404
404
        super(TestConfigPath, self).setUp()
405
 
        os.environ['HOME'] = '/home/bogus'
406
 
        os.environ['XDG_CACHE_DIR'] = ''
 
405
        self.overrideEnv('HOME', '/home/bogus')
 
406
        self.overrideEnv('XDG_CACHE_DIR', '')
407
407
        if sys.platform == 'win32':
408
 
            os.environ['BZR_HOME'] = \
409
 
                r'C:\Documents and Settings\bogus\Application Data'
 
408
            self.overrideEnv(
 
409
                'BZR_HOME', r'C:\Documents and Settings\bogus\Application Data')
410
410
            self.bzr_home = \
411
411
                'C:/Documents and Settings/bogus/Application Data/bazaar/2.0'
412
412
        else:
441
441
            raise tests.TestNotApplicable(
442
442
                'XDG config dir not used on this platform')
443
443
        super(TestXDGConfigDir, self).setUp()
444
 
        os.environ['HOME'] = self.test_home_dir
 
444
        self.overrideEnv('HOME', self.test_home_dir)
445
445
        # BZR_HOME overrides everything we want to test so unset it.
446
 
        del os.environ['BZR_HOME']
 
446
        self.overrideEnv('BZR_HOME', None)
447
447
 
448
448
    def test_xdg_config_dir_exists(self):
449
449
        """When ~/.config/bazaar exists, use it as the config dir."""
454
454
    def test_xdg_config_home(self):
455
455
        """When XDG_CONFIG_HOME is set, use it."""
456
456
        xdgconfigdir = osutils.pathjoin(self.test_home_dir, 'xdgconfig')
457
 
        os.environ['XDG_CONFIG_HOME'] = xdgconfigdir
 
457
        self.overrideEnv('XDG_CONFIG_HOME', xdgconfigdir)
458
458
        newdir = osutils.pathjoin(xdgconfigdir, 'bazaar')
459
459
        os.makedirs(newdir)
460
460
        self.assertEqual(config.config_dir(), newdir)
1308
1308
        self.assertEqual('bzr', my_config.get_bzr_remote_path())
1309
1309
        my_config.set_user_option('bzr_remote_path', '/path-bzr')
1310
1310
        self.assertEqual('/path-bzr', my_config.get_bzr_remote_path())
1311
 
        os.environ['BZR_REMOTE_PATH'] = '/environ-bzr'
 
1311
        self.overrideEnv('BZR_REMOTE_PATH', '/environ-bzr')
1312
1312
        self.assertEqual('/environ-bzr', my_config.get_bzr_remote_path())
1313
1313
 
1314
1314
 
1360
1360
        self.assertEqual("John", my_config._get_user_id())
1361
1361
 
1362
1362
    def test_BZR_EMAIL_OVERRIDES(self):
1363
 
        os.environ['BZR_EMAIL'] = "Robert Collins <robertc@example.org>"
 
1363
        self.overrideEnv('BZR_EMAIL', "Robert Collins <robertc@example.org>")
1364
1364
        branch = FakeBranch()
1365
1365
        my_config = config.BranchConfig(branch)
1366
1366
        self.assertEqual("Robert Collins <robertc@example.org>",