diff options
author | Christophe CHAUVET <christophe.chauvet@gmail.com> | 2013-08-29 07:23:41 +0200 |
---|---|---|
committer | Christophe CHAUVET <christophe.chauvet@gmail.com> | 2013-08-29 07:23:41 +0200 |
commit | 5ba14adc41615e89020d2059b1e22c29e6220e25 (patch) | |
tree | dec1550c1a5cd90272a379b07b7306f69f0cfee1 /cliff | |
parent | e07f0bba1825e440a1ebe1cea03182225bcb8e08 (diff) | |
download | cliff-5ba14adc41615e89020d2059b1e22c29e6220e25.tar.gz |
Re-raise Exception on debug mode
Diffstat (limited to 'cliff')
-rw-r--r-- | cliff/app.py | 2 | ||||
-rw-r--r-- | cliff/tests/test_app.py | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/cliff/app.py b/cliff/app.py index 8a59b71..39ccbdd 100644 --- a/cliff/app.py +++ b/cliff/app.py @@ -261,7 +261,7 @@ class App(object): subcommand = self.command_manager.find_command(argv) except ValueError as err: if self.options.debug: - LOG.exception(err) + raise else: LOG.error(err) return 2 diff --git a/cliff/tests/test_app.py b/cliff/tests/test_app.py index a879ccd..e3bc12e 100644 --- a/cliff/tests/test_app.py +++ b/cliff/tests/test_app.py @@ -379,3 +379,11 @@ def test_error_encoding_sys(): def test_unknown_cmd(): app, command = make_app() assert app.run(['hell']) == 2 + + +def test_unknown_cmd_debug(): + app, command = make_app() + try: + app.run(['--debug', 'hell']) == 2 + except ValueError as err: + assert "['hell']" in ('%s' % err) |