Skip to content

Commit

Permalink
fix issue pytest-dev#1366 by showing a note on the --fulltrace option
Browse files Browse the repository at this point in the history
  • Loading branch information
RonnyPfannschmidt committed Feb 10, 2016
1 parent f00577f commit 9eac192
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
9 changes: 6 additions & 3 deletions CHANGELOG.rst
Expand Up @@ -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**

Expand Down Expand Up @@ -60,22 +62,23 @@
* 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
.. _#1226: https://github.com/pytest-dev/pytest/pull/1226
.. _#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
.. _@jaraco: https://github.com/jaraco
.. _@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
-----
Expand Down
1 change: 1 addition & 0 deletions _pytest/terminal.py
Expand Up @@ -391,6 +391,7 @@ def _report_keyboardinterrupt(self):
if self.config.option.fulltrace:
excrepr.toterminal(self._tw)
else:
self._tw.line("to show a full traceback on KeyboardInterrupt use --fulltace", yellow=True)
excrepr.reprcrash.toterminal(self._tw)

def _locationline(self, nodeid, fspath, lineno, domain):
Expand Down
4 changes: 4 additions & 0 deletions testing/test_terminal.py
Expand Up @@ -188,6 +188,10 @@ def test_interrupt_me():
result.stdout.fnmatch_lines([
"*raise KeyboardInterrupt # simulating the user*",
])
else:
result.stdout.fnmatch_lines([
"to show a full traceback on KeyboardInterrupt use --fulltace"
])
result.stdout.fnmatch_lines(['*KeyboardInterrupt*'])

def test_keyboard_in_sessionstart(self, testdir):
Expand Down

0 comments on commit 9eac192

Please sign in to comment.