391
391
# subdirectory of $XDG_CONFIG_HOME
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']
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)
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']
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')