fix issue #1366 by showing a note on the --fulltrace option

This commit is contained in:
Ronny Pfannschmidt 2016-02-10 19:54:10 +01:00
parent f00577f7c4
commit bfa2fadac1
3 changed files with 11 additions and 3 deletions

View File

@ -15,7 +15,9 @@
* New ``ALLOW_BYTES`` doctest option strips ``b`` prefixes from byte strings * New ``ALLOW_BYTES`` doctest option strips ``b`` prefixes from byte strings
in doctest output (similar to ``ALLOW_UNICODE``). in doctest output (similar to ``ALLOW_UNICODE``).
Thanks `@jaraco`_ for the request and `@nicoddemus`_ for the PR (`#1287`_). 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** **Changes**
@ -60,7 +62,7 @@
* Fix (`#1290`_): support Python 3.5's `@` operator in assertion rewriting. * Fix (`#1290`_): support Python 3.5's `@` operator in assertion rewriting.
Thanks `@Shinkenjoe`_ for report with test case and `@tomviner`_ for the PR. 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 .. _#1040: https://github.com/pytest-dev/pytest/pull/1040
.. _#680: https://github.com/pytest-dev/pytest/issues/680 .. _#680: https://github.com/pytest-dev/pytest/issues/680
.. _#1287: https://github.com/pytest-dev/pytest/pull/1287 .. _#1287: https://github.com/pytest-dev/pytest/pull/1287
@ -68,6 +70,7 @@
.. _#1290: https://github.com/pytest-dev/pytest/pull/1290 .. _#1290: https://github.com/pytest-dev/pytest/pull/1290
.. _@MichaelAquilina: https://github.com/MichaelAquilina .. _@MichaelAquilina: https://github.com/MichaelAquilina
.. _@bukzor: https://github.com/bukzor .. _@bukzor: https://github.com/bukzor
.. _@hpk42: https://github.com/hpk42
.. _@nicoddemus: https://github.com/nicoddemus .. _@nicoddemus: https://github.com/nicoddemus
.. _@jab: https://github.com/jab .. _@jab: https://github.com/jab
.. _@codewarrior0: https://github.com/codewarrior0 .. _@codewarrior0: https://github.com/codewarrior0
@ -75,7 +78,7 @@
.. _@The-Compiler: https://github.com/The-Compiler .. _@The-Compiler: https://github.com/The-Compiler
.. _@Shinkenjoe: https://github.com/Shinkenjoe .. _@Shinkenjoe: https://github.com/Shinkenjoe
.. _@tomviner: https://github.com/tomviner .. _@tomviner: https://github.com/tomviner
.. _@RonnyPfannschmidt: https://github.com/RonnyPfannschmidt
2.8.7 2.8.7
----- -----

View File

@ -391,6 +391,7 @@ class TerminalReporter:
if self.config.option.fulltrace: if self.config.option.fulltrace:
excrepr.toterminal(self._tw) excrepr.toterminal(self._tw)
else: else:
self._tw.line("to show a full traceback on KeyboardInterrupt use --fulltrace", yellow=True)
excrepr.reprcrash.toterminal(self._tw) excrepr.reprcrash.toterminal(self._tw)
def _locationline(self, nodeid, fspath, lineno, domain): def _locationline(self, nodeid, fspath, lineno, domain):

View File

@ -188,6 +188,10 @@ class TestTerminal:
result.stdout.fnmatch_lines([ result.stdout.fnmatch_lines([
"*raise KeyboardInterrupt # simulating the user*", "*raise KeyboardInterrupt # simulating the user*",
]) ])
else:
result.stdout.fnmatch_lines([
"to show a full traceback on KeyboardInterrupt use --fulltrace"
])
result.stdout.fnmatch_lines(['*KeyboardInterrupt*']) result.stdout.fnmatch_lines(['*KeyboardInterrupt*'])
def test_keyboard_in_sessionstart(self, testdir): def test_keyboard_in_sessionstart(self, testdir):