1
# Copyright (C) 2005 Canonical Ltd
1
# Copyright (C) 2005 by Canonical Ltd
2
2
# -*- coding: utf-8 -*-
4
4
# This program is free software; you can redistribute it and/or modify
5
5
# it under the terms of the GNU General Public License as published by
6
6
# the Free Software Foundation; either version 2 of the License, or
7
7
# (at your option) any later version.
9
9
# This program is distributed in the hope that it will be useful,
10
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
12
# GNU General Public License for more details.
14
14
# You should have received a copy of the GNU General Public License
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
# Mr. Smoketoomuch: I'm sorry?
19
# Mr. Bounder: You'd better cut down a little then.
20
# Mr. Smoketoomuch: Oh, I see! Smoke too much so I'd better cut down a little
23
19
"""Black-box tests for bzr.
25
21
These check that it behaves properly when it's invoked through the regular
26
command-line interface. This doesn't actually run a new interpreter but
27
rather starts again from the run_bzr function.
22
command-line interface.
24
This always reinvokes bzr through a new Python interpreter, which is a
25
bit inefficient but arguably tests in a way more representative of how
26
it's normally invoked.
31
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
32
# Note: Please don't add new tests here, it's too big and bulky. Instead add
33
# them into small suites in bzrlib.tests.blackbox.test_FOO for the particular
34
# UI command/aspect that is being tested.
37
from cStringIO import StringIO
46
from bzrlib.branch import Branch
47
from bzrlib.errors import BzrCommandError
48
from bzrlib.osutils import (
53
from bzrlib.tests.HTTPTestUtil import TestCaseWithWebserver
54
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
55
from bzrlib.tests.blackbox import ExternalBase
56
from bzrlib.workingtree import WorkingTree
30
from bzrlib.selftest import TestCaseInTempDir, BzrTestBase
32
class ExternalBase(TestCaseInTempDir):
33
def runbzr(self, args, retcode=0,backtick=False):
34
if isinstance(args, basestring):
38
return self.backtick(['python', self.BZRPATH,] + args,
41
return self.runcmd(['python', self.BZRPATH,] + args,
59
45
class TestCommands(ExternalBase):
61
def test_nick_command(self):
62
"""bzr nick for viewing, setting nicknames"""
47
def test_help_commands(self):
50
self.runbzr('help commands')
51
self.runbzr('help help')
52
self.runbzr('commit -h')
54
def test_init_branch(self):
57
def test_whoami(self):
58
# this should always identify something, if only "john@localhost"
60
self.runbzr("whoami --email")
62
self.assertEquals(self.runbzr("whoami --email",
63
backtick=True).count('@'), 1)
65
def test_whoami_branch(self):
66
"""branch specific user identity works."""
65
67
self.runbzr('init')
66
nick = self.runbzr("nick",backtick=True)
67
self.assertEqual(nick, 'me.dev\n')
68
nick = self.runbzr("nick moo")
69
nick = self.runbzr("nick",backtick=True)
70
self.assertEqual(nick, 'moo\n')
68
f = file('.bzr/email', 'wt')
69
f.write('Branch Identity <branch@identi.ty>')
71
whoami = self.runbzr("whoami",backtick=True)
72
whoami_email = self.runbzr("whoami --email",backtick=True)
73
self.assertTrue(whoami.startswith('Branch Identity <branch@identi.ty>'))
74
self.assertTrue(whoami_email.startswith('branch@identi.ty'))
72
76
def test_invalid_commands(self):
73
self.runbzr("pants", retcode=3)
74
self.runbzr("--pants off", retcode=3)
75
self.runbzr("diff --message foo", retcode=3)
77
self.runbzr("pants", retcode=1)
78
self.runbzr("--pants off", retcode=1)
79
self.runbzr("diff --message foo", retcode=1)
81
def test_empty_commit(self):
83
self.build_tree(['hello.txt'])
84
self.runbzr("commit -m empty", retcode=1)
85
self.runbzr("add hello.txt")
86
self.runbzr("commit -m added")
88
def test_ignore_patterns(self):
89
from bzrlib.branch import Branch
91
b = Branch('.', init=True)
92
self.assertEquals(list(b.unknowns()), [])
94
file('foo.tmp', 'wt').write('tmp files are ignored')
95
self.assertEquals(list(b.unknowns()), [])
96
assert self.backtick('bzr unknowns') == ''
98
file('foo.c', 'wt').write('int main() {}')
99
self.assertEquals(list(b.unknowns()), ['foo.c'])
100
assert self.backtick('bzr unknowns') == 'foo.c\n'
102
self.runbzr(['add', 'foo.c'])
103
assert self.backtick('bzr unknowns') == ''
105
# 'ignore' works when creating the .bzignore file
106
file('foo.blah', 'wt').write('blah')
107
self.assertEquals(list(b.unknowns()), ['foo.blah'])
108
self.runbzr('ignore *.blah')
109
self.assertEquals(list(b.unknowns()), [])
110
assert file('.bzrignore', 'rb').read() == '*.blah\n'
112
# 'ignore' works when then .bzrignore file already exists
113
file('garh', 'wt').write('garh')
114
self.assertEquals(list(b.unknowns()), ['garh'])
115
assert self.backtick('bzr unknowns') == 'garh\n'
116
self.runbzr('ignore garh')
117
self.assertEquals(list(b.unknowns()), [])
118
assert file('.bzrignore', 'rb').read() == '*.blah\ngarh\n'
77
120
def test_revert(self):
78
122
self.runbzr('init')
80
124
file('hello', 'wt').write('foo')
148
178
test.runbzr('add goodbye')
149
179
test.runbzr('commit -m setup goodbye')
151
def test_pull_verbose(self):
152
"""Pull changes from one branch to another and watch the output."""
181
def test_revert(self):
182
self.example_branch()
183
file('hello', 'wt').write('bar')
184
file('goodbye', 'wt').write('qux')
185
self.runbzr('revert hello')
186
self.check_file_contents('hello', 'foo')
187
self.check_file_contents('goodbye', 'qux')
188
self.runbzr('revert')
189
self.check_file_contents('goodbye', 'baz')
191
def test_merge(self):
192
from bzrlib.branch import Branch
158
198
self.example_branch()
200
self.runbzr('branch a b')
163
open('b', 'wb').write('else\n')
165
bzr(['commit', '-m', 'added b'])
168
out = bzr('pull --verbose ../b', backtick=True)
169
self.failIfEqual(out.find('Added Revisions:'), -1)
170
self.failIfEqual(out.find('message:\n added b'), -1)
171
self.failIfEqual(out.find('added b'), -1)
173
# Check that --overwrite --verbose prints out the removed entries
174
bzr('commit -m foo --unchanged')
176
bzr('commit -m baz --unchanged')
177
bzr('pull ../a', retcode=3)
178
out = bzr('pull --overwrite --verbose ../a', backtick=1)
180
remove_loc = out.find('Removed Revisions:')
181
self.failIfEqual(remove_loc, -1)
182
added_loc = out.find('Added Revisions:')
183
self.failIfEqual(added_loc, -1)
185
removed_message = out.find('message:\n baz')
186
self.failIfEqual(removed_message, -1)
187
self.failUnless(remove_loc < removed_message < added_loc)
189
added_message = out.find('message:\n foo')
190
self.failIfEqual(added_message, -1)
191
self.failUnless(added_loc < added_message)
193
def test_locations(self):
194
"""Using and remembering different locations"""
198
self.runbzr('commit -m unchanged --unchanged')
199
self.runbzr('pull', retcode=3)
200
self.runbzr('merge', retcode=3)
201
self.runbzr('branch . ../b')
204
self.runbzr('branch . ../c')
205
self.runbzr('pull ../c')
208
self.runbzr('pull ../b')
210
self.runbzr('pull ../c')
211
self.runbzr('branch ../c ../d')
212
osutils.rmtree('../c')
217
self.runbzr('pull', retcode=3)
218
self.runbzr('pull ../a --remember')
221
def test_unknown_command(self):
222
"""Handling of unknown command."""
223
out, err = self.run_bzr_captured(['fluffy-badger'],
225
self.assertEquals(out, '')
226
err.index('unknown command')
228
def create_conflicts(self):
229
"""Create a conflicted tree"""
232
file('hello', 'wb').write("hi world")
233
file('answer', 'wb').write("42")
236
self.runbzr('commit -m base')
237
self.runbzr('branch . ../other')
238
self.runbzr('branch . ../this')
240
file('hello', 'wb').write("Hello.")
241
file('answer', 'wb').write("Is anyone there?")
242
self.runbzr('commit -m other')
244
file('hello', 'wb').write("Hello, world")
245
self.runbzr('mv answer question')
246
file('question', 'wb').write("What do you get when you multiply six"
248
self.runbzr('commit -m this')
250
def test_status(self):
254
self.runbzr('commit --unchanged --message f')
255
self.runbzr('branch . ../branch2')
256
self.runbzr('branch . ../branch3')
257
self.runbzr('commit --unchanged --message peter')
258
os.chdir('../branch2')
259
self.runbzr('merge ../branch1')
260
self.runbzr('commit --unchanged --message pumpkin')
261
os.chdir('../branch3')
262
self.runbzr('merge ../branch2')
263
message = self.capture('status')
266
def test_conflicts(self):
267
"""Handling of merge conflicts"""
268
self.create_conflicts()
269
self.runbzr('merge ../other --show-base', retcode=1)
270
conflict_text = file('hello').read()
271
self.assert_('<<<<<<<' in conflict_text)
272
self.assert_('>>>>>>>' in conflict_text)
273
self.assert_('=======' in conflict_text)
274
self.assert_('|||||||' in conflict_text)
275
self.assert_('hi world' in conflict_text)
276
self.runbzr('revert')
277
self.runbzr('resolve --all')
278
self.runbzr('merge ../other', retcode=1)
279
conflict_text = file('hello').read()
280
self.assert_('|||||||' not in conflict_text)
281
self.assert_('hi world' not in conflict_text)
282
result = self.runbzr('conflicts', backtick=1)
283
self.assertEquals(result, "Text conflict in hello\nText conflict in"
285
result = self.runbzr('status', backtick=1)
286
self.assert_("conflicts:\n Text conflict in hello\n"
287
" Text conflict in question\n" in result, result)
288
self.runbzr('resolve hello')
289
result = self.runbzr('conflicts', backtick=1)
290
self.assertEquals(result, "Text conflict in question\n")
291
self.runbzr('commit -m conflicts', retcode=3)
292
self.runbzr('resolve --all')
293
result = self.runbzr('conflicts', backtick=1)
294
self.runbzr('commit -m conflicts')
295
self.assertEquals(result, "")
298
# create a source branch
299
os.mkdir('my-branch')
300
os.chdir('my-branch')
301
self.example_branch()
303
# with no push target, fail
304
self.runbzr('push', retcode=3)
305
# with an explicit target work
306
self.runbzr('push ../output-branch')
307
# with an implicit target work
310
self.runbzr('missing ../output-branch')
311
# advance this branch
312
self.runbzr('commit --unchanged -m unchanged')
314
os.chdir('../output-branch')
315
# There is no longer a difference as long as we have
316
# access to the working tree
319
# But we should be missing a revision
320
self.runbzr('missing ../my-branch', retcode=1)
322
# diverge the branches
323
self.runbzr('commit --unchanged -m unchanged')
324
os.chdir('../my-branch')
326
self.runbzr('push', retcode=3)
327
# and there are difference
328
self.runbzr('missing ../output-branch', retcode=1)
329
self.runbzr('missing --verbose ../output-branch', retcode=1)
330
# but we can force a push
331
self.runbzr('push --overwrite')
333
self.runbzr('missing ../output-branch')
335
# pushing to a new dir with no parent should fail
336
self.runbzr('push ../missing/new-branch', retcode=3)
337
# unless we provide --create-prefix
338
self.runbzr('push --create-prefix ../missing/new-branch')
340
self.runbzr('missing ../missing/new-branch')
342
def test_external_command(self):
343
"""Test that external commands can be run by setting the path
345
# We don't at present run bzr in a subprocess for blackbox tests, and so
346
# don't really capture stdout, only the internal python stream.
347
# Therefore we don't use a subcommand that produces any output or does
348
# anything -- we just check that it can be run successfully.
349
cmd_name = 'test-command'
350
if sys.platform == 'win32':
352
oldpath = os.environ.get('BZRPATH', None)
355
if 'BZRPATH' in os.environ:
356
del os.environ['BZRPATH']
358
f = file(cmd_name, 'wb')
359
if sys.platform == 'win32':
360
f.write('@echo off\n')
362
f.write('#!/bin/sh\n')
363
# f.write('echo Hello from test-command')
365
os.chmod(cmd_name, 0755)
367
# It should not find the command in the local
368
# directory by default, since it is not in my path
369
bzr(cmd_name, retcode=3)
371
# Now put it into my path
372
os.environ['BZRPATH'] = '.'
376
# Make sure empty path elements are ignored
377
os.environ['BZRPATH'] = os.pathsep
379
bzr(cmd_name, retcode=3)
383
os.environ['BZRPATH'] = oldpath
386
def listdir_sorted(dir):
202
file('goodbye', 'wt').write('quux')
203
self.runbzr(['commit', '-m', "more u's are always good"])
206
file('hello', 'wt').write('quuux')
207
# We can't merge when there are in-tree changes
208
self.runbzr('merge ../b', retcode=1)
209
self.runbzr(['commit', '-m', "Like an epidemic of u's"])
210
self.runbzr('merge ../b')
211
self.check_file_contents('goodbye', 'quux')
212
# Merging a branch pulls its revision into the tree
215
a.get_revision_xml(b.last_patch())
217
self.log('pending merges: %s', a.pending_merges())
218
# assert a.pending_merges() == [b.last_patch()], "Assertion %s %s" \
219
# % (a.pending_merges(), b.last_patch())
392
221
class OldTests(ExternalBase):
393
222
"""old tests moved from ./testbzr."""
414
244
f.write('hello world!\n')
417
self.assertEquals(capture('unknowns'), 'test.txt\n')
419
out = capture("status")
420
self.assertEquals(out, 'unknown:\n test.txt\n')
247
out = backtick("bzr unknowns")
248
self.assertEquals(out, 'test.txt\n')
250
out = backtick("bzr status")
251
assert out == 'unknown:\n test.txt\n'
253
out = backtick("bzr status --all")
254
assert out == "unknown:\n test.txt\n"
256
out = backtick("bzr status test.txt --all")
257
assert out == "unknown:\n test.txt\n"
422
259
f = file('test2.txt', 'wt')
423
260
f.write('goodbye cruel world...\n')
426
out = capture("status test.txt")
427
self.assertEquals(out, "unknown:\n test.txt\n")
263
out = backtick("bzr status test.txt")
264
assert out == "unknown:\n test.txt\n"
429
out = capture("status")
430
self.assertEquals(out, ("unknown:\n" " test.txt\n" " test2.txt\n"))
266
out = backtick("bzr status")
267
assert out == ("unknown:\n"
432
271
os.unlink('test2.txt')
434
273
progress("command aliases")
436
self.assertEquals(out, ("unknown:\n" " test.txt\n"))
274
out = backtick("bzr st --all")
275
assert out == ("unknown:\n"
438
out = capture("stat")
439
self.assertEquals(out, ("unknown:\n" " test.txt\n"))
278
out = backtick("bzr stat")
279
assert out == ("unknown:\n"
441
282
progress("command help")
442
283
runbzr("help st")
444
285
runbzr("help commands")
445
runbzr("help slartibartfast", 3)
286
runbzr("help slartibartfast", 1)
447
out = capture("help ci")
288
out = backtick("bzr help ci")
448
289
out.index('aliases: ')
291
progress("can't rename unversioned file")
292
runbzr("rename test.txt new-test.txt", 1)
294
progress("adding a file")
296
runbzr("add test.txt")
297
assert backtick("bzr unknowns") == ''
298
assert backtick("bzr status --all") == ("added:\n"
301
progress("rename newly-added file")
302
runbzr("rename test.txt hello.txt")
303
assert os.path.exists("hello.txt")
304
assert not os.path.exists("test.txt")
306
assert backtick("bzr revno") == '0\n'
308
progress("add first revision")
309
runbzr(['commit', '-m', 'add first revision'])
311
progress("more complex renames")
313
runbzr("rename hello.txt sub1", 1)
314
runbzr("rename hello.txt sub1/hello.txt", 1)
315
runbzr("move hello.txt sub1", 1)
318
runbzr("rename sub1 sub2")
319
runbzr("move hello.txt sub2")
320
assert backtick("bzr relpath sub2/hello.txt") == os.path.join("sub2", "hello.txt\n")
322
assert exists("sub2")
323
assert exists("sub2/hello.txt")
324
assert not exists("sub1")
325
assert not exists("hello.txt")
327
runbzr(['commit', '-m', 'commit with some things moved to subdirs'])
331
runbzr('move sub2/hello.txt sub1')
332
assert not exists('sub2/hello.txt')
333
assert exists('sub1/hello.txt')
334
runbzr('move sub2 sub1')
335
assert not exists('sub2')
336
assert exists('sub1/sub2')
338
runbzr(['commit', '-m', 'rename nested subdirectories'])
341
self.assertEquals(backtick('bzr root')[:-1],
342
os.path.join(self.test_dir, 'branch1'))
343
runbzr('move ../hello.txt .')
344
assert exists('./hello.txt')
345
assert backtick('bzr relpath hello.txt') == os.path.join('sub1', 'sub2', 'hello.txt\n')
346
assert backtick('bzr relpath ../../sub1/sub2/hello.txt') == os.path.join('sub1', 'sub2', 'hello.txt\n')
347
runbzr(['commit', '-m', 'move to parent directory'])
349
assert backtick('bzr relpath sub2/hello.txt') == os.path.join('sub1', 'sub2', 'hello.txt\n')
351
runbzr('move sub2/hello.txt .')
352
assert exists('hello.txt')
450
354
f = file('hello.txt', 'wt')
451
355
f.write('some nice new content\n')
454
runbzr("add hello.txt")
456
358
f = file('msg.tmp', 'wt')
457
f.write('this is my new commit\nand it has multiple lines, for fun')
359
f.write('this is my new commit\n')
460
362
runbzr('commit -F msg.tmp')
462
self.assertEquals(capture('revno'), '1\n')
463
runbzr('export -r 1 export-1.tmp')
364
assert backtick('bzr revno') == '5\n'
365
runbzr('export -r 5 export-5.tmp')
464
366
runbzr('export export.tmp')
468
370
runbzr('log -v --forward')
469
runbzr('log -m', retcode=3)
470
log_out = capture('log -m commit')
471
self.assert_("this is my new commit\n and" in log_out)
472
self.assert_("rename nested" not in log_out)
473
self.assert_('revision-id' not in log_out)
474
self.assert_('revision-id' in capture('log --show-ids -m commit'))
371
runbzr('log -m', retcode=1)
372
log_out = backtick('bzr log -m commit')
373
assert "this is my new commit" in log_out
374
assert "rename nested" not in log_out
375
assert 'revision-id' not in log_out
376
assert 'revision-id' in backtick('bzr log --show-ids -m commit')
476
log_out = capture('log --line')
477
# determine the widest line we want
478
max_width = terminal_width() - 1
479
for line in log_out.splitlines():
480
self.assert_(len(line) <= max_width, len(line))
481
self.assert_("this is my new commit and" not in log_out)
482
self.assert_("this is my new commit" in log_out)
484
379
progress("file with spaces in name")
485
380
mkdir('sub directory')
486
381
file('sub directory/file with spaces ', 'wt').write('see how this works\n')
488
runbzr('diff', retcode=1)
489
384
runbzr('commit -m add-spaces')
502
os.symlink("NOWHERE1", "link1")
504
self.assertEquals(self.capture('unknowns'), '')
505
runbzr(['commit', '-m', '1: added symlink link1'])
509
self.assertEquals(self.capture('unknowns'), '')
510
os.symlink("NOWHERE2", "d1/link2")
511
self.assertEquals(self.capture('unknowns'), 'd1/link2\n')
512
# is d1/link2 found when adding d1
514
self.assertEquals(self.capture('unknowns'), '')
515
os.symlink("NOWHERE3", "d1/link3")
516
self.assertEquals(self.capture('unknowns'), 'd1/link3\n')
517
runbzr(['commit', '-m', '2: added dir, symlink'])
519
runbzr('rename d1 d2')
520
runbzr('move d2/link2 .')
521
runbzr('move link1 d2')
522
self.assertEquals(os.readlink("./link2"), "NOWHERE2")
523
self.assertEquals(os.readlink("d2/link1"), "NOWHERE1")
524
runbzr('add d2/link3')
525
runbzr('diff', retcode=1)
526
runbzr(['commit', '-m', '3: rename of dir, move symlinks, add link3'])
529
os.symlink("TARGET 2", "link2")
530
os.unlink("d2/link1")
531
os.symlink("TARGET 1", "d2/link1")
532
runbzr('diff', retcode=1)
533
self.assertEquals(self.capture("relpath d2/link1"), "d2/link1\n")
534
runbzr(['commit', '-m', '4: retarget of two links'])
536
runbzr('remove d2/link1')
537
self.assertEquals(self.capture('unknowns'), 'd2/link1\n')
538
runbzr(['commit', '-m', '5: remove d2/link1'])
539
# try with the rm alias
540
runbzr('add d2/link1')
541
runbzr(['commit', '-m', '6: add d2/link1'])
542
runbzr('rm d2/link1')
543
self.assertEquals(self.capture('unknowns'), 'd2/link1\n')
544
runbzr(['commit', '-m', '7: remove d2/link1'])
548
runbzr('rename d2/link3 d1/link3new')
549
self.assertEquals(self.capture('unknowns'), 'd2/link1\n')
550
runbzr(['commit', '-m', '8: remove d2/link1, move/rename link3'])
554
runbzr(['export', '-r', '1', 'exp1.tmp'])
556
self.assertEquals(listdir_sorted("."), [ "link1" ])
557
self.assertEquals(os.readlink("link1"), "NOWHERE1")
560
runbzr(['export', '-r', '2', 'exp2.tmp'])
562
self.assertEquals(listdir_sorted("."), [ "d1", "link1" ])
565
runbzr(['export', '-r', '3', 'exp3.tmp'])
567
self.assertEquals(listdir_sorted("."), [ "d2", "link2" ])
568
self.assertEquals(listdir_sorted("d2"), [ "link1", "link3" ])
569
self.assertEquals(os.readlink("d2/link1"), "NOWHERE1")
570
self.assertEquals(os.readlink("link2") , "NOWHERE2")
573
runbzr(['export', '-r', '4', 'exp4.tmp'])
575
self.assertEquals(listdir_sorted("."), [ "d2", "link2" ])
576
self.assertEquals(os.readlink("d2/link1"), "TARGET 1")
577
self.assertEquals(os.readlink("link2") , "TARGET 2")
578
self.assertEquals(listdir_sorted("d2"), [ "link1", "link3" ])
581
runbzr(['export', '-r', '5', 'exp5.tmp'])
583
self.assertEquals(listdir_sorted("."), [ "d2", "link2" ])
584
self.assert_(os.path.islink("link2"))
585
self.assert_(listdir_sorted("d2")== [ "link3" ])
588
runbzr(['export', '-r', '8', 'exp6.tmp'])
590
self.assertEqual(listdir_sorted("."), [ "d1", "d2", "link2"])
591
self.assertEquals(listdir_sorted("d1"), [ "link3new" ])
592
self.assertEquals(listdir_sorted("d2"), [])
593
self.assertEquals(os.readlink("d1/link3new"), "NOWHERE3")
596
progress("skipping symlink tests")
599
class RemoteTests(object):
600
"""Test bzr ui commands against remote branches."""
602
def test_branch(self):
604
wt = self.make_branch_and_tree('from')
606
wt.commit('empty commit for nonsense', allow_pointless=True)
607
url = self.get_readonly_url('from')
608
self.run_bzr('branch', url, 'to')
609
branch = Branch.open('to')
610
self.assertEqual(1, len(branch.revision_history()))
611
# the branch should be set in to to from
612
self.assertEqual(url + '/', branch.get_parent())
615
self.build_tree(['branch/', 'branch/file'])
616
self.capture('init branch')
617
self.capture('add branch/file')
618
self.capture('commit -m foo branch')
619
url = self.get_readonly_url('branch/file')
620
output = self.capture('log %s' % url)
621
self.assertEqual(8, len(output.split('\n')))
623
def test_check(self):
624
self.build_tree(['branch/', 'branch/file'])
625
self.capture('init branch')
626
self.capture('add branch/file')
627
self.capture('commit -m foo branch')
628
url = self.get_readonly_url('branch/')
629
self.run_bzr('check', url)
632
# create a source branch
633
os.mkdir('my-branch')
634
os.chdir('my-branch')
636
file('hello', 'wt').write('foo')
637
self.run_bzr('add', 'hello')
638
self.run_bzr('commit', '-m', 'setup')
640
# with an explicit target work
641
self.run_bzr('push', self.get_url('output-branch'))
644
class HTTPTests(TestCaseWithWebserver, RemoteTests):
645
"""Test various commands against a HTTP server."""
648
class SFTPTestsAbsolute(TestCaseWithSFTPServer, RemoteTests):
649
"""Test various commands against a SFTP server using abs paths."""
652
class SFTPTestsAbsoluteSibling(TestCaseWithSFTPServer, RemoteTests):
653
"""Test various commands against a SFTP server using abs paths."""
656
super(SFTPTestsAbsoluteSibling, self).setUp()
657
self._override_home = '/dev/noone/runs/tests/here'
660
class SFTPTestsRelative(TestCaseWithSFTPServer, RemoteTests):
661
"""Test various commands against a SFTP server using homedir rel paths."""
664
super(SFTPTestsRelative, self).setUp()
665
self._get_remote_is_absolute = False