bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.54.76
by Vincent Ladeuil
Fix the broken test. |
1 |
# Copyright (C) 2007-2010 Canonical Ltd
|
|
0.54.61
by Jeff Licquia
Assign copyright to Canonical. |
2 |
#
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
3 |
# This program is free software; you can redistribute it and/or modify
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
|
0.54.61
by Jeff Licquia
Assign copyright to Canonical. |
6 |
# (at your option) any later version.
|
|
0.54.57
by Jeff Licquia
Check and fix more PEP 8 failures. |
7 |
#
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
8 |
# This program is distributed in the hope that it will be useful,
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
|
0.54.57
by Jeff Licquia
Check and fix more PEP 8 failures. |
12 |
#
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
13 |
# You should have received a copy of the GNU General Public License
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
||
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
17 |
"Test suite for the bzr bisect plugin."
|
18 |
||
|
6625.4.4
by Jelmer Vernooij
Drop meta file. |
19 |
from __future__ import absolute_import |
20 |
||
|
0.54.78
by Jelmer Vernooij
Merge several improvements from Gustaf: |
21 |
from cStringIO import StringIO |
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
22 |
import os |
|
0.60.1
by Gustaf Thorslund
Added test cases for running a test script: |
23 |
import stat |
|
0.54.78
by Jelmer Vernooij
Merge several improvements from Gustaf: |
24 |
import sys |
|
0.54.41
by Jeff Licquia
Add a merged subtree to the repo the tests create. |
25 |
import shutil |
|
0.54.78
by Jelmer Vernooij
Merge several improvements from Gustaf: |
26 |
|
|
6625.4.1
by Jelmer Vernooij
Merge bisect. |
27 |
import breezy |
28 |
from ...bzrdir import BzrDir |
|
29 |
from .. import bisect |
|
30 |
from . import cmds |
|
31 |
from ...tests import ( |
|
|
0.54.78
by Jelmer Vernooij
Merge several improvements from Gustaf: |
32 |
KnownFailure, |
|
0.62.1
by Jelmer Vernooij
Lazy load plugin. |
33 |
TestCaseWithTransport, |
|
0.54.78
by Jelmer Vernooij
Merge several improvements from Gustaf: |
34 |
TestSkipped, |
35 |
)
|
|
|
0.54.52
by Jeff Licquia
PEP 8 fixes. |
36 |
|
|
0.62.1
by Jelmer Vernooij
Lazy load plugin. |
37 |
class BisectTestCase(TestCaseWithTransport): |
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
38 |
"""Test harness specific to the bisect plugin.""" |
|
0.54.57
by Jeff Licquia
Check and fix more PEP 8 failures. |
39 |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
40 |
def assertRevno(self, rev): |
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
41 |
"""Make sure we're at the right revision.""" |
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
42 |
|
|
0.54.52
by Jeff Licquia
PEP 8 fixes. |
43 |
rev_contents = {1: "one", 1.1: "one dot one", 1.2: "one dot two", |
44 |
1.3: "one dot three", 2: "two", 3: "three", |
|
45 |
4: "four", 5: "five"} |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
46 |
|
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
47 |
test_file = open("test_file") |
48 |
content = test_file.read().strip() |
|
|
0.54.50
by Jeff Licquia
Better diagnostics when an assertRevno() call fails. |
49 |
if content != rev_contents[rev]: |
50 |
rev_ids = dict((rev_contents[k], k) for k in rev_contents.keys()) |
|
51 |
found_rev = rev_ids[content] |
|
52 |
raise AssertionError("expected rev %0.1f, found rev %0.1f" |
|
53 |
% (rev, found_rev)) |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
54 |
|
55 |
def setUp(self): |
|
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
56 |
"""Set up tests.""" |
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
57 |
|
|
0.54.41
by Jeff Licquia
Add a merged subtree to the repo the tests create. |
58 |
# These tests assume a branch with five revisions, and
|
59 |
# a branch from version 1 containing three revisions
|
|
60 |
# merged at version 2.
|
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
61 |
|
|
0.62.1
by Jelmer Vernooij
Lazy load plugin. |
62 |
TestCaseWithTransport.setUp(self) |
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
63 |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
64 |
self.tree = self.make_branch_and_tree(".") |
65 |
||
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
66 |
test_file = open("test_file", "w") |
67 |
test_file.write("one") |
|
68 |
test_file.close() |
|
|
0.54.52
by Jeff Licquia
PEP 8 fixes. |
69 |
self.tree.add(self.tree.relpath(os.path.join(os.getcwd(), |
70 |
'test_file'))) |
|
|
0.60.1
by Gustaf Thorslund
Added test cases for running a test script: |
71 |
test_file_append = open("test_file_append", "a") |
72 |
test_file_append.write("one\n") |
|
73 |
test_file_append.close() |
|
74 |
self.tree.add(self.tree.relpath(os.path.join(os.getcwd(), |
|
75 |
'test_file_append'))) |
|
76 |
self.tree.commit(message = "add test files") |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
77 |
|
|
0.62.1
by Jelmer Vernooij
Lazy load plugin. |
78 |
BzrDir.open(".").sprout("../temp-clone") |
79 |
clone_bzrdir = BzrDir.open("../temp-clone") |
|
|
0.54.41
by Jeff Licquia
Add a merged subtree to the repo the tests create. |
80 |
clone_tree = clone_bzrdir.open_workingtree() |
81 |
for content in ["one dot one", "one dot two", "one dot three"]: |
|
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
82 |
test_file = open("../temp-clone/test_file", "w") |
83 |
test_file.write(content) |
|
84 |
test_file.close() |
|
|
0.60.1
by Gustaf Thorslund
Added test cases for running a test script: |
85 |
test_file_append = open("../temp-clone/test_file_append", "a") |
86 |
test_file_append.write(content + "\n") |
|
87 |
test_file_append.close() |
|
|
0.54.41
by Jeff Licquia
Add a merged subtree to the repo the tests create. |
88 |
clone_tree.commit(message = "make branch test change") |
|
0.54.49
by Jeff Licquia
Add subtree and harness tests. |
89 |
saved_subtree_revid = clone_tree.branch.last_revision() |
|
0.54.41
by Jeff Licquia
Add a merged subtree to the repo the tests create. |
90 |
|
91 |
self.tree.merge_from_branch(clone_tree.branch) |
|
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
92 |
test_file = open("test_file", "w") |
93 |
test_file.write("two") |
|
94 |
test_file.close() |
|
|
0.60.1
by Gustaf Thorslund
Added test cases for running a test script: |
95 |
test_file_append = open("test_file_append", "a") |
96 |
test_file_append.write("two\n") |
|
97 |
test_file_append.close() |
|
|
0.54.41
by Jeff Licquia
Add a merged subtree to the repo the tests create. |
98 |
self.tree.commit(message = "merge external branch") |
99 |
shutil.rmtree("../temp-clone") |
|
100 |
||
|
0.54.49
by Jeff Licquia
Add subtree and harness tests. |
101 |
self.subtree_rev = saved_subtree_revid |
102 |
||
|
0.54.41
by Jeff Licquia
Add a merged subtree to the repo the tests create. |
103 |
file_contents = ["three", "four", "five"] |
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
104 |
for content in file_contents: |
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
105 |
test_file = open("test_file", "w") |
106 |
test_file.write(content) |
|
107 |
test_file.close() |
|
|
0.60.1
by Gustaf Thorslund
Added test cases for running a test script: |
108 |
test_file_append = open("test_file_append", "a") |
109 |
test_file_append.write(content + "\n") |
|
110 |
test_file_append.close() |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
111 |
self.tree.commit(message = "make test change") |
112 |
||
|
0.54.52
by Jeff Licquia
PEP 8 fixes. |
113 |
|
|
0.54.49
by Jeff Licquia
Add subtree and harness tests. |
114 |
class BisectHarnessTests(BisectTestCase): |
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
115 |
"""Tests for the harness itself.""" |
|
0.54.57
by Jeff Licquia
Check and fix more PEP 8 failures. |
116 |
|
|
0.54.49
by Jeff Licquia
Add subtree and harness tests. |
117 |
def testLastRev(self): |
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
118 |
"""Test that the last revision is correct.""" |
|
0.54.52
by Jeff Licquia
PEP 8 fixes. |
119 |
repo = self.tree.branch.repository |
120 |
top_revtree = repo.revision_tree(self.tree.last_revision()) |
|
|
0.54.49
by Jeff Licquia
Add subtree and harness tests. |
121 |
top_revtree.lock_read() |
122 |
top_file = top_revtree.get_file(top_revtree.path2id("test_file")) |
|
123 |
test_content = top_file.read().strip() |
|
124 |
top_file.close() |
|
125 |
top_revtree.unlock() |
|
126 |
assert test_content == "five" |
|
127 |
||
128 |
def testSubtreeRev(self): |
|
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
129 |
"""Test that the last revision in a subtree is correct.""" |
|
0.54.52
by Jeff Licquia
PEP 8 fixes. |
130 |
repo = self.tree.branch.repository |
131 |
sub_revtree = repo.revision_tree(self.subtree_rev) |
|
|
0.54.49
by Jeff Licquia
Add subtree and harness tests. |
132 |
sub_revtree.lock_read() |
133 |
sub_file = sub_revtree.get_file(sub_revtree.path2id("test_file")) |
|
134 |
test_content = sub_file.read().strip() |
|
135 |
sub_file.close() |
|
136 |
sub_revtree.unlock() |
|
137 |
assert test_content == "one dot three" |
|
138 |
||
|
0.54.52
by Jeff Licquia
PEP 8 fixes. |
139 |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
140 |
class BisectCurrentUnitTests(BisectTestCase): |
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
141 |
"""Test the BisectCurrent class.""" |
|
0.54.57
by Jeff Licquia
Check and fix more PEP 8 failures. |
142 |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
143 |
def testShowLog(self): |
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
144 |
"""Test that the log can be shown.""" |
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
145 |
# Not a very good test; just makes sure the code doesn't fail,
|
146 |
# not that the output makes any sense.
|
|
|
0.54.72
by James Westby
Start to remove the use of sys.stdout. |
147 |
sio = StringIO() |
|
0.62.1
by Jelmer Vernooij
Lazy load plugin. |
148 |
cmds.BisectCurrent().show_rev_log(out=sio) |
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
149 |
|
|
0.54.49
by Jeff Licquia
Add subtree and harness tests. |
150 |
def testShowLogSubtree(self): |
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
151 |
"""Test that a subtree's log can be shown.""" |
|
0.62.1
by Jelmer Vernooij
Lazy load plugin. |
152 |
current = cmds.BisectCurrent() |
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
153 |
current.switch(self.subtree_rev) |
|
0.54.72
by James Westby
Start to remove the use of sys.stdout. |
154 |
sio = StringIO() |
155 |
current.show_rev_log(out=sio) |
|
|
0.54.49
by Jeff Licquia
Add subtree and harness tests. |
156 |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
157 |
def testSwitchVersions(self): |
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
158 |
"""Test switching versions.""" |
|
0.62.1
by Jelmer Vernooij
Lazy load plugin. |
159 |
current = cmds.BisectCurrent() |
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
160 |
self.assertRevno(5) |
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
161 |
current.switch(4) |
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
162 |
self.assertRevno(4) |
163 |
||
164 |
def testReset(self): |
|
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
165 |
"""Test resetting the working tree to a non-bisected state.""" |
|
0.62.1
by Jelmer Vernooij
Lazy load plugin. |
166 |
current = cmds.BisectCurrent() |
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
167 |
current.switch(4) |
168 |
current.reset() |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
169 |
self.assertRevno(5) |
|
0.62.1
by Jelmer Vernooij
Lazy load plugin. |
170 |
assert not os.path.exists(cmds.bisect_rev_path) |
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
171 |
|
|
0.54.43
by Jeff Licquia
Add non-functioning is_merge_point() method to BisectCurrent. |
172 |
def testIsMergePoint(self): |
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
173 |
"""Test merge point detection.""" |
|
0.62.1
by Jelmer Vernooij
Lazy load plugin. |
174 |
current = cmds.BisectCurrent() |
|
0.54.43
by Jeff Licquia
Add non-functioning is_merge_point() method to BisectCurrent. |
175 |
self.assertRevno(5) |
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
176 |
assert not current.is_merge_point() |
177 |
current.switch(2) |
|
178 |
assert current.is_merge_point() |
|
|
0.54.43
by Jeff Licquia
Add non-functioning is_merge_point() method to BisectCurrent. |
179 |
|
|
0.54.52
by Jeff Licquia
PEP 8 fixes. |
180 |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
181 |
class BisectLogUnitTests(BisectTestCase): |
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
182 |
"""Test the BisectLog class.""" |
|
0.54.57
by Jeff Licquia
Check and fix more PEP 8 failures. |
183 |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
184 |
def testCreateBlank(self): |
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
185 |
"""Test creation of new log.""" |
|
0.62.1
by Jelmer Vernooij
Lazy load plugin. |
186 |
bisect_log = cmds.BisectLog() |
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
187 |
bisect_log.save() |
|
0.62.1
by Jelmer Vernooij
Lazy load plugin. |
188 |
assert os.path.exists(cmds.bisect_info_path) |
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
189 |
|
190 |
def testLoad(self): |
|
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
191 |
"""Test loading a log.""" |
|
0.62.1
by Jelmer Vernooij
Lazy load plugin. |
192 |
preloaded_log = open(cmds.bisect_info_path, "w") |
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
193 |
preloaded_log.write("rev1 yes\nrev2 no\nrev3 yes\n") |
194 |
preloaded_log.close() |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
195 |
|
|
0.62.1
by Jelmer Vernooij
Lazy load plugin. |
196 |
bisect_log = cmds.BisectLog() |
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
197 |
assert len(bisect_log._items) == 3 |
198 |
assert bisect_log._items[0] == ("rev1", "yes") |
|
199 |
assert bisect_log._items[1] == ("rev2", "no") |
|
200 |
assert bisect_log._items[2] == ("rev3", "yes") |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
201 |
|
202 |
def testSave(self): |
|
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
203 |
"""Test saving the log.""" |
|
0.62.1
by Jelmer Vernooij
Lazy load plugin. |
204 |
bisect_log = cmds.BisectLog() |
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
205 |
bisect_log._items = [("rev1", "yes"), ("rev2", "no"), ("rev3", "yes")] |
206 |
bisect_log.save() |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
207 |
|
|
0.62.1
by Jelmer Vernooij
Lazy load plugin. |
208 |
logfile = open(cmds.bisect_info_path) |
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
209 |
assert logfile.read() == "rev1 yes\nrev2 no\nrev3 yes\n" |
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
210 |
|
|
0.54.52
by Jeff Licquia
PEP 8 fixes. |
211 |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
212 |
class BisectFuncTests(BisectTestCase): |
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
213 |
"""Functional tests for the bisect plugin.""" |
|
0.54.57
by Jeff Licquia
Check and fix more PEP 8 failures. |
214 |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
215 |
def testWorkflow(self): |
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
216 |
"""Run through a basic usage scenario.""" |
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
217 |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
218 |
# Start up the bisection. When the two ends are set, we should
|
219 |
# end up in the middle.
|
|
220 |
||
221 |
self.run_bzr(['bisect', 'start']) |
|
222 |
self.run_bzr(['bisect', 'yes']) |
|
223 |
self.run_bzr(['bisect', 'no', '-r', '1']) |
|
224 |
self.assertRevno(3) |
|
225 |
||
226 |
# Mark feature as present in the middle. Should move us
|
|
227 |
# halfway back between the current middle and the start.
|
|
228 |
||
229 |
self.run_bzr(['bisect', 'yes']) |
|
230 |
self.assertRevno(2) |
|
231 |
||
232 |
# Mark feature as not present. Since this is only one
|
|
233 |
# rev back from the lowest marked revision with the feature,
|
|
234 |
# the process should end, with the current rev set to the
|
|
235 |
# rev following.
|
|
236 |
||
237 |
self.run_bzr(['bisect', 'no']) |
|
238 |
self.assertRevno(3) |
|
239 |
||
|
0.59.7
by Jeff Licquia
Tests for detecting "done" status, plus a first run at implementation. |
240 |
# Run again. Since we're done, this should do nothing.
|
241 |
||
242 |
self.run_bzr(['bisect', 'no']) |
|
243 |
self.assertRevno(3) |
|
244 |
||
|
0.54.42
by Jeff Licquia
Add functional test for subtree functionality (not passing). |
245 |
def testWorkflowSubtree(self): |
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
246 |
"""Run through a usage scenario where the offending change |
247 |
is in a subtree."""
|
|
248 |
||
|
0.54.42
by Jeff Licquia
Add functional test for subtree functionality (not passing). |
249 |
# Similar to testWorkflow, but make sure the plugin traverses
|
250 |
# subtrees when the "final" revision is a merge point.
|
|
251 |
||
252 |
# This part is similar to testWorkflow.
|
|
253 |
||
254 |
self.run_bzr(['bisect', 'start']) |
|
255 |
self.run_bzr(['bisect', 'yes']) |
|
256 |
self.run_bzr(['bisect', 'no', '-r', '1']) |
|
257 |
self.run_bzr(['bisect', 'yes']) |
|
258 |
||
259 |
# Check to make sure we're where we expect to be.
|
|
260 |
||
261 |
self.assertRevno(2) |
|
262 |
||
263 |
# Now, mark the merge point revno, meaning the feature
|
|
264 |
# appeared at a merge point.
|
|
265 |
||
266 |
self.run_bzr(['bisect', 'yes']) |
|
267 |
self.assertRevno(1.2) |
|
268 |
||
269 |
# Continue bisecting along the subtree to the real conclusion.
|
|
270 |
||
271 |
self.run_bzr(['bisect', 'yes']) |
|
272 |
self.assertRevno(1.1) |
|
273 |
self.run_bzr(['bisect', 'yes']) |
|
274 |
self.assertRevno(1.1) |
|
275 |
||
|
0.59.7
by Jeff Licquia
Tests for detecting "done" status, plus a first run at implementation. |
276 |
# Run again. Since we're done, this should do nothing.
|
277 |
||
278 |
self.run_bzr(['bisect', 'yes']) |
|
279 |
self.assertRevno(1.1) |
|
280 |
||
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
281 |
def testMove(self): |
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
282 |
"""Test manually moving to a different revision during the bisection.""" |
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
283 |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
284 |
# Set up a bisection in progress.
|
285 |
||
286 |
self.run_bzr(['bisect', 'start']) |
|
287 |
self.run_bzr(['bisect', 'yes']) |
|
288 |
self.run_bzr(['bisect', 'no', '-r', '1']) |
|
289 |
||
290 |
# Move.
|
|
291 |
||
292 |
self.run_bzr(['bisect', 'move', '-r', '2']) |
|
293 |
self.assertRevno(2) |
|
294 |
||
295 |
def testReset(self): |
|
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
296 |
"""Test resetting the tree.""" |
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
297 |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
298 |
# Set up a bisection in progress.
|
299 |
||
300 |
self.run_bzr(['bisect', 'start']) |
|
301 |
self.run_bzr(['bisect', 'yes']) |
|
302 |
self.run_bzr(['bisect', 'no', '-r', '1']) |
|
303 |
self.run_bzr(['bisect', 'yes']) |
|
304 |
||
305 |
# Now reset.
|
|
306 |
||
307 |
self.run_bzr(['bisect', 'reset']) |
|
308 |
self.assertRevno(5) |
|
309 |
||
|
0.59.4
by Jeff Licquia
Make reset a no-op if no bisection is in progress. |
310 |
# Check that reset doesn't do anything unless there's a
|
311 |
# bisection in progress.
|
|
312 |
||
313 |
test_file = open("test_file", "w") |
|
314 |
test_file.write("keep me") |
|
315 |
test_file.close() |
|
316 |
||
|
0.54.73
by James Westby
Some cleanups. |
317 |
out, err = self.run_bzr(['bisect', 'reset'], retcode=3) |
|
6631.1.1
by Martin
Fix test failures and issues with run with python -Werror |
318 |
self.assertIn("No bisection in progress.", err) |
|
0.59.4
by Jeff Licquia
Make reset a no-op if no bisection is in progress. |
319 |
|
320 |
test_file = open("test_file") |
|
321 |
content = test_file.read().strip() |
|
322 |
test_file.close() |
|
|
6631.1.1
by Martin
Fix test failures and issues with run with python -Werror |
323 |
self.assertEqual(content, "keep me") |
|
0.59.4
by Jeff Licquia
Make reset a no-op if no bisection is in progress. |
324 |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
325 |
def testLog(self): |
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
326 |
"""Test saving the current bisection state, and re-loading it.""" |
|
0.54.56
by Jeff Licquia
Fix some pylint complaints. |
327 |
|
|
0.54.40
by Jeff Licquia
Move the tests to their own module. |
328 |
# Set up a bisection in progress.
|
329 |
||
330 |
self.run_bzr(['bisect', 'start']) |
|
331 |
self.run_bzr(['bisect', 'yes']) |
|
332 |
self.run_bzr(['bisect', 'no', '-r', '1']) |
|
333 |
self.run_bzr(['bisect', 'yes']) |
|
334 |
||
335 |
# Now save the log.
|
|
336 |
||
337 |
self.run_bzr(['bisect', 'log', '-o', 'bisect_log']) |
|
338 |
||
339 |
# Reset.
|
|
340 |
||
341 |
self.run_bzr(['bisect', 'reset']) |
|
342 |
||
343 |
# Read it back in.
|
|
344 |
||
345 |
self.run_bzr(['bisect', 'replay', 'bisect_log']) |
|
346 |
self.assertRevno(2) |
|
347 |
||
348 |
# Mark another state, and see if the bisect moves in the
|
|
349 |
# right way.
|
|
350 |
||
351 |
self.run_bzr(['bisect', 'no']) |
|
352 |
self.assertRevno(3) |
|
|
0.60.1
by Gustaf Thorslund
Added test cases for running a test script: |
353 |
|
354 |
def testRunScript(self): |
|
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
355 |
"""Make a test script and run it.""" |
|
0.60.1
by Gustaf Thorslund
Added test cases for running a test script: |
356 |
test_script = open("test_script", "w") |
357 |
test_script.write("#!/bin/sh\n" |
|
358 |
"grep -q '^four' test_file_append\n") |
|
359 |
test_script.close() |
|
360 |
os.chmod("test_script", stat.S_IRWXU) |
|
361 |
self.run_bzr(['bisect', 'start']) |
|
362 |
self.run_bzr(['bisect', 'yes']) |
|
363 |
self.run_bzr(['bisect', 'no', '-r', '1']) |
|
364 |
self.run_bzr(['bisect', 'run', './test_script']) |
|
365 |
self.assertRevno(4) |
|
366 |
||
367 |
def testRunScriptMergePoint(self): |
|
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
368 |
"""Make a test script and run it.""" |
|
0.54.78
by Jelmer Vernooij
Merge several improvements from Gustaf: |
369 |
if sys.platform == "win32": |
370 |
raise TestSkipped("Unable to run shell script on windows") |
|
|
0.60.1
by Gustaf Thorslund
Added test cases for running a test script: |
371 |
test_script = open("test_script", "w") |
372 |
test_script.write("#!/bin/sh\n" |
|
373 |
"grep -q '^two' test_file_append\n") |
|
374 |
test_script.close() |
|
375 |
os.chmod("test_script", stat.S_IRWXU) |
|
376 |
self.run_bzr(['bisect', 'start']) |
|
377 |
self.run_bzr(['bisect', 'yes']) |
|
378 |
self.run_bzr(['bisect', 'no', '-r', '1']) |
|
379 |
self.run_bzr(['bisect', 'run', './test_script']) |
|
|
0.60.3
by Gustaf Thorslund
Marked two tests as KnownFailure due to: |
380 |
try: |
381 |
self.assertRevno(2) |
|
382 |
except AssertionError: |
|
383 |
raise KnownFailure\ |
|
384 |
("bisect does not drill down into merge commits: " |
|
385 |
"https://bugs.launchpad.net/bzr-bisect/+bug/539937") |
|
386 |
||
|
0.60.1
by Gustaf Thorslund
Added test cases for running a test script: |
387 |
def testRunScriptSubtree(self): |
|
0.60.4
by Gustaf Thorslund
Fixed " -> """ for docstrings. Added some docstrings. Also converted some #-comment into a docstring. |
388 |
"""Make a test script and run it.""" |
|
0.54.78
by Jelmer Vernooij
Merge several improvements from Gustaf: |
389 |
if sys.platform == "win32": |
390 |
raise TestSkipped("Unable to run shell script on windows") |
|
|
0.60.1
by Gustaf Thorslund
Added test cases for running a test script: |
391 |
test_script = open("test_script", "w") |
392 |
test_script.write("#!/bin/sh\n" |
|
393 |
"grep -q '^one dot two' test_file_append\n") |
|
394 |
test_script.close() |
|
395 |
os.chmod("test_script", stat.S_IRWXU) |
|
396 |
self.run_bzr(['bisect', 'start']) |
|
397 |
self.run_bzr(['bisect', 'yes']) |
|
398 |
self.run_bzr(['bisect', 'no', '-r', '1']) |
|
399 |
self.run_bzr(['bisect', 'run', './test_script']) |
|
|
0.60.3
by Gustaf Thorslund
Marked two tests as KnownFailure due to: |
400 |
try: |
401 |
self.assertRevno(1.2) |
|
402 |
except AssertionError: |
|
403 |
raise KnownFailure\ |
|
404 |
("bisect does not drill down into merge commits: " |
|
405 |
"https://bugs.launchpad.net/bzr-bisect/+bug/539937") |