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
> """
>
Hi Paul,
On Mon, 2011-07-25 at 23:14 +0000, Paul Stewart wrote: bzrlib/ tests/blackbox/ test_commit. py file. It was looking for the message with 'empty', not 'Empty'.
> 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/
> 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
> paul/bzr/ bzrlib/ commands. py", line 1225, in run_bzr_ catch_user_ errors paul/bzr/ bzrlib/ commands. py", line 1118, in run_bzr paul/bzr/ bzrlib/ commands. py", line 676, in run_argv_aliases **all_cmd_ args) paul/bzr/ bzrlib/ commands. py", line 698, in run .run_simple( *args, **kwargs) paul/bzr/ bzrlib/ cleanup. py", line 135, in run_simple paul/bzr/ bzrlib/ cleanup. py", line 165, in _do_with_cleanups paul/bzr/ bzrlib/ builtins. py", line 3346, in run paul/bzr/ bzrlib/ decorators. py", line 217, in write_locked paul/bzr/ bzrlib/ workingtree_ 4.py", line 209, in commit commit( self, message, revprops, *args, **kwargs) paul/bzr/ bzrlib/ decorators. py", line 217, in write_locked paul/bzr/ bzrlib/ mutabletree. py", line 210, in commit paul/bzr/ bzrlib/ commit. py", line 289, in commit paul/bzr/ bzrlib/ cleanup. py", line 131, in run paul/bzr/ bzrlib/ cleanup. py", line 165, in _do_with_cleanups paul/bzr/ bzrlib/ commit. py", line 436, in _commit callback( self) paul/bzr/ bzrlib/ builtins. py", line 3331, in get_message BzrCommandError ("Empty commit message specified") 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' python2. 7/dist- packages/ testtools/ runtest. py", line 169, in _run_user python2. 7/dist- packages/ testtools/ testcase. py", line 499, in _run_test_method test_method( )() paul/bzr/ bzrlib/ tests/blackbox/ test_commit. py", line 754, in test_commit_ hook_template_ rejected oox7Z3. tmp/bzrlib. tests.blackbox. test_commit. TestCommit. test_commit_ hook_template_ rejected/ work/tree/
> Thanks for your help.
> Paul
>
> 43.787 Traceback (most recent call last):
> File "/home/
> return run_bzr(argv)
> File "/home/
> ret = run(*run_argv)
> File "/home/
> return self.run(
> File "/home/
> return self._operation
> File "/home/
> self.cleanups, self.func, *args, **kwargs)
> File "/home/
> result = func(*args, **kwargs)
> File "/home/
> lossy=lossy)
> File "/home/
> result = unbound(self, *args, **kwargs)
> File "/home/
> result = WorkingTree.
> File "/home/
> result = unbound(self, *args, **kwargs)
> File "/home/
> *args, **kwargs)
> File "/home/
> lossy=lossy)
> File "/home/
> self.cleanups, self.func, self, *args, **kwargs)
> File "/home/
> result = func(*args, **kwargs)
> File "/home/
> message = message_
> File "/home/
> raise errors.
> BzrCommandError: Empty commit message specified
>
> 43.787 errors:
> 'Committing to: /tmp/testbzr-
> ------------
> Text attachment: traceback
> ------------
> Traceback (most recent call last):
> File "/usr/lib/
> return fn(*args, **kwargs)
> File "/usr/lib/
> return self._get_
> File "/home/
> "commit tree/hello.txt", stdin="n\n")
> AssertionError: pattern "empty commit message" not found in
> """\
> Committing to: /tmp/testbzr-
> added hello.txt
> Commit message was not edited, use anyway? [y/n]: bzr: ERROR: Empty commit message specified
> """
>