From c30c137a9568571ac89f2c99658174f44eb19220 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 7 Jun 2018 01:18:51 +0200 Subject: [PATCH] Improve display of hint about --fulltrace with KeyboardInterrupt - display the location first - display hint about --fulltrace in parenthesis --- changelog/3545.trivial.rst | 1 + src/_pytest/terminal.py | 4 ++-- testing/test_terminal.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 changelog/3545.trivial.rst diff --git a/changelog/3545.trivial.rst b/changelog/3545.trivial.rst new file mode 100644 index 000000000..48f334eac --- /dev/null +++ b/changelog/3545.trivial.rst @@ -0,0 +1 @@ +Improve display of hint about --fulltrace with KeyboardInterrupt diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py index 94b416556..a985ab221 100644 --- a/src/_pytest/terminal.py +++ b/src/_pytest/terminal.py @@ -617,11 +617,11 @@ class TerminalReporter(object): if self.config.option.fulltrace: excrepr.toterminal(self._tw) else: + excrepr.reprcrash.toterminal(self._tw) self._tw.line( - "to show a full traceback on KeyboardInterrupt use --fulltrace", + "(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 7c9d8ccf7..68ce51d43 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -203,7 +203,7 @@ class TestTerminal(object): ) else: result.stdout.fnmatch_lines( - ["to show a full traceback on KeyboardInterrupt use --fulltrace"] + ["(to show a full traceback on KeyboardInterrupt use --fulltrace)"] ) result.stdout.fnmatch_lines(["*KeyboardInterrupt*"])