Merge lp:~vila/uci-vms/proper-prog into lp:uci-vms

Proposed by Vincent Ladeuil
Status: Merged
Merged at revision: 122
Proposed branch: lp:~vila/uci-vms/proper-prog
Merge into: lp:uci-vms
Diff against target: 57 lines (+12/-6)
3 files modified
NEWS.rst (+2/-0)
ucivms/commands.py (+7/-3)
ucivms/tests/test_commands.py (+3/-3)
To merge this branch: bzr merge lp:~vila/uci-vms/proper-prog
Reviewer Review Type Date Requested Status
Leo Arias (community) Approve
Snappy Tarmac (community) Approve
Review via email: mp+268773@code.launchpad.net

Commit message

Fix the script name in the help output.

Description of the change

Quick fix for a FIXME added while I restored py2 support: the script name is uci-vms2 for python3, the help messages should respect that.

To post a comment you must log in.
Revision history for this message
Snappy Tarmac (snappydevtarmac) wrote :

looks good.

review: Approve
Revision history for this message
Leo Arias (elopio) wrote :

oops, wrong user.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS.rst'
--- NEWS.rst 2015-08-13 08:31:23 +0000
+++ NEWS.rst 2015-08-21 15:47:39 +0000
@@ -7,6 +7,8 @@
7dev7dev
8===8===
99
10* Fix the script name in the help output.
11
10* Restore python2 support.12* Restore python2 support.
1113
12* Since timeouts are used in a 'try/sleep' loop, force the last value to be14* Since timeouts are used in a 'try/sleep' loop, force the last value to be
1315
=== modified file 'ucivms/commands.py'
--- ucivms/commands.py 2015-07-21 08:27:55 +0000
+++ ucivms/commands.py 2015-08-21 15:47:39 +0000
@@ -44,9 +44,13 @@
44 """A parser for the uci-vms script."""44 """A parser for the uci-vms script."""
4545
46 def __init__(self, name, description):46 def __init__(self, name, description):
47 # FIXME: uci-vms2 if running python2 ? -- vila 2015-07-2147 if sys.version_info < (3,):
48 super(ArgParser, self).__init__(prog='uci-vms {}'.format(name),48 script_name = 'uci-vms2'
49 description=description)49 else:
50 script_name = 'uci-vms'
51 super(ArgParser, self).__init__(
52 prog='{} {}'.format(script_name, name),
53 description=description)
5054
51 def parse_args(self, args=None, out=None, err=None):55 def parse_args(self, args=None, out=None, err=None):
52 """Parse arguments, overridding stdout/stderr if provided.56 """Parse arguments, overridding stdout/stderr if provided.
5357
=== modified file 'ucivms/tests/test_commands.py'
--- ucivms/tests/test_commands.py 2015-07-22 12:02:24 +0000
+++ ucivms/tests/test_commands.py 2015-08-21 15:47:39 +0000
@@ -92,7 +92,7 @@
9292
93 def test_help_help(self):93 def test_help_help(self):
94 self.assertHelp('''\94 self.assertHelp('''\
95usage: uci-vms help [-h] [COMMAND [COMMAND ...]]95usage: uci-vms... help [-h] [COMMAND [COMMAND ...]]
9696
97Describe uci-vms commands.97Describe uci-vms commands.
9898
@@ -241,8 +241,8 @@
241 self.parse_args(['foo', 'bar', 'baz'])241 self.parse_args(['foo', 'bar', 'baz'])
242 self.assertEqual(2, cm.exception.code)242 self.assertEqual(2, cm.exception.code)
243 self.assertError('''\243 self.assertError('''\
244usage: uci-vms config [-h] [--remove] [--all] vm_name [name]244usage: uci-vms... config [-h] [--remove] [--all] vm_name [name]
245uci-vms config: error: unrecognized arguments: baz245uci-vms... config: error: unrecognized arguments: baz
246''')246''')
247247
248 def test_remove_requires_name(self):248 def test_remove_requires_name(self):

Subscribers

People subscribed via source and target branches