Rev 5453: Merge ~mbp/bzr/scripts to handle NEWS conflicts in http://bzr.arbash-meinel.com/branches/bzr/jam-integration
John Arbash Meinel
john at arbash-meinel.com
Thu Sep 30 20:34:12 BST 2010
At http://bzr.arbash-meinel.com/branches/bzr/jam-integration
------------------------------------------------------------
revno: 5453 [merge]
revision-id: john at arbash-meinel.com-20100930193353-lxjnx32ulm9otk05
parent: pqm at pqm.ubuntu.com-20100929220303-cr95h8iwtggco721
parent: mbp at sourcefrog.net-20100917082430-zlf4vus3yt9qug1l
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Thu 2010-09-30 14:33:53 -0500
message:
Merge ~mbp/bzr/scripts to handle NEWS conflicts
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/blackbox/test_bound_branches.py test_bound_branches.py-20051109215527-2373188ad566c205
bzrlib/tests/blackbox/test_dpush.py test_dpush.py-20090108125928-st1td6le59g0vyv2-1
bzrlib/tests/blackbox/test_shelve.py test_ls_shelf.py-20081202053526-thlo8yt0pi1cgor1-1
bzrlib/tests/script.py script.py-20090901081155-yk3tiy1nunxg16ne-1
bzrlib/tests/test_conflicts.py test_conflicts.py-20051006031059-e2dad9bbeaa5891f
bzrlib/tests/test_script.py test_script.py-20090901081156-y90z4w2t62fv7e7b-1
doc/developers/testing.txt testing.txt-20080812140359-i70zzh6v2z7grqex-1
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2010-09-29 22:03:03 +0000
+++ b/NEWS 2010-09-30 19:33:53 +0000
@@ -461,6 +461,10 @@
Testing
*******
+* Blank output section in scriptrunner tests no longer match any output.
+ Instead, use '...' as a wildcard if you don't care about the output.
+ (Martin Pool, #637830)
+
* ``build_tree_contents`` can create symlinks.
(Martin Pool, John Arbash Meinel)
=== modified file 'bzrlib/tests/blackbox/test_bound_branches.py'
--- a/bzrlib/tests/blackbox/test_bound_branches.py 2010-05-02 20:10:25 +0000
+++ b/bzrlib/tests/blackbox/test_bound_branches.py 2010-09-14 09:47:23 +0000
@@ -443,7 +443,9 @@
def test_bind_when_bound(self):
self.run_script("""
$ bzr init trunk
+...
$ bzr init copy
+...
$ cd copy
$ bzr bind ../trunk
$ bzr bind
@@ -453,6 +455,7 @@
def test_bind_before_bound(self):
self.run_script("""
$ bzr init trunk
+...
$ cd trunk
$ bzr bind
2>bzr: ERROR: No location supplied and no previous location known
=== modified file 'bzrlib/tests/blackbox/test_dpush.py'
--- a/bzrlib/tests/blackbox/test_dpush.py 2010-06-23 08:19:28 +0000
+++ b/bzrlib/tests/blackbox/test_dpush.py 2010-09-14 09:47:23 +0000
@@ -104,6 +104,7 @@
script.run_script(self, '''
$ bzr dpush -d dc d
+ 2>Pushed up to revision 2.
$ bzr revno dc
2
$ bzr status dc
@@ -121,6 +122,7 @@
self.build_tree_contents([("dc/foofile", "blaaaal")])
script.run_script(self, '''
$ bzr dpush -d dc d --no-strict
+ 2>Pushed up to revision 2.
''')
self.assertFileEqual("blaaaal", "dc/foofile")
# if the dummy vcs wasn't that dummy we could uncomment the line below
=== modified file 'bzrlib/tests/blackbox/test_shelve.py'
--- a/bzrlib/tests/blackbox/test_shelve.py 2010-05-28 14:15:28 +0000
+++ b/bzrlib/tests/blackbox/test_shelve.py 2010-09-14 09:47:23 +0000
@@ -77,10 +77,18 @@
sr = ScriptRunner()
sr.run_script(self, '''
$ bzr add file
+adding file
$ bzr shelve --all -m Foo
+2>Selected changes:
+2>-D file
+2>Changes shelved with id "1".
$ bzr shelve --list
1: Foo
$ bzr unshelve --keep
+2>Using changes with id "1".
+2>Message: Foo
+2>+N file
+2>All changes applied successfully.
$ bzr shelve --list
1: Foo
$ cat file
=== modified file 'bzrlib/tests/script.py'
--- a/bzrlib/tests/script.py 2010-09-13 08:14:44 +0000
+++ b/bzrlib/tests/script.py 2010-09-15 05:10:04 +0000
@@ -221,20 +221,30 @@
retcode, actual_output, actual_error = method(test_case,
str_input, args)
- self._check_output(output, actual_output, test_case)
- self._check_output(error, actual_error, test_case)
+ try:
+ self._check_output(output, actual_output, test_case)
+ except AssertionError, e:
+ raise AssertionError(str(e) + " in stdout of command %s" % cmd)
+ try:
+ self._check_output(error, actual_error, test_case)
+ except AssertionError, e:
+ raise AssertionError(str(e) +
+ " in stderr of running command %s" % cmd)
if retcode and not error and actual_error:
test_case.fail('In \n\t%s\nUnexpected error: %s'
% (' '.join(cmd), actual_error))
return retcode, actual_output, actual_error
def _check_output(self, expected, actual, test_case):
- if expected is None:
- # Specifying None means: any output is accepted
- return
- if actual is None:
- test_case.fail('We expected output: %r, but found None'
- % (expected,))
+ if not actual:
+ if expected is None:
+ return
+ elif expected == '...\n':
+ return
+ else:
+ test_case.fail('expected output: %r, but found nothing'
+ % (expected,))
+ expected = expected or ''
matching = self.output_checker.check_output(
expected, actual, self.check_options)
if not matching:
=== modified file 'bzrlib/tests/test_conflicts.py'
--- a/bzrlib/tests/test_conflicts.py 2010-04-06 10:12:42 +0000
+++ b/bzrlib/tests/test_conflicts.py 2010-09-14 10:17:30 +0000
@@ -625,20 +625,18 @@
# tests MissingParent resolution :-/
preamble = """
$ bzr init trunk
+...
$ cd trunk
$ mkdir dir
-$ bzr add dir
-$ bzr commit -m 'Create trunk'
-
+$ bzr add -q dir
+$ bzr commit -m 'Create trunk' -q
$ echo 'trunk content' >dir/file
-$ bzr add dir/file
-$ bzr commit -m 'Add dir/file in trunk'
-
-$ bzr branch . -r 1 ../branch
+$ bzr add -q dir/file
+$ bzr commit -q -m 'Add dir/file in trunk'
+$ bzr branch -q . -r 1 ../branch
$ cd ../branch
-$ bzr rm dir
-$ bzr commit -m 'Remove dir in branch'
-
+$ bzr rm dir -q
+$ bzr commit -q -m 'Remove dir in branch'
$ bzr merge ../trunk
2>+N dir/
2>+N dir/file
@@ -649,15 +647,15 @@
def test_take_this(self):
self.run_script("""
-$ bzr rm dir --force
+$ bzr rm -q dir --force
$ bzr resolve dir
-$ bzr commit --strict -m 'No more conflicts nor unknown files'
+$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
""")
def test_take_other(self):
self.run_script("""
$ bzr resolve dir
-$ bzr commit --strict -m 'No more conflicts nor unknown files'
+$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
""")
@@ -665,22 +663,20 @@
preamble = """
$ bzr init trunk
+...
$ cd trunk
$ mkdir dir
$ echo 'trunk content' >dir/file
-$ bzr add
-$ bzr commit -m 'Create trunk'
-
+$ bzr add -q
+$ bzr commit -m 'Create trunk' -q
$ echo 'trunk content' >dir/file2
-$ bzr add dir/file2
-$ bzr commit -m 'Add dir/file2 in branch'
-
-$ bzr branch . -r 1 ../branch
+$ bzr add -q dir/file2
+$ bzr commit -q -m 'Add dir/file2 in branch'
+$ bzr branch -q . -r 1 ../branch
$ cd ../branch
-$ bzr rm dir/file --force
-$ bzr rm dir
-$ bzr commit -m 'Remove dir/file'
-
+$ bzr rm -q dir/file --force
+$ bzr rm -q dir
+$ bzr commit -q -m 'Remove dir/file'
$ bzr merge ../trunk
2>+N dir/
2>+N dir/file2
@@ -692,34 +688,36 @@
def test_keep_them_all(self):
self.run_script("""
$ bzr resolve dir
-$ bzr commit --strict -m 'No more conflicts nor unknown files'
+$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
""")
def test_adopt_child(self):
self.run_script("""
-$ bzr mv dir/file2 file2
-$ bzr rm dir --force
+$ bzr mv -q dir/file2 file2
+$ bzr rm -q dir --force
$ bzr resolve dir
-$ bzr commit --strict -m 'No more conflicts nor unknown files'
+$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
""")
def test_kill_them_all(self):
self.run_script("""
-$ bzr rm dir --force
+$ bzr rm -q dir --force
$ bzr resolve dir
-$ bzr commit --strict -m 'No more conflicts nor unknown files'
+$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
""")
def test_resolve_taking_this(self):
self.run_script("""
$ bzr resolve --take-this dir
-$ bzr commit --strict -m 'No more conflicts nor unknown files'
+2>...
+$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
""")
def test_resolve_taking_other(self):
self.run_script("""
$ bzr resolve --take-other dir
-$ bzr commit --strict -m 'No more conflicts nor unknown files'
+2>...
+$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
""")
@@ -727,22 +725,20 @@
preamble = """
$ bzr init trunk
+...
$ cd trunk
$ mkdir dir
$ echo 'trunk content' >dir/file
-$ bzr add
-$ bzr commit -m 'Create trunk'
-
-$ bzr rm dir/file --force
-$ bzr rm dir --force
-$ bzr commit -m 'Remove dir/file'
-
-$ bzr branch . -r 1 ../branch
+$ bzr add -q
+$ bzr commit -m 'Create trunk' -q
+$ bzr rm -q dir/file --force
+$ bzr rm -q dir --force
+$ bzr commit -q -m 'Remove dir/file'
+$ bzr branch -q . -r 1 ../branch
$ cd ../branch
$ echo 'branch content' >dir/file2
-$ bzr add dir/file2
-$ bzr commit -m 'Add dir/file2 in branch'
-
+$ bzr add -q dir/file2
+$ bzr commit -q -m 'Add dir/file2 in branch'
$ bzr merge ../trunk
2>-D dir/file
2>Conflict: can't delete dir because it is not empty. Not deleting.
@@ -753,34 +749,36 @@
def test_keep_them_all(self):
self.run_script("""
$ bzr resolve dir
-$ bzr commit --strict -m 'No more conflicts nor unknown files'
+$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
""")
def test_adopt_child(self):
self.run_script("""
-$ bzr mv dir/file2 file2
-$ bzr rm dir --force
+$ bzr mv -q dir/file2 file2
+$ bzr rm -q dir --force
$ bzr resolve dir
-$ bzr commit --strict -m 'No more conflicts nor unknown files'
+$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
""")
def test_kill_them_all(self):
self.run_script("""
-$ bzr rm dir --force
+$ bzr rm -q dir --force
$ bzr resolve dir
-$ bzr commit --strict -m 'No more conflicts nor unknown files'
+$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
""")
def test_resolve_taking_this(self):
self.run_script("""
$ bzr resolve --take-this dir
-$ bzr commit --strict -m 'No more conflicts nor unknown files'
+$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
""")
def test_resolve_taking_other(self):
self.run_script("""
$ bzr resolve --take-other dir
-$ bzr commit --strict -m 'No more conflicts nor unknown files'
+2>deleted dir/file2
+2>deleted dir
+$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
""")
@@ -882,19 +880,19 @@
preamble = """
$ bzr init trunk
+...
$ cd trunk
$ bzr mkdir foo
-$ bzr commit -m 'Create trunk'
+...
+$ bzr commit -m 'Create trunk' -q
$ echo "Boing" >foo/bar
-$ bzr add foo/bar
-$ bzr commit -m 'Add foo/bar'
-
-$ bzr branch . -r 1 ../branch
+$ bzr add -q foo/bar
+$ bzr commit -q -m 'Add foo/bar'
+$ bzr branch -q . -r 1 ../branch
$ cd ../branch
$ rm -r foo
$ echo "Boo!" >foo
-$ bzr commit -m 'foo is now a file'
-
+$ bzr commit -q -m 'foo is now a file'
$ bzr merge ../trunk
2>+N foo.new/bar
2>RK foo => foo.new/
@@ -906,32 +904,34 @@
def test_take_this(self):
self.run_script("""
-$ bzr rm foo.new --force
+$ bzr rm -q foo.new --force
# FIXME: Isn't it weird that foo is now unkown even if foo.new has been put
# aside ? -- vila 090916
-$ bzr add foo
+$ bzr add -q foo
$ bzr resolve foo.new
-$ bzr commit --strict -m 'No more conflicts nor unknown files'
+$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
""")
def test_take_other(self):
self.run_script("""
-$ bzr rm foo --force
-$ bzr mv foo.new foo
+$ bzr rm -q foo --force
+$ bzr mv -q foo.new foo
$ bzr resolve foo
-$ bzr commit --strict -m 'No more conflicts nor unknown files'
+$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
""")
def test_resolve_taking_this(self):
self.run_script("""
$ bzr resolve --take-this foo.new
-$ bzr commit --strict -m 'No more conflicts nor unknown files'
+2>...
+$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
""")
def test_resolve_taking_other(self):
self.run_script("""
$ bzr resolve --take-other foo.new
-$ bzr commit --strict -m 'No more conflicts nor unknown files'
+2>...
+$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
""")
@@ -943,19 +943,19 @@
# conflict.
self.run_script("""
$ bzr init trunk
+...
$ cd trunk
$ bzr mkdir foo
-$ bzr commit -m 'Create trunk'
+...
+$ bzr commit -m 'Create trunk' -q
$ rm -r foo
$ echo "Boo!" >foo
-$ bzr commit -m 'foo is now a file'
-
-$ bzr branch . -r 1 ../branch
+$ bzr commit -m 'foo is now a file' -q
+$ bzr branch -q . -r 1 ../branch -q
$ cd ../branch
$ echo "Boing" >foo/bar
-$ bzr add foo/bar
-$ bzr commit -m 'Add foo/bar'
-
+$ bzr add -q foo/bar -q
+$ bzr commit -m 'Add foo/bar' -q
$ bzr merge ../trunk
2>bzr: ERROR: Tree transform is malformed [('unversioned executability', 'new-1')]
""")
=== modified file 'bzrlib/tests/test_script.py'
--- a/bzrlib/tests/test_script.py 2010-09-13 09:00:03 +0000
+++ b/bzrlib/tests/test_script.py 2010-09-14 09:33:49 +0000
@@ -162,6 +162,31 @@
def test_unknown_command(self):
self.assertRaises(SyntaxError, self.run_script, 'foo')
+ def test_blank_output_mismatches_output(self):
+ """If you give output, the output must actually be blank.
+
+ See <https://bugs.launchpad.net/bzr/+bug/637830>: previously blank
+ output was a wildcard. Now you must say ... if you want that.
+ """
+ self.assertRaises(AssertionError,
+ self.run_script,
+ """
+ $ echo foo
+ """)
+
+ def test_ellipsis_everything(self):
+ """A simple ellipsis matches everything."""
+ self.run_script("""
+ $ echo foo
+ ...
+ """)
+
+ def test_ellipsis_matches_empty(self):
+ self.run_script("""
+ $ cd .
+ ...
+ """)
+
def test_stops_on_unexpected_output(self):
story = """
$ mkdir dir
@@ -170,7 +195,6 @@
"""
self.assertRaises(AssertionError, self.run_script, story)
-
def test_stops_on_unexpected_error(self):
story = """
$ cat
@@ -190,10 +214,13 @@
# The status matters, not the output
story = """
$ bzr init
+...
$ cat >file
<Hello
$ bzr add file
+...
$ bzr commit -m 'adding file'
+2>...
"""
self.run_script(story)
@@ -356,7 +383,10 @@
class TestBzr(script.TestCaseWithTransportAndScript):
def test_bzr_smoke(self):
- self.run_script('$ bzr init branch')
+ self.run_script("""
+ $ bzr init branch
+ Created a standalone tree (format: ...)
+ """)
self.failUnlessExists('branch')
=== modified file 'doc/developers/testing.txt'
--- a/doc/developers/testing.txt 2010-09-23 09:54:51 +0000
+++ b/doc/developers/testing.txt 2010-09-30 19:33:53 +0000
@@ -388,6 +388,12 @@
If you want the command to succeed for any output, just use::
$ bzr add file
+ ...
+ 2>...
+
+or use the ``--quiet`` option::
+
+ $ bzr add -q file
The following will stop with an error::
More information about the bazaar-commits
mailing list