~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Andrew Bennetts
  • Date: 2010-11-29 00:34:03 UTC
  • mto: This revision was merged to the branch mainline in revision 5553.
  • Revision ID: andrew.bennetts@canonical.com-20101129003403-z5a6z1zk6vab8typ
Cosmetic tweaks to TestXDGConfigDir.

Show diffs side-by-side

added added

removed removed

Lines of Context:
391
391
    # subdirectory of $XDG_CONFIG_HOME
392
392
 
393
393
    def setUp(self):
 
394
        if sys.platform in ('darwin', 'win32'):
 
395
            raise tests.TestNotApplicable(
 
396
                'XDG config dir not used on this platform')
394
397
        super(TestXDGConfigDir, self).setUp()
395
398
        os.environ['HOME'] = self.test_home_dir
 
399
        # BZR_HOME overrides everything we want to test so unset it.
 
400
        del os.environ['BZR_HOME']
396
401
 
397
402
    def test_xdg_config_dir_exists(self):
398
 
        if sys.platform in ('darwin', 'win32'):
399
 
            raise tests.TestNotApplicable
400
 
        # this overrides everything we want to test so get rid of it
401
 
        del os.environ['BZR_HOME'] 
 
403
        """When ~/.config/bazaar exists, use it as the config dir."""
402
404
        newdir = osutils.pathjoin(self.test_home_dir, '.config', 'bazaar')
403
405
        os.makedirs(newdir)
404
406
        self.assertEqual(config.config_dir(), newdir)
405
407
 
406
408
    def test_xdg_config_home(self):
407
 
        if sys.platform in ('darwin', 'win32'):
408
 
            raise tests.TestNotApplicable
409
 
        # this overrides everything we want to test so get rid of it
410
 
        del os.environ['BZR_HOME']
411
 
 
 
409
        """When XDG_CONFIG_HOME is set, use it."""
412
410
        xdgconfigdir = osutils.pathjoin(self.test_home_dir, 'xdgconfig')
413
411
        os.environ['XDG_CONFIG_HOME'] = xdgconfigdir
414
412
        newdir = osutils.pathjoin(xdgconfigdir, 'bazaar')