Skip to content

Commit f0b221c

Browse files
fix issue #1366 by showing a note on the --fulltrace option
1 parent f00577f commit f0b221c

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

CHANGELOG.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
* New ``ALLOW_BYTES`` doctest option strips ``b`` prefixes from byte strings
1616
in doctest output (similar to ``ALLOW_UNICODE``).
1717
Thanks `@jaraco`_ for the request and `@nicoddemus`_ for the PR (`#1287`_).
18-
18+
* give a hint on KeyboardInterrupt to use the --fulltrace option to show the errors,
19+
this fixes `#1366`_.
20+
Thanks to `@hpk42`_ for the report and `@RonnyPfannschmidt`_ for the PR.
1921

2022
**Changes**
2123

@@ -60,22 +62,23 @@
6062
* Fix (`#1290`_): support Python 3.5's `@` operator in assertion rewriting.
6163
Thanks `@Shinkenjoe`_ for report with test case and `@tomviner`_ for the PR.
6264

63-
65+
.. _#1366: https://github.com/pytest-dev/pytest/issues/1366
6466
.. _#1040: https://github.com/pytest-dev/pytest/pull/1040
6567
.. _#680: https://github.com/pytest-dev/pytest/issues/680
6668
.. _#1287: https://github.com/pytest-dev/pytest/pull/1287
6769
.. _#1226: https://github.com/pytest-dev/pytest/pull/1226
6870
.. _#1290: https://github.com/pytest-dev/pytest/pull/1290
6971
.. _@MichaelAquilina: https://github.com/MichaelAquilina
7072
.. _@bukzor: https://github.com/bukzor
73+
.. _@hpk42: https://github.com/hpk42
7174
.. _@nicoddemus: https://github.com/nicoddemus
7275
.. _@jab: https://github.com/jab
7376
.. _@codewarrior0: https://github.com/codewarrior0
7477
.. _@jaraco: https://github.com/jaraco
7578
.. _@The-Compiler: https://github.com/The-Compiler
7679
.. _@Shinkenjoe: https://github.com/Shinkenjoe
7780
.. _@tomviner: https://github.com/tomviner
78-
81+
.. _@RonnyPfannschmidt: https://github.com/RonnyPfannschmidt
7982

8083
2.8.7
8184
-----

_pytest/terminal.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ def _report_keyboardinterrupt(self):
391391
if self.config.option.fulltrace:
392392
excrepr.toterminal(self._tw)
393393
else:
394+
self._tw.line("to show a full traceback on KeyboardInterrupt use --fulltace", yellow=True)
394395
excrepr.reprcrash.toterminal(self._tw)
395396

396397
def _locationline(self, nodeid, fspath, lineno, domain):

testing/test_terminal.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ def test_interrupt_me():
188188
result.stdout.fnmatch_lines([
189189
"*raise KeyboardInterrupt # simulating the user*",
190190
])
191+
else:
192+
result.stdout.fnmatch_lines([
193+
"to show a full traceback on KeyboardInterrupt use --fulltace"
194+
])
191195
result.stdout.fnmatch_lines(['*KeyboardInterrupt*'])
192196

193197
def test_keyboard_in_sessionstart(self, testdir):

0 commit comments

Comments
 (0)