Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 --fulltrace", 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
Original file line number Diff line number Diff line change
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 --fulltrace"
])
result.stdout.fnmatch_lines(['*KeyboardInterrupt*'])

def test_keyboard_in_sessionstart(self, testdir):
Expand Down