Merge lp:~mbp/bzr/scripts into lp:bzr

Proposed by Martin Pool
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: 5476
Proposed branch: lp:~mbp/bzr/scripts
Merge into: lp:bzr
Diff against target: 582 lines (+167/-86)
11 files modified
NEWS (+4/-0)
bzrlib/commands.py (+6/-1)
bzrlib/tests/__init__.py (+4/-0)
bzrlib/tests/blackbox/test_bound_branches.py (+3/-0)
bzrlib/tests/blackbox/test_dpush.py (+2/-0)
bzrlib/tests/blackbox/test_shelve.py (+8/-0)
bzrlib/tests/script.py (+18/-8)
bzrlib/tests/test_conflicts.py (+73/-73)
bzrlib/tests/test_delta.py (+1/-2)
bzrlib/tests/test_script.py (+42/-2)
doc/developers/testing.txt (+6/-0)
To merge this branch: bzr merge lp:~mbp/bzr/scripts
Reviewer Review Type Date Requested Status
John A Meinel Approve
Vincent Ladeuil Needs Fixing
Review via email: mp+35386@code.launchpad.net

Commit message

empty output in shell-like tests is no longer a wildcard

Description of the change

This changes the scriptrunner behaviour so that

"""
$ echo foo
"""

will fail, because it asserts echo doesn't produce output.

I think this is less confusing. If you want to allow for a command that might produce output but you don't care, you can say '...'. It's also more consistent with regular doctest.

This is going to put on a slight extra burden that you need to think about commands that may produce output, and if we change a command that is initially silent to produce output, we may need to update a bunch of tests. However I think this is much safer than not letting people check things actually are silent.

test_resolve is a bit messy, but I think it's actually better after the changes: more clear about which bits it actually is or isn't testing, and it points out the usefulness of -q when you don't want to see the output for a particular command.

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

I agree, having the test writer think about -q and '...' sounds like a good plan.
The only drawback I could think of is that it will require a bit more expertise
than a mere copy/paste. No big loss here, I'm still waiting for bug reporters to
do that anyway :-D

127 - test_case.assertEqualDiff(expected, actual)
128 + test_case.assertEquals(expected, actual)

Why ??? EqualDiff provides valuable info, please don't remove that !

review: Needs Fixing
Revision history for this message
Martin Pool (mbp) wrote :

On 15 September 2010 03:29, Vincent Ladeuil <email address hidden> wrote:
> Review: Needs Fixing
> I agree, having the test writer think about -q and '...' sounds like a good plan.
> The only drawback I could think of is that it will require a bit more expertise
> than a mere copy/paste. No big loss here, I'm still waiting for bug reporters to
> do that anyway :-D
>
> 127     - test_case.assertEqualDiff(expected, actual)
> 128     + test_case.assertEquals(expected, actual)
>
> Why ??? EqualDiff provides valuable info, please don't remove that !

The diff is nicer to read, but it's less precise when there are
differences of whitespace etc, to the extent that I couldn't work out
what was going wrong. Perhaps I'll write a separate method that tries
to get the best of both, in a followon patch. For now I'll just
revert that.

--
Martin

Revision history for this message
Martin Pool (mbp) wrote :

sent to pqm by email

Revision history for this message
Martin Pool (mbp) wrote :

sent to pqm by email

Revision history for this message
Andrew Bennetts (spiv) wrote :

sent to pqm by email

Revision history for this message
John A Meinel (jameinel) wrote :

sent to pqm by email

Revision history for this message
John A Meinel (jameinel) wrote :

Manually updated to resolve NEWS and submitted to pqm via pqm-submit.

Revision history for this message
John A Meinel (jameinel) wrote :

The tests are failing, not just a NEWS conflict, so I'm bouncing this back to Martin.

Revision history for this message
Martin Pool (mbp) wrote :

The script failures are fixed by <https://code.edge.launchpad.net/~mbp/bzr/656694-verbosity/+merge/37933>. The problem was that if you set -q or -v in a script command, it was inherited by the whole process. Thanks spiv, vila!

Revision history for this message
John A Meinel (jameinel) wrote :

seems fine to me

review: Approve
Revision history for this message
Martin Pool (mbp) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2010-10-08 01:47:43 +0000
+++ NEWS 2010-10-08 06:36:46 +0000
@@ -504,6 +504,10 @@
504Testing504Testing
505*******505*******
506506
507* Blank output section in scriptrunner tests no longer match any output.
508 Instead, use '...' as a wildcard if you don't care about the output.
509 (Martin Pool, #637830)
510
507* ``build_tree_contents`` can create symlinks.511* ``build_tree_contents`` can create symlinks.
508 (Martin Pool, John Arbash Meinel)512 (Martin Pool, John Arbash Meinel)
509513
510514
=== modified file 'bzrlib/commands.py'
--- bzrlib/commands.py 2010-08-13 07:56:06 +0000
+++ bzrlib/commands.py 2010-10-08 06:36:46 +0000
@@ -687,7 +687,12 @@
687687
688 self._setup_outf()688 self._setup_outf()
689689
690 return self.run(**all_cmd_args)690 try:
691 return self.run(**all_cmd_args)
692 finally:
693 # reset it, so that other commands run in the same process won't
694 # inherit state
695 trace.set_verbosity_level(0)
691696
692 def _setup_run(self):697 def _setup_run(self):
693 """Wrap the defined run method on self with a cleanup.698 """Wrap the defined run method on self with a cleanup.
694699
=== modified file 'bzrlib/tests/__init__.py'
--- bzrlib/tests/__init__.py 2010-10-08 01:43:13 +0000
+++ bzrlib/tests/__init__.py 2010-10-08 06:36:46 +0000
@@ -858,6 +858,10 @@
858 self._track_transports()858 self._track_transports()
859 self._track_locks()859 self._track_locks()
860 self._clear_debug_flags()860 self._clear_debug_flags()
861 # Isolate global verbosity level, to make sure it's reproducible
862 # between tests. We should get rid of this altogether: bug 656694. --
863 # mbp 20101008
864 self.overrideAttr(bzrlib.trace, '_verbosity_level', 0)
861865
862 def debug(self):866 def debug(self):
863 # debug a frame up.867 # debug a frame up.
864868
=== modified file 'bzrlib/tests/blackbox/test_bound_branches.py'
--- bzrlib/tests/blackbox/test_bound_branches.py 2010-05-02 20:10:25 +0000
+++ bzrlib/tests/blackbox/test_bound_branches.py 2010-10-08 06:36:46 +0000
@@ -443,7 +443,9 @@
443 def test_bind_when_bound(self):443 def test_bind_when_bound(self):
444 self.run_script("""444 self.run_script("""
445$ bzr init trunk445$ bzr init trunk
446...
446$ bzr init copy447$ bzr init copy
448...
447$ cd copy449$ cd copy
448$ bzr bind ../trunk450$ bzr bind ../trunk
449$ bzr bind451$ bzr bind
@@ -453,6 +455,7 @@
453 def test_bind_before_bound(self):455 def test_bind_before_bound(self):
454 self.run_script("""456 self.run_script("""
455$ bzr init trunk457$ bzr init trunk
458...
456$ cd trunk459$ cd trunk
457$ bzr bind460$ bzr bind
4582>bzr: ERROR: No location supplied and no previous location known4612>bzr: ERROR: No location supplied and no previous location known
459462
=== modified file 'bzrlib/tests/blackbox/test_dpush.py'
--- bzrlib/tests/blackbox/test_dpush.py 2010-06-23 08:19:28 +0000
+++ bzrlib/tests/blackbox/test_dpush.py 2010-10-08 06:36:46 +0000
@@ -104,6 +104,7 @@
104104
105 script.run_script(self, '''105 script.run_script(self, '''
106 $ bzr dpush -d dc d106 $ bzr dpush -d dc d
107 2>Pushed up to revision 2.
107 $ bzr revno dc108 $ bzr revno dc
108 2109 2
109 $ bzr status dc110 $ bzr status dc
@@ -121,6 +122,7 @@
121 self.build_tree_contents([("dc/foofile", "blaaaal")])122 self.build_tree_contents([("dc/foofile", "blaaaal")])
122 script.run_script(self, '''123 script.run_script(self, '''
123 $ bzr dpush -d dc d --no-strict124 $ bzr dpush -d dc d --no-strict
125 2>Pushed up to revision 2.
124 ''')126 ''')
125 self.assertFileEqual("blaaaal", "dc/foofile")127 self.assertFileEqual("blaaaal", "dc/foofile")
126 # if the dummy vcs wasn't that dummy we could uncomment the line below128 # if the dummy vcs wasn't that dummy we could uncomment the line below
127129
=== modified file 'bzrlib/tests/blackbox/test_shelve.py'
--- bzrlib/tests/blackbox/test_shelve.py 2010-09-29 12:58:17 +0000
+++ bzrlib/tests/blackbox/test_shelve.py 2010-10-08 06:36:46 +0000
@@ -77,10 +77,18 @@
77 sr = ScriptRunner()77 sr = ScriptRunner()
78 sr.run_script(self, '''78 sr.run_script(self, '''
79$ bzr add file79$ bzr add file
80adding file
80$ bzr shelve --all -m Foo81$ bzr shelve --all -m Foo
822>Selected changes:
832>-D file
842>Changes shelved with id "1".
81$ bzr shelve --list85$ bzr shelve --list
82 1: Foo86 1: Foo
83$ bzr unshelve --keep87$ bzr unshelve --keep
882>Using changes with id "1".
892>Message: Foo
902>+N file
912>All changes applied successfully.
84$ bzr shelve --list92$ bzr shelve --list
85 1: Foo93 1: Foo
86$ cat file94$ cat file
8795
=== modified file 'bzrlib/tests/script.py'
--- bzrlib/tests/script.py 2010-09-13 08:14:44 +0000
+++ bzrlib/tests/script.py 2010-10-08 06:36:46 +0000
@@ -221,20 +221,30 @@
221 retcode, actual_output, actual_error = method(test_case,221 retcode, actual_output, actual_error = method(test_case,
222 str_input, args)222 str_input, args)
223223
224 self._check_output(output, actual_output, test_case)224 try:
225 self._check_output(error, actual_error, test_case)225 self._check_output(output, actual_output, test_case)
226 except AssertionError, e:
227 raise AssertionError(str(e) + " in stdout of command %s" % cmd)
228 try:
229 self._check_output(error, actual_error, test_case)
230 except AssertionError, e:
231 raise AssertionError(str(e) +
232 " in stderr of running command %s" % cmd)
226 if retcode and not error and actual_error:233 if retcode and not error and actual_error:
227 test_case.fail('In \n\t%s\nUnexpected error: %s'234 test_case.fail('In \n\t%s\nUnexpected error: %s'
228 % (' '.join(cmd), actual_error))235 % (' '.join(cmd), actual_error))
229 return retcode, actual_output, actual_error236 return retcode, actual_output, actual_error
230237
231 def _check_output(self, expected, actual, test_case):238 def _check_output(self, expected, actual, test_case):
232 if expected is None:239 if not actual:
233 # Specifying None means: any output is accepted240 if expected is None:
234 return241 return
235 if actual is None:242 elif expected == '...\n':
236 test_case.fail('We expected output: %r, but found None'243 return
237 % (expected,))244 else:
245 test_case.fail('expected output: %r, but found nothing'
246 % (expected,))
247 expected = expected or ''
238 matching = self.output_checker.check_output(248 matching = self.output_checker.check_output(
239 expected, actual, self.check_options)249 expected, actual, self.check_options)
240 if not matching:250 if not matching:
241251
=== modified file 'bzrlib/tests/test_conflicts.py'
--- bzrlib/tests/test_conflicts.py 2010-04-06 10:12:42 +0000
+++ bzrlib/tests/test_conflicts.py 2010-10-08 06:36:46 +0000
@@ -625,20 +625,18 @@
625 # tests MissingParent resolution :-/625 # tests MissingParent resolution :-/
626 preamble = """626 preamble = """
627$ bzr init trunk627$ bzr init trunk
628...
628$ cd trunk629$ cd trunk
629$ mkdir dir630$ mkdir dir
630$ bzr add dir631$ bzr add -q dir
631$ bzr commit -m 'Create trunk'632$ bzr commit -m 'Create trunk' -q
632
633$ echo 'trunk content' >dir/file633$ echo 'trunk content' >dir/file
634$ bzr add dir/file634$ bzr add -q dir/file
635$ bzr commit -m 'Add dir/file in trunk'635$ bzr commit -q -m 'Add dir/file in trunk'
636636$ bzr branch -q . -r 1 ../branch
637$ bzr branch . -r 1 ../branch
638$ cd ../branch637$ cd ../branch
639$ bzr rm dir638$ bzr rm dir -q
640$ bzr commit -m 'Remove dir in branch'639$ bzr commit -q -m 'Remove dir in branch'
641
642$ bzr merge ../trunk640$ bzr merge ../trunk
6432>+N dir/6412>+N dir/
6442>+N dir/file6422>+N dir/file
@@ -649,15 +647,15 @@
649647
650 def test_take_this(self):648 def test_take_this(self):
651 self.run_script("""649 self.run_script("""
652$ bzr rm dir --force650$ bzr rm -q dir --force
653$ bzr resolve dir651$ bzr resolve dir
654$ bzr commit --strict -m 'No more conflicts nor unknown files'652$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
655""")653""")
656654
657 def test_take_other(self):655 def test_take_other(self):
658 self.run_script("""656 self.run_script("""
659$ bzr resolve dir657$ bzr resolve dir
660$ bzr commit --strict -m 'No more conflicts nor unknown files'658$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
661""")659""")
662660
663661
@@ -665,22 +663,20 @@
665663
666 preamble = """664 preamble = """
667$ bzr init trunk665$ bzr init trunk
666...
668$ cd trunk667$ cd trunk
669$ mkdir dir668$ mkdir dir
670$ echo 'trunk content' >dir/file669$ echo 'trunk content' >dir/file
671$ bzr add670$ bzr add -q
672$ bzr commit -m 'Create trunk'671$ bzr commit -m 'Create trunk' -q
673
674$ echo 'trunk content' >dir/file2672$ echo 'trunk content' >dir/file2
675$ bzr add dir/file2673$ bzr add -q dir/file2
676$ bzr commit -m 'Add dir/file2 in branch'674$ bzr commit -q -m 'Add dir/file2 in branch'
677675$ bzr branch -q . -r 1 ../branch
678$ bzr branch . -r 1 ../branch
679$ cd ../branch676$ cd ../branch
680$ bzr rm dir/file --force677$ bzr rm -q dir/file --force
681$ bzr rm dir678$ bzr rm -q dir
682$ bzr commit -m 'Remove dir/file'679$ bzr commit -q -m 'Remove dir/file'
683
684$ bzr merge ../trunk680$ bzr merge ../trunk
6852>+N dir/6812>+N dir/
6862>+N dir/file26822>+N dir/file2
@@ -692,34 +688,36 @@
692 def test_keep_them_all(self):688 def test_keep_them_all(self):
693 self.run_script("""689 self.run_script("""
694$ bzr resolve dir690$ bzr resolve dir
695$ bzr commit --strict -m 'No more conflicts nor unknown files'691$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
696""")692""")
697693
698 def test_adopt_child(self):694 def test_adopt_child(self):
699 self.run_script("""695 self.run_script("""
700$ bzr mv dir/file2 file2696$ bzr mv -q dir/file2 file2
701$ bzr rm dir --force697$ bzr rm -q dir --force
702$ bzr resolve dir698$ bzr resolve dir
703$ bzr commit --strict -m 'No more conflicts nor unknown files'699$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
704""")700""")
705701
706 def test_kill_them_all(self):702 def test_kill_them_all(self):
707 self.run_script("""703 self.run_script("""
708$ bzr rm dir --force704$ bzr rm -q dir --force
709$ bzr resolve dir705$ bzr resolve dir
710$ bzr commit --strict -m 'No more conflicts nor unknown files'706$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
711""")707""")
712708
713 def test_resolve_taking_this(self):709 def test_resolve_taking_this(self):
714 self.run_script("""710 self.run_script("""
715$ bzr resolve --take-this dir711$ bzr resolve --take-this dir
716$ bzr commit --strict -m 'No more conflicts nor unknown files'7122>...
713$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
717""")714""")
718715
719 def test_resolve_taking_other(self):716 def test_resolve_taking_other(self):
720 self.run_script("""717 self.run_script("""
721$ bzr resolve --take-other dir718$ bzr resolve --take-other dir
722$ bzr commit --strict -m 'No more conflicts nor unknown files'7192>...
720$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
723""")721""")
724722
725723
@@ -727,22 +725,20 @@
727725
728 preamble = """726 preamble = """
729$ bzr init trunk727$ bzr init trunk
728...
730$ cd trunk729$ cd trunk
731$ mkdir dir730$ mkdir dir
732$ echo 'trunk content' >dir/file731$ echo 'trunk content' >dir/file
733$ bzr add732$ bzr add -q
734$ bzr commit -m 'Create trunk'733$ bzr commit -m 'Create trunk' -q
735734$ bzr rm -q dir/file --force
736$ bzr rm dir/file --force735$ bzr rm -q dir --force
737$ bzr rm dir --force736$ bzr commit -q -m 'Remove dir/file'
738$ bzr commit -m 'Remove dir/file'737$ bzr branch -q . -r 1 ../branch
739
740$ bzr branch . -r 1 ../branch
741$ cd ../branch738$ cd ../branch
742$ echo 'branch content' >dir/file2739$ echo 'branch content' >dir/file2
743$ bzr add dir/file2740$ bzr add -q dir/file2
744$ bzr commit -m 'Add dir/file2 in branch'741$ bzr commit -q -m 'Add dir/file2 in branch'
745
746$ bzr merge ../trunk742$ bzr merge ../trunk
7472>-D dir/file7432>-D dir/file
7482>Conflict: can't delete dir because it is not empty. Not deleting.7442>Conflict: can't delete dir because it is not empty. Not deleting.
@@ -753,34 +749,36 @@
753 def test_keep_them_all(self):749 def test_keep_them_all(self):
754 self.run_script("""750 self.run_script("""
755$ bzr resolve dir751$ bzr resolve dir
756$ bzr commit --strict -m 'No more conflicts nor unknown files'752$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
757""")753""")
758754
759 def test_adopt_child(self):755 def test_adopt_child(self):
760 self.run_script("""756 self.run_script("""
761$ bzr mv dir/file2 file2757$ bzr mv -q dir/file2 file2
762$ bzr rm dir --force758$ bzr rm -q dir --force
763$ bzr resolve dir759$ bzr resolve dir
764$ bzr commit --strict -m 'No more conflicts nor unknown files'760$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
765""")761""")
766762
767 def test_kill_them_all(self):763 def test_kill_them_all(self):
768 self.run_script("""764 self.run_script("""
769$ bzr rm dir --force765$ bzr rm -q dir --force
770$ bzr resolve dir766$ bzr resolve dir
771$ bzr commit --strict -m 'No more conflicts nor unknown files'767$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
772""")768""")
773769
774 def test_resolve_taking_this(self):770 def test_resolve_taking_this(self):
775 self.run_script("""771 self.run_script("""
776$ bzr resolve --take-this dir772$ bzr resolve --take-this dir
777$ bzr commit --strict -m 'No more conflicts nor unknown files'773$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
778""")774""")
779775
780 def test_resolve_taking_other(self):776 def test_resolve_taking_other(self):
781 self.run_script("""777 self.run_script("""
782$ bzr resolve --take-other dir778$ bzr resolve --take-other dir
783$ bzr commit --strict -m 'No more conflicts nor unknown files'7792>deleted dir/file2
7802>deleted dir
781$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
784""")782""")
785783
786784
@@ -882,19 +880,19 @@
882880
883 preamble = """881 preamble = """
884$ bzr init trunk882$ bzr init trunk
883...
885$ cd trunk884$ cd trunk
886$ bzr mkdir foo885$ bzr mkdir foo
887$ bzr commit -m 'Create trunk'886...
887$ bzr commit -m 'Create trunk' -q
888$ echo "Boing" >foo/bar888$ echo "Boing" >foo/bar
889$ bzr add foo/bar889$ bzr add -q foo/bar
890$ bzr commit -m 'Add foo/bar'890$ bzr commit -q -m 'Add foo/bar'
891891$ bzr branch -q . -r 1 ../branch
892$ bzr branch . -r 1 ../branch
893$ cd ../branch892$ cd ../branch
894$ rm -r foo893$ rm -r foo
895$ echo "Boo!" >foo894$ echo "Boo!" >foo
896$ bzr commit -m 'foo is now a file'895$ bzr commit -q -m 'foo is now a file'
897
898$ bzr merge ../trunk896$ bzr merge ../trunk
8992>+N foo.new/bar8972>+N foo.new/bar
9002>RK foo => foo.new/8982>RK foo => foo.new/
@@ -906,32 +904,34 @@
906904
907 def test_take_this(self):905 def test_take_this(self):
908 self.run_script("""906 self.run_script("""
909$ bzr rm foo.new --force907$ bzr rm -q foo.new --force
910# FIXME: Isn't it weird that foo is now unkown even if foo.new has been put908# FIXME: Isn't it weird that foo is now unkown even if foo.new has been put
911# aside ? -- vila 090916909# aside ? -- vila 090916
912$ bzr add foo910$ bzr add -q foo
913$ bzr resolve foo.new911$ bzr resolve foo.new
914$ bzr commit --strict -m 'No more conflicts nor unknown files'912$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
915""")913""")
916914
917 def test_take_other(self):915 def test_take_other(self):
918 self.run_script("""916 self.run_script("""
919$ bzr rm foo --force917$ bzr rm -q foo --force
920$ bzr mv foo.new foo918$ bzr mv -q foo.new foo
921$ bzr resolve foo919$ bzr resolve foo
922$ bzr commit --strict -m 'No more conflicts nor unknown files'920$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
923""")921""")
924922
925 def test_resolve_taking_this(self):923 def test_resolve_taking_this(self):
926 self.run_script("""924 self.run_script("""
927$ bzr resolve --take-this foo.new925$ bzr resolve --take-this foo.new
928$ bzr commit --strict -m 'No more conflicts nor unknown files'9262>...
927$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
929""")928""")
930929
931 def test_resolve_taking_other(self):930 def test_resolve_taking_other(self):
932 self.run_script("""931 self.run_script("""
933$ bzr resolve --take-other foo.new932$ bzr resolve --take-other foo.new
934$ bzr commit --strict -m 'No more conflicts nor unknown files'9332>...
934$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
935""")935""")
936936
937937
@@ -943,19 +943,19 @@
943 # conflict.943 # conflict.
944 self.run_script("""944 self.run_script("""
945$ bzr init trunk945$ bzr init trunk
946...
946$ cd trunk947$ cd trunk
947$ bzr mkdir foo948$ bzr mkdir foo
948$ bzr commit -m 'Create trunk'949...
950$ bzr commit -m 'Create trunk' -q
949$ rm -r foo951$ rm -r foo
950$ echo "Boo!" >foo952$ echo "Boo!" >foo
951$ bzr commit -m 'foo is now a file'953$ bzr commit -m 'foo is now a file' -q
952954$ bzr branch -q . -r 1 ../branch -q
953$ bzr branch . -r 1 ../branch
954$ cd ../branch955$ cd ../branch
955$ echo "Boing" >foo/bar956$ echo "Boing" >foo/bar
956$ bzr add foo/bar957$ bzr add -q foo/bar -q
957$ bzr commit -m 'Add foo/bar'958$ bzr commit -m 'Add foo/bar' -q
958
959$ bzr merge ../trunk959$ bzr merge ../trunk
9602>bzr: ERROR: Tree transform is malformed [('unversioned executability', 'new-1')]9602>bzr: ERROR: Tree transform is malformed [('unversioned executability', 'new-1')]
961""")961""")
962962
=== modified file 'bzrlib/tests/test_delta.py'
--- bzrlib/tests/test_delta.py 2010-04-26 16:59:56 +0000
+++ bzrlib/tests/test_delta.py 2010-10-08 06:36:46 +0000
@@ -65,8 +65,7 @@
65 reporter.report(file_id, (old_path, path), versioned_change, renamed,65 reporter.report(file_id, (old_path, path), versioned_change, renamed,
66 modified, exe_change, kind)66 modified, exe_change, kind)
67 if expected_lines is not None:67 if expected_lines is not None:
68 for i in range(len(expected_lines)):68 self.assertEqualDiff('\n'.join(expected_lines), '\n'.join(result))
69 self.assertEqualDiff(expected_lines[i], result[i])
70 else:69 else:
71 self.assertEqual([], result)70 self.assertEqual([], result)
7271
7372
=== modified file 'bzrlib/tests/test_script.py'
--- bzrlib/tests/test_script.py 2010-09-13 09:00:03 +0000
+++ bzrlib/tests/test_script.py 2010-10-08 06:36:46 +0000
@@ -19,6 +19,7 @@
19 commands,19 commands,
20 osutils,20 osutils,
21 tests,21 tests,
22 trace,
22 ui,23 ui,
23 )24 )
24from bzrlib.tests import script25from bzrlib.tests import script
@@ -162,6 +163,31 @@
162 def test_unknown_command(self):163 def test_unknown_command(self):
163 self.assertRaises(SyntaxError, self.run_script, 'foo')164 self.assertRaises(SyntaxError, self.run_script, 'foo')
164165
166 def test_blank_output_mismatches_output(self):
167 """If you give output, the output must actually be blank.
168
169 See <https://bugs.launchpad.net/bzr/+bug/637830>: previously blank
170 output was a wildcard. Now you must say ... if you want that.
171 """
172 self.assertRaises(AssertionError,
173 self.run_script,
174 """
175 $ echo foo
176 """)
177
178 def test_ellipsis_everything(self):
179 """A simple ellipsis matches everything."""
180 self.run_script("""
181 $ echo foo
182 ...
183 """)
184
185 def test_ellipsis_matches_empty(self):
186 self.run_script("""
187 $ cd .
188 ...
189 """)
190
165 def test_stops_on_unexpected_output(self):191 def test_stops_on_unexpected_output(self):
166 story = """192 story = """
167$ mkdir dir193$ mkdir dir
@@ -170,7 +196,6 @@
170"""196"""
171 self.assertRaises(AssertionError, self.run_script, story)197 self.assertRaises(AssertionError, self.run_script, story)
172198
173
174 def test_stops_on_unexpected_error(self):199 def test_stops_on_unexpected_error(self):
175 story = """200 story = """
176$ cat201$ cat
@@ -190,10 +215,13 @@
190 # The status matters, not the output215 # The status matters, not the output
191 story = """216 story = """
192$ bzr init217$ bzr init
218...
193$ cat >file219$ cat >file
194<Hello220<Hello
195$ bzr add file221$ bzr add file
222...
196$ bzr commit -m 'adding file'223$ bzr commit -m 'adding file'
2242>...
197"""225"""
198 self.run_script(story)226 self.run_script(story)
199227
@@ -245,6 +273,15 @@
245cat dog "chicken" 'dragon'273cat dog "chicken" 'dragon'
246""")274""")
247275
276 def test_verbosity_isolated(self):
277 """Global verbosity is isolated from commands run in scripts.
278 """
279 # see also 656694; we should get rid of global verbosity
280 self.run_script("""
281 $ bzr init --quiet a
282 """)
283 self.assertEquals(trace.is_quiet(), False)
284
248285
249class TestCat(script.TestCaseWithTransportAndScript):286class TestCat(script.TestCaseWithTransportAndScript):
250287
@@ -356,7 +393,10 @@
356class TestBzr(script.TestCaseWithTransportAndScript):393class TestBzr(script.TestCaseWithTransportAndScript):
357394
358 def test_bzr_smoke(self):395 def test_bzr_smoke(self):
359 self.run_script('$ bzr init branch')396 self.run_script("""
397 $ bzr init branch
398 Created a standalone tree (format: ...)
399 """)
360 self.failUnlessExists('branch')400 self.failUnlessExists('branch')
361401
362402
363403
=== modified file 'doc/developers/testing.txt'
--- doc/developers/testing.txt 2010-09-23 09:54:51 +0000
+++ doc/developers/testing.txt 2010-10-08 06:36:46 +0000
@@ -388,6 +388,12 @@
388If you want the command to succeed for any output, just use::388If you want the command to succeed for any output, just use::
389389
390 $ bzr add file390 $ bzr add file
391 ...
392 2>...
393
394or use the ``--quiet`` option::
395
396 $ bzr add -q file
391397
392The following will stop with an error::398The following will stop with an error::
393399