Rev 4961: Fix brittle test. in file:///home/vila/src/bzr/cleanup/various/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Thu Jan 14 16:37:02 GMT 2010
At file:///home/vila/src/bzr/cleanup/various/
------------------------------------------------------------
revno: 4961
revision-id: v.ladeuil+lp at free.fr-20100114163702-ggjle6fe8kvp1cik
parent: pqm at pqm.ubuntu.com-20100114003343-62hs2asyy61hsww1
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: various
timestamp: Thu 2010-01-14 17:37:02 +0100
message:
Fix brittle test.
* bzrlib/tests/blackbox/test_help.py:
(TestHelp.test_hidden): This test fail when bzr-rewrite is
installed because the help mentions 'commits'.
-------------- next part --------------
=== modified file 'bzrlib/tests/blackbox/test_help.py'
--- a/bzrlib/tests/blackbox/test_help.py 2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/blackbox/test_help.py 2010-01-14 16:37:02 +0000
@@ -105,8 +105,24 @@
self.assertEquals(dash_help, qmark_cmds)
def test_hidden(self):
- commands = self.run_bzr('help commands')[0]
- hidden = self.run_bzr('help hidden-commands')[0]
+ help_commands = self.run_bzr('help commands')[0]
+ help_hidden = self.run_bzr('help hidden-commands')[0]
+
+ def extract_cmd_names(help_output):
+ # keep only the command names to avoid matching on help text (there
+ # is a high risk to fail a test when a plugin get installed
+ # otherwise)
+ cmds = []
+ for line in help_output.split('\n'):
+ if line.startswith(' '):
+ continue # help on more than one line
+ cmd = line.split(' ')[0]
+ if line:
+ cmds.append(cmd)
+ return cmds
+ commands = extract_cmd_names(help_commands)
+ hidden = extract_cmd_names(help_hidden)
+ import pdb; pdb.set_trace()
self.assertTrue('commit' in commands)
self.assertTrue('commit' not in hidden)
self.assertTrue('rocks' in hidden)
More information about the bazaar-commits
mailing list