diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d36fd5e3c..132c2a2f6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -15,7 +15,9 @@ * New ``ALLOW_BYTES`` doctest option strips ``b`` prefixes from byte strings in doctest output (similar to ``ALLOW_UNICODE``). Thanks `@jaraco`_ for the request and `@nicoddemus`_ for the PR (`#1287`_). - +* give a hint on KeyboardInterrupt to use the --fulltrace option to show the errors, + this fixes `#1366`_. + Thanks to `@hpk42`_ for the report and `@RonnyPfannschmidt`_ for the PR. **Changes** @@ -60,7 +62,7 @@ * Fix (`#1290`_): support Python 3.5's `@` operator in assertion rewriting. Thanks `@Shinkenjoe`_ for report with test case and `@tomviner`_ for the PR. - +.. _#1366: https://github.com/pytest-dev/pytest/issues/1366 .. _#1040: https://github.com/pytest-dev/pytest/pull/1040 .. _#680: https://github.com/pytest-dev/pytest/issues/680 .. _#1287: https://github.com/pytest-dev/pytest/pull/1287 @@ -68,6 +70,7 @@ .. _#1290: https://github.com/pytest-dev/pytest/pull/1290 .. _@MichaelAquilina: https://github.com/MichaelAquilina .. _@bukzor: https://github.com/bukzor +.. _@hpk42: https://github.com/hpk42 .. _@nicoddemus: https://github.com/nicoddemus .. _@jab: https://github.com/jab .. _@codewarrior0: https://github.com/codewarrior0 @@ -75,7 +78,7 @@ .. _@The-Compiler: https://github.com/The-Compiler .. _@Shinkenjoe: https://github.com/Shinkenjoe .. _@tomviner: https://github.com/tomviner - +.. _@RonnyPfannschmidt: https://github.com/RonnyPfannschmidt 2.8.7 ----- diff --git a/_pytest/terminal.py b/_pytest/terminal.py index e362991aa..e17b8dda2 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -391,6 +391,7 @@ class TerminalReporter: if self.config.option.fulltrace: excrepr.toterminal(self._tw) else: + self._tw.line("to show a full traceback on KeyboardInterrupt use --fulltrace", yellow=True) excrepr.reprcrash.toterminal(self._tw) def _locationline(self, nodeid, fspath, lineno, domain): diff --git a/testing/test_terminal.py b/testing/test_terminal.py index a898d9553..df9cdc040 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -188,6 +188,10 @@ class TestTerminal: result.stdout.fnmatch_lines([ "*raise KeyboardInterrupt # simulating the user*", ]) + else: + result.stdout.fnmatch_lines([ + "to show a full traceback on KeyboardInterrupt use --fulltrace" + ]) result.stdout.fnmatch_lines(['*KeyboardInterrupt*']) def test_keyboard_in_sessionstart(self, testdir):