Skip to content
Myr

fix exit_code for click.testing.CliRunner.invoke

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix #739

authored by timfeirg · committed by Markus Unterwaditzer · parent 7c82b77 · Browse files · 3 files+12 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+12 added−5 removed

  • other:+12 added−5 removed

3 files+12 added−5 removed

modified:click/testing.py+9 added-5 removed
194 unmodified lines
195 sys.stdout.flush()196 return char197198 default_color = color199200 def should_strip_ansi(stream=None, color=None):201 if color is None:202 return not default_color203 return not color
74 unmodified lines
278 try:279 cli.main(args=args or (),280 prog_name=self.get_default_prog_name(cli), **extra)281 except SystemExit as e:281 if e.code != 0:282 exception = e283282 exc_info = sys.exc_info()285283 exit_code = e.code284 if exit_code is None:285 exit_code = 0286287 if exit_code != 0:288 exception = e289290 if not isinstance(exit_code, int):291 sys.stdout.write(str(exit_code))292 sys.stdout.write('\n')293 exit_code = 1294295 except Exception as e:296 if not catch_exceptions:297 raise298 exception = e295 exit_code = -1299 exit_code = 1300 exc_info = sys.exc_info()301 finally:302 sys.stdout.flush()303 output = out.getvalue()
23 unmodified lines
modified:.gitignore+2 added
6 unmodified lines
7build8docs/_build9click.egg-info10.tox11.cache12.ropeproject
modified:CHANGES+1 added
8 unmodified lines
9(bugfix release; yet to be released)1011- Disabled sys._getframes() on Python interpreters that don't support it. See12 #728.13- Fix bug in test runner when calling ``sys.exit`` with ``None``. See #739.1415Version 6.716-----------17
343 unmodified lines