Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/azure/cli/tests/test_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,18 @@ def test_handler(args):
config.get_command_table = lambda: cmd_table
app = Application(config)

# there is an argparse bug on <2.7.10 where SystemExit is not thrown on missing required param
# work around an argparse behavior where output is not printed and SystemExit
# is not raised on Python 2.7.9
if sys.version_info < (2, 7, 10):
app.execute('n1 -fb a --foobar value'.split())
app.execute('n1 -fb a --foobar2 value --foobar3 extra'.split())
try:
app.execute('n1 -fb a --foobar value'.split())
except SystemExit:
pass

try:
app.execute('n1 -fb a --foobar2 value --foobar3 extra'.split())
except SystemExit:
pass
else:
with self.assertRaises(SystemExit):
app.execute('n1 -fb a --foobar value'.split())
Expand Down