change separator to hyphen

This commit is contained in:
Daniel Hahler 2019-04-05 12:17:08 +02:00
parent 37ecca3ba9
commit 159704421e
3 changed files with 17 additions and 21 deletions

View File

@ -210,11 +210,8 @@ def _get_line_with_reprcrash_message(config, rep, termwidth):
pos = _get_pos(config, rep) pos = _get_pos(config, rep)
line = "%s %s" % (verbose_word, pos) line = "%s %s" % (verbose_word, pos)
len_line = len(line) len_line = len(line)
ellipsis = "..." ellipsis, len_ellipsis = "...", 3
len_ellipsis = len(ellipsis)
if len_line > termwidth - len_ellipsis: if len_line > termwidth - len_ellipsis:
# No space for an additional message. # No space for an additional message.
return line return line
@ -230,12 +227,11 @@ def _get_line_with_reprcrash_message(config, rep, termwidth):
msg = msg[:i] msg = msg[:i]
len_msg = len(msg) len_msg = len(msg)
sep = ": " sep, len_sep = " - ", 3
len_sep = len(sep) max_len_msg = termwidth - len_line - len_sep
max_len = termwidth - len_line - len_sep if max_len_msg >= len_ellipsis:
if max_len >= len_ellipsis: if len_msg > max_len_msg:
if len_msg > max_len: msg = msg[: (max_len_msg - len_ellipsis)] + ellipsis
msg = msg[: (max_len - len_ellipsis)] + ellipsis
line += sep + msg line += sep + msg
return line return line

View File

@ -1208,7 +1208,7 @@ def test_summary_list_after_errors(testdir):
[ [
"=* FAILURES *=", "=* FAILURES *=",
"*= short test summary info =*", "*= short test summary info =*",
"FAILED test_summary_list_after_errors.py::test_fail: assert 0", "FAILED test_summary_list_after_errors.py::test_fail - assert 0",
] ]
) )
@ -1240,18 +1240,18 @@ def test_line_with_reprcrash(monkeypatch):
class reprcrash: class reprcrash:
message = "msg" message = "msg"
assert f(config, rep, 80) == "FAILED some::nodeid: msg" assert f(config, rep, 80) == "FAILED some::nodeid - msg"
assert f(config, rep, 3) == "FAILED some::nodeid" assert f(config, rep, 3) == "FAILED some::nodeid"
assert f(config, rep, 23) == "FAILED some::nodeid" assert f(config, rep, 24) == "FAILED some::nodeid"
assert f(config, rep, 24) == "FAILED some::nodeid: msg" assert f(config, rep, 25) == "FAILED some::nodeid - msg"
rep.longrepr.reprcrash.message = "some longer message" rep.longrepr.reprcrash.message = "some longer message"
assert f(config, rep, 23) == "FAILED some::nodeid" assert f(config, rep, 24) == "FAILED some::nodeid"
assert f(config, rep, 24) == "FAILED some::nodeid: ..." assert f(config, rep, 25) == "FAILED some::nodeid - ..."
assert f(config, rep, 25) == "FAILED some::nodeid: s..." assert f(config, rep, 26) == "FAILED some::nodeid - s..."
rep.longrepr.reprcrash.message = "some\nmessage" rep.longrepr.reprcrash.message = "some\nmessage"
assert f(config, rep, 24) == "FAILED some::nodeid: ..." assert f(config, rep, 25) == "FAILED some::nodeid - ..."
assert f(config, rep, 25) == "FAILED some::nodeid: some" assert f(config, rep, 26) == "FAILED some::nodeid - some"
assert f(config, rep, 80) == "FAILED some::nodeid: some" assert f(config, rep, 80) == "FAILED some::nodeid - some"

View File

@ -735,7 +735,7 @@ def test_fail_extra_reporting(testdir, monkeypatch):
result.stdout.fnmatch_lines( result.stdout.fnmatch_lines(
[ [
"*test summary*", "*test summary*",
"FAILED test_fail_extra_reporting.py::test_this: AssertionError: this_failedth...", "FAILED test_fail_extra_reporting.py::test_this - AssertionError: this_failedt...",
] ]
) )