Code review comment for lp:~paulbrianstewart/bzr/207507-bzr-commit-message

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Hi Paul,

On Mon, 2011-07-25 at 23:14 +0000, Paul Stewart wrote:
> I have been working away on understanding how to both change the commit error text, and also run the ./bzr selftest --no-plugins command on the my updated code. I noticed at first that there were 110 failed tests, so I went back to the original code, and changed just one thing, that being I changed the word 'empty' to 'Empty'. When I reran the code I got one failed test, in the ...bzr/bzrlib/tests/blackbox/test_commit.py file. It was looking for the message with 'empty', not 'Empty'.
> I have pasted part of the message below.
> Does this mean that when I change the message in the builtins.py file I also need to change it in the tests file as well? I'm just trying to figure out what I need to do to move forward. I am assuming that the idea is to modify/fix code until you get 0 failed tests?
Yes, if you change the code you will also need to modify the tests to
reflect that the expected behaviour has changed.

If you follow test driven development, you could also modify the test
first. The test is making sure that Bazaar is doing the right thing, so
if you update the test first, you can then keep running the tests and
updating the code until all the tests pass.

Does that help?

Cheers,

Jelmer

>
> Thanks for your help.
> Paul
>
> 43.787 Traceback (most recent call last):
> File "/home/paul/bzr/bzrlib/commands.py", line 1225, in run_bzr_catch_user_errors
> return run_bzr(argv)
> File "/home/paul/bzr/bzrlib/commands.py", line 1118, in run_bzr
> ret = run(*run_argv)
> File "/home/paul/bzr/bzrlib/commands.py", line 676, in run_argv_aliases
> return self.run(**all_cmd_args)
> File "/home/paul/bzr/bzrlib/commands.py", line 698, in run
> return self._operation.run_simple(*args, **kwargs)
> File "/home/paul/bzr/bzrlib/cleanup.py", line 135, in run_simple
> self.cleanups, self.func, *args, **kwargs)
> File "/home/paul/bzr/bzrlib/cleanup.py", line 165, in _do_with_cleanups
> result = func(*args, **kwargs)
> File "/home/paul/bzr/bzrlib/builtins.py", line 3346, in run
> lossy=lossy)
> File "/home/paul/bzr/bzrlib/decorators.py", line 217, in write_locked
> result = unbound(self, *args, **kwargs)
> File "/home/paul/bzr/bzrlib/workingtree_4.py", line 209, in commit
> result = WorkingTree.commit(self, message, revprops, *args, **kwargs)
> File "/home/paul/bzr/bzrlib/decorators.py", line 217, in write_locked
> result = unbound(self, *args, **kwargs)
> File "/home/paul/bzr/bzrlib/mutabletree.py", line 210, in commit
> *args, **kwargs)
> File "/home/paul/bzr/bzrlib/commit.py", line 289, in commit
> lossy=lossy)
> File "/home/paul/bzr/bzrlib/cleanup.py", line 131, in run
> self.cleanups, self.func, self, *args, **kwargs)
> File "/home/paul/bzr/bzrlib/cleanup.py", line 165, in _do_with_cleanups
> result = func(*args, **kwargs)
> File "/home/paul/bzr/bzrlib/commit.py", line 436, in _commit
> message = message_callback(self)
> File "/home/paul/bzr/bzrlib/builtins.py", line 3331, in get_message
> raise errors.BzrCommandError("Empty commit message specified")
> BzrCommandError: Empty commit message specified
>
> 43.787 errors:
> 'Committing to: /tmp/testbzr-oox7Z3.tmp/bzrlib.tests.blackbox.test_commit.TestCommit.test_commit_hook_template_rejected/work/tree/\nadded hello.txt\nCommit message was not edited, use anyway? [y/n]: bzr: ERROR: Empty commit message specified\n'
> ------------
> Text attachment: traceback
> ------------
> Traceback (most recent call last):
> File "/usr/lib/python2.7/dist-packages/testtools/runtest.py", line 169, in _run_user
> return fn(*args, **kwargs)
> File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 499, in _run_test_method
> return self._get_test_method()()
> File "/home/paul/bzr/bzrlib/tests/blackbox/test_commit.py", line 754, in test_commit_hook_template_rejected
> "commit tree/hello.txt", stdin="n\n")
> AssertionError: pattern "empty commit message" not found in
> """\
> Committing to: /tmp/testbzr-oox7Z3.tmp/bzrlib.tests.blackbox.test_commit.TestCommit.test_commit_hook_template_rejected/work/tree/
> added hello.txt
> Commit message was not edited, use anyway? [y/n]: bzr: ERROR: Empty commit message specified
> """
>

« Back to merge proposal