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
1=== modified file 'bzrlib/tests/test_config.py'
2--- bzrlib/tests/test_config.py 2012-08-01 14:05:11 +0000
3+++ bzrlib/tests/test_config.py 2013-10-07 16:22:17 +0000
4@@ -16,7 +16,6 @@
5
6 """Tests for finding and reading the bzr config file[s]."""
7
8-import base64
9 from cStringIO import StringIO
10 from textwrap import dedent
11 import os
12@@ -629,7 +628,7 @@
13 class TestIniConfigBuilding(TestIniConfig):
14
15 def test_contructs(self):
16- my_config = config.IniBasedConfig()
17+ config.IniBasedConfig()
18
19 def test_from_fp(self):
20 my_config = config.IniBasedConfig.from_string(sample_config_text)
21@@ -678,8 +677,8 @@
22
23 def test_saved_with_content(self):
24 content = 'foo = bar\n'
25- conf = config.IniBasedConfig.from_string(
26- content, file_name='./test.conf', save=True)
27+ config.IniBasedConfig.from_string(content, file_name='./test.conf',
28+ save=True)
29 self.assertFileEqual(content, 'test.conf')
30
31
32@@ -1047,7 +1046,7 @@
33 class TestGetConfig(tests.TestCase):
34
35 def test_constructs(self):
36- my_config = config.GlobalConfig()
37+ config.GlobalConfig()
38
39 def test_calls_read_filenames(self):
40 # replace the class that is constructed, to check its parameters
41@@ -1065,9 +1064,12 @@
42
43 class TestBranchConfig(tests.TestCaseWithTransport):
44
45- def test_constructs(self):
46+ def test_constructs_valid(self):
47 branch = FakeBranch()
48 my_config = config.BranchConfig(branch)
49+ self.assertIsNot(None, my_config)
50+
51+ def test_constructs_error(self):
52 self.assertRaises(TypeError, config.BranchConfig)
53
54 def test_get_location_config(self):
55@@ -1105,6 +1107,7 @@
56 conf = config.LocationConfig.from_string(
57 '[%s]\nnickname = foobar' % (local_url,),
58 local_url, save=True)
59+ self.assertIsNot(None, conf)
60 self.assertEqual('foobar', branch.nick)
61
62 def test_config_local_path(self):
63@@ -1113,9 +1116,10 @@
64 self.assertEqual('branch', branch.nick)
65
66 local_path = osutils.getcwd().encode('utf8')
67- conf = config.LocationConfig.from_string(
68+ config.LocationConfig.from_string(
69 '[%s/branch]\nnickname = barry' % (local_path,),
70 'branch', save=True)
71+ # Now the branch will find its nick via the location config
72 self.assertEqual('barry', branch.nick)
73
74 def test_config_creates_local(self):
75@@ -1369,8 +1373,10 @@
76
77 class TestLocationConfig(tests.TestCaseInTempDir, TestOptionsMixin):
78
79- def test_constructs(self):
80- my_config = config.LocationConfig('http://example.com')
81+ def test_constructs_valid(self):
82+ config.LocationConfig('http://example.com')
83+
84+ def test_constructs_error(self):
85 self.assertRaises(TypeError, config.LocationConfig)
86
87 def test_branch_calls_read_filenames(self):
88@@ -1662,10 +1668,9 @@
89 if location_config is None:
90 location_config = sample_branches_text
91
92- my_global_config = config.GlobalConfig.from_string(global_config,
93- save=True)
94- my_location_config = config.LocationConfig.from_string(
95- location_config, my_branch.base, save=True)
96+ config.GlobalConfig.from_string(global_config, save=True)
97+ config.LocationConfig.from_string(location_config, my_branch.base,
98+ save=True)
99 my_config = config.BranchConfig(my_branch)
100 self.my_config = my_config
101 self.my_location_config = my_config._get_location_config()
102@@ -1736,11 +1741,10 @@
103 location_config=None, branch_data_config=None):
104 my_branch = FakeBranch(location)
105 if global_config is not None:
106- my_global_config = config.GlobalConfig.from_string(global_config,
107- save=True)
108+ config.GlobalConfig.from_string(global_config, save=True)
109 if location_config is not None:
110- my_location_config = config.LocationConfig.from_string(
111- location_config, my_branch.base, save=True)
112+ config.LocationConfig.from_string(location_config, my_branch.base,
113+ save=True)
114 my_config = config.BranchConfig(my_branch)
115 if branch_data_config is not None:
116 my_config.branch.control_files.files['branch.conf'] = \
117@@ -3320,7 +3324,7 @@
118
119 def test_build_doesnt_load_store(self):
120 store = self.get_store(self)
121- matcher = self.matcher(store, '/bar')
122+ self.matcher(store, '/bar')
123 self.assertFalse(store.is_loaded())
124
125
126@@ -3461,16 +3465,16 @@
127
128 def test_url_vs_local_paths(self):
129 # The matcher location is an url and the section names are local paths
130- sections = self.assertSectionIDs(['/foo/bar', '/foo'],
131- 'file:///foo/bar/baz', '''\
132+ self.assertSectionIDs(['/foo/bar', '/foo'],
133+ 'file:///foo/bar/baz', '''\
134 [/foo]
135 [/foo/bar]
136 ''')
137
138 def test_local_path_vs_url(self):
139 # The matcher location is a local path and the section names are urls
140- sections = self.assertSectionIDs(['file:///foo/bar', 'file:///foo'],
141- '/foo/bar/baz', '''\
142+ self.assertSectionIDs(['file:///foo/bar', 'file:///foo'],
143+ '/foo/bar/baz', '''\
144 [file:///foo]
145 [file:///foo/bar]
146 ''')
147@@ -3693,7 +3697,7 @@
148
149 def test_build_stack(self):
150 # Just a smoke test to help debug builders
151- stack = self.get_stack(self)
152+ self.get_stack(self)
153
154
155 class TestStackGet(TestStackWithTransport):
156@@ -4297,7 +4301,7 @@
157 """
158 sections = list(conf._get_sections(name))
159 self.assertLength(len(expected), sections)
160- self.assertEqual(expected, [name for name, _, _ in sections])
161+ self.assertEqual(expected, [n for n, _, _ in sections])
162
163 def test_bazaar_default_section(self):
164 self.assertSectionNames(['DEFAULT'], self.bazaar_config)