177
177
super(TestConfigPath, self).setUp()
178
self.oldenv = os.environ.get('HOME', None)
178
self.old_home = os.environ.get('HOME', None)
179
self.old_appdata = os.environ.get('APPDATA', None)
179
180
os.environ['HOME'] = '/home/bogus'
181
os.environ['APPDATA'] = \
182
r'C:\Documents and Settings\bogus\Application Data'
181
184
def tearDown(self):
182
os.environ['HOME'] = self.oldenv
185
if self.old_home is None:
186
del os.environ['HOME']
188
os.environ['HOME'] = self.old_home
189
if self.old_appdata is None:
190
del os.environ['APPDATA']
192
os.environ['APPDATA'] = self.old_appdata
183
193
super(TestConfigPath, self).tearDown()
185
195
def test_config_dir(self):
186
self.assertEqual(config.config_dir(), '/home/bogus/.bazaar')
196
if sys.platform == 'win32':
197
self.assertEqual(config.config_dir(),
198
r'C:\Documents and Settings\bogus\Application Data\bazaar\2.0')
200
self.assertEqual(config.config_dir(), '/home/bogus/.bazaar')
188
202
def test_config_filename(self):
189
self.assertEqual(config.config_filename(),
190
'/home/bogus/.bazaar/bazaar.conf')
203
if sys.platform == 'win32':
204
self.assertEqual(config.config_filename(),
205
r'C:\Documents and Settings\bogus\Application Data\bazaar\2.0\bazaar.conf')
207
self.assertEqual(config.config_filename(),
208
'/home/bogus/.bazaar/bazaar.conf')
192
210
def test_branches_config_filename(self):
193
self.assertEqual(config.branches_config_filename(),
194
'/home/bogus/.bazaar/branches.conf')
211
if sys.platform == 'win32':
212
self.assertEqual(config.branches_config_filename(),
213
r'C:\Documents and Settings\bogus\Application Data\bazaar\2.0\branches.conf')
215
self.assertEqual(config.branches_config_filename(),
216
'/home/bogus/.bazaar/branches.conf')
196
218
class TestIniConfig(TestCase):