432
432
'/home/bogus/.cache')
435
class TestXDGConfigDir(tests.TestCaseInTempDir):
436
# must be in temp dir because config tests for the existence of the bazaar
437
# subdirectory of $XDG_CONFIG_HOME
440
if sys.platform in ('darwin', 'win32'):
441
raise tests.TestNotApplicable(
442
'XDG config dir not used on this platform')
443
super(TestXDGConfigDir, self).setUp()
444
os.environ['HOME'] = self.test_home_dir
445
# BZR_HOME overrides everything we want to test so unset it.
446
del os.environ['BZR_HOME']
448
def test_xdg_config_dir_exists(self):
449
"""When ~/.config/bazaar exists, use it as the config dir."""
450
newdir = osutils.pathjoin(self.test_home_dir, '.config', 'bazaar')
452
self.assertEqual(config.config_dir(), newdir)
454
def test_xdg_config_home(self):
455
"""When XDG_CONFIG_HOME is set, use it."""
456
xdgconfigdir = osutils.pathjoin(self.test_home_dir, 'xdgconfig')
457
os.environ['XDG_CONFIG_HOME'] = xdgconfigdir
458
newdir = osutils.pathjoin(xdgconfigdir, 'bazaar')
460
self.assertEqual(config.config_dir(), newdir)
435
463
class TestIniConfig(tests.TestCaseInTempDir):
437
465
def make_config_parser(self, s):