Merge lp:~vila/bzr/1235099-prereq into lp:bzr

Proposed by Vincent Ladeuil
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 6589
Proposed branch: lp:~vila/bzr/1235099-prereq
Merge into: lp:bzr
Diff against target: 164 lines (+28/-24)
1 file modified
bzrlib/tests/test_config.py (+28/-24)
To merge this branch: bzr merge lp:~vila/bzr/1235099-prereq
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+189657@code.launchpad.net

Description of the change

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

Auto-approving to make lp happy.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrlib/tests/test_config.py'
--- bzrlib/tests/test_config.py 2012-08-01 14:05:11 +0000
+++ bzrlib/tests/test_config.py 2013-10-07 16:22:17 +0000
@@ -16,7 +16,6 @@
1616
17"""Tests for finding and reading the bzr config file[s]."""17"""Tests for finding and reading the bzr config file[s]."""
1818
19import base64
20from cStringIO import StringIO19from cStringIO import StringIO
21from textwrap import dedent20from textwrap import dedent
22import os21import os
@@ -629,7 +628,7 @@
629class TestIniConfigBuilding(TestIniConfig):628class TestIniConfigBuilding(TestIniConfig):
630629
631 def test_contructs(self):630 def test_contructs(self):
632 my_config = config.IniBasedConfig()631 config.IniBasedConfig()
633632
634 def test_from_fp(self):633 def test_from_fp(self):
635 my_config = config.IniBasedConfig.from_string(sample_config_text)634 my_config = config.IniBasedConfig.from_string(sample_config_text)
@@ -678,8 +677,8 @@
678677
679 def test_saved_with_content(self):678 def test_saved_with_content(self):
680 content = 'foo = bar\n'679 content = 'foo = bar\n'
681 conf = config.IniBasedConfig.from_string(680 config.IniBasedConfig.from_string(content, file_name='./test.conf',
682 content, file_name='./test.conf', save=True)681 save=True)
683 self.assertFileEqual(content, 'test.conf')682 self.assertFileEqual(content, 'test.conf')
684683
685684
@@ -1047,7 +1046,7 @@
1047class TestGetConfig(tests.TestCase):1046class TestGetConfig(tests.TestCase):
10481047
1049 def test_constructs(self):1048 def test_constructs(self):
1050 my_config = config.GlobalConfig()1049 config.GlobalConfig()
10511050
1052 def test_calls_read_filenames(self):1051 def test_calls_read_filenames(self):
1053 # replace the class that is constructed, to check its parameters1052 # replace the class that is constructed, to check its parameters
@@ -1065,9 +1064,12 @@
10651064
1066class TestBranchConfig(tests.TestCaseWithTransport):1065class TestBranchConfig(tests.TestCaseWithTransport):
10671066
1068 def test_constructs(self):1067 def test_constructs_valid(self):
1069 branch = FakeBranch()1068 branch = FakeBranch()
1070 my_config = config.BranchConfig(branch)1069 my_config = config.BranchConfig(branch)
1070 self.assertIsNot(None, my_config)
1071
1072 def test_constructs_error(self):
1071 self.assertRaises(TypeError, config.BranchConfig)1073 self.assertRaises(TypeError, config.BranchConfig)
10721074
1073 def test_get_location_config(self):1075 def test_get_location_config(self):
@@ -1105,6 +1107,7 @@
1105 conf = config.LocationConfig.from_string(1107 conf = config.LocationConfig.from_string(
1106 '[%s]\nnickname = foobar' % (local_url,),1108 '[%s]\nnickname = foobar' % (local_url,),
1107 local_url, save=True)1109 local_url, save=True)
1110 self.assertIsNot(None, conf)
1108 self.assertEqual('foobar', branch.nick)1111 self.assertEqual('foobar', branch.nick)
11091112
1110 def test_config_local_path(self):1113 def test_config_local_path(self):
@@ -1113,9 +1116,10 @@
1113 self.assertEqual('branch', branch.nick)1116 self.assertEqual('branch', branch.nick)
11141117
1115 local_path = osutils.getcwd().encode('utf8')1118 local_path = osutils.getcwd().encode('utf8')
1116 conf = config.LocationConfig.from_string(1119 config.LocationConfig.from_string(
1117 '[%s/branch]\nnickname = barry' % (local_path,),1120 '[%s/branch]\nnickname = barry' % (local_path,),
1118 'branch', save=True)1121 'branch', save=True)
1122 # Now the branch will find its nick via the location config
1119 self.assertEqual('barry', branch.nick)1123 self.assertEqual('barry', branch.nick)
11201124
1121 def test_config_creates_local(self):1125 def test_config_creates_local(self):
@@ -1369,8 +1373,10 @@
13691373
1370class TestLocationConfig(tests.TestCaseInTempDir, TestOptionsMixin):1374class TestLocationConfig(tests.TestCaseInTempDir, TestOptionsMixin):
13711375
1372 def test_constructs(self):1376 def test_constructs_valid(self):
1373 my_config = config.LocationConfig('http://example.com')1377 config.LocationConfig('http://example.com')
1378
1379 def test_constructs_error(self):
1374 self.assertRaises(TypeError, config.LocationConfig)1380 self.assertRaises(TypeError, config.LocationConfig)
13751381
1376 def test_branch_calls_read_filenames(self):1382 def test_branch_calls_read_filenames(self):
@@ -1662,10 +1668,9 @@
1662 if location_config is None:1668 if location_config is None:
1663 location_config = sample_branches_text1669 location_config = sample_branches_text
16641670
1665 my_global_config = config.GlobalConfig.from_string(global_config,1671 config.GlobalConfig.from_string(global_config, save=True)
1666 save=True)1672 config.LocationConfig.from_string(location_config, my_branch.base,
1667 my_location_config = config.LocationConfig.from_string(1673 save=True)
1668 location_config, my_branch.base, save=True)
1669 my_config = config.BranchConfig(my_branch)1674 my_config = config.BranchConfig(my_branch)
1670 self.my_config = my_config1675 self.my_config = my_config
1671 self.my_location_config = my_config._get_location_config()1676 self.my_location_config = my_config._get_location_config()
@@ -1736,11 +1741,10 @@
1736 location_config=None, branch_data_config=None):1741 location_config=None, branch_data_config=None):
1737 my_branch = FakeBranch(location)1742 my_branch = FakeBranch(location)
1738 if global_config is not None:1743 if global_config is not None:
1739 my_global_config = config.GlobalConfig.from_string(global_config,1744 config.GlobalConfig.from_string(global_config, save=True)
1740 save=True)
1741 if location_config is not None:1745 if location_config is not None:
1742 my_location_config = config.LocationConfig.from_string(1746 config.LocationConfig.from_string(location_config, my_branch.base,
1743 location_config, my_branch.base, save=True)1747 save=True)
1744 my_config = config.BranchConfig(my_branch)1748 my_config = config.BranchConfig(my_branch)
1745 if branch_data_config is not None:1749 if branch_data_config is not None:
1746 my_config.branch.control_files.files['branch.conf'] = \1750 my_config.branch.control_files.files['branch.conf'] = \
@@ -3320,7 +3324,7 @@
33203324
3321 def test_build_doesnt_load_store(self):3325 def test_build_doesnt_load_store(self):
3322 store = self.get_store(self)3326 store = self.get_store(self)
3323 matcher = self.matcher(store, '/bar')3327 self.matcher(store, '/bar')
3324 self.assertFalse(store.is_loaded())3328 self.assertFalse(store.is_loaded())
33253329
33263330
@@ -3461,16 +3465,16 @@
34613465
3462 def test_url_vs_local_paths(self):3466 def test_url_vs_local_paths(self):
3463 # The matcher location is an url and the section names are local paths3467 # The matcher location is an url and the section names are local paths
3464 sections = self.assertSectionIDs(['/foo/bar', '/foo'],3468 self.assertSectionIDs(['/foo/bar', '/foo'],
3465 'file:///foo/bar/baz', '''\3469 'file:///foo/bar/baz', '''\
3466[/foo]3470[/foo]
3467[/foo/bar]3471[/foo/bar]
3468''')3472''')
34693473
3470 def test_local_path_vs_url(self):3474 def test_local_path_vs_url(self):
3471 # The matcher location is a local path and the section names are urls3475 # The matcher location is a local path and the section names are urls
3472 sections = self.assertSectionIDs(['file:///foo/bar', 'file:///foo'],3476 self.assertSectionIDs(['file:///foo/bar', 'file:///foo'],
3473 '/foo/bar/baz', '''\3477 '/foo/bar/baz', '''\
3474[file:///foo]3478[file:///foo]
3475[file:///foo/bar]3479[file:///foo/bar]
3476''')3480''')
@@ -3693,7 +3697,7 @@
36933697
3694 def test_build_stack(self):3698 def test_build_stack(self):
3695 # Just a smoke test to help debug builders3699 # Just a smoke test to help debug builders
3696 stack = self.get_stack(self)3700 self.get_stack(self)
36973701
36983702
3699class TestStackGet(TestStackWithTransport):3703class TestStackGet(TestStackWithTransport):
@@ -4297,7 +4301,7 @@
4297 """4301 """
4298 sections = list(conf._get_sections(name))4302 sections = list(conf._get_sections(name))
4299 self.assertLength(len(expected), sections)4303 self.assertLength(len(expected), sections)
4300 self.assertEqual(expected, [name for name, _, _ in sections])4304 self.assertEqual(expected, [n for n, _, _ in sections])
43014305
4302 def test_bazaar_default_section(self):4306 def test_bazaar_default_section(self):
4303 self.assertSectionNames(['DEFAULT'], self.bazaar_config)4307 self.assertSectionNames(['DEFAULT'], self.bazaar_config)