summaryrefslogtreecommitdiff
path: root/testing/test_skipping.py
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-04-17 15:30:34 +0200
committerDaniel Hahler <git@thequod.de>2019-04-17 15:30:34 +0200
commitc3178a176dda482f912da4d5c99c9396e7a8e9db (patch)
tree65065d097e5e5a7ae18c011ca769d725b3458132 /testing/test_skipping.py
parentdf1d1105b0f2b7aaccd124f431a3a6660b005a78 (diff)
downloadpytest-c3178a176dda482f912da4d5c99c9396e7a8e9db.tar.gz
move test
Diffstat (limited to 'testing/test_skipping.py')
-rw-r--r--testing/test_skipping.py72
1 files changed, 0 insertions, 72 deletions
diff --git a/testing/test_skipping.py b/testing/test_skipping.py
index 4782e7065..fb0822f8f 100644
--- a/testing/test_skipping.py
+++ b/testing/test_skipping.py
@@ -1177,75 +1177,3 @@ def test_summary_list_after_errors(testdir):
"FAILED test_summary_list_after_errors.py::test_fail - assert 0",
]
)
-
-
-def test_line_with_reprcrash(monkeypatch):
- import _pytest.skipping
- from _pytest.skipping import _get_line_with_reprcrash_message
- from wcwidth import wcswidth
-
- mocked_verbose_word = "FAILED"
-
- def mock_get_report_str(*args):
- return mocked_verbose_word
-
- monkeypatch.setattr(_pytest.skipping, "_get_report_str", mock_get_report_str)
-
- mocked_pos = "some::nodeid"
-
- def mock_get_pos(*args):
- return mocked_pos
-
- monkeypatch.setattr(_pytest.skipping, "_get_pos", mock_get_pos)
-
- class config:
- pass
-
- class rep:
- class longrepr:
- class reprcrash:
- pass
-
- def check(msg, width, expected):
- __tracebackhide__ = True
- if msg:
- rep.longrepr.reprcrash.message = msg
- actual = _get_line_with_reprcrash_message(config, rep, width)
-
- assert actual == expected
- if actual != "%s %s" % (mocked_verbose_word, mocked_pos):
- assert len(actual) <= width
- assert wcswidth(actual) <= width
-
- # AttributeError with message
- check(None, 80, "FAILED some::nodeid")
-
- check("msg", 80, "FAILED some::nodeid - msg")
- check("msg", 3, "FAILED some::nodeid")
-
- check("msg", 24, "FAILED some::nodeid")
- check("msg", 25, "FAILED some::nodeid - msg")
-
- check("some longer msg", 24, "FAILED some::nodeid")
- check("some longer msg", 25, "FAILED some::nodeid - ...")
- check("some longer msg", 26, "FAILED some::nodeid - s...")
-
- check("some\nmessage", 25, "FAILED some::nodeid - ...")
- check("some\nmessage", 26, "FAILED some::nodeid - some")
- check("some\nmessage", 80, "FAILED some::nodeid - some")
-
- # Test unicode safety.
- check(u"😄😄😄😄😄\n2nd line", 25, u"FAILED some::nodeid - ...")
- check(u"😄😄😄😄😄\n2nd line", 26, u"FAILED some::nodeid - ...")
- check(u"😄😄😄😄😄\n2nd line", 27, u"FAILED some::nodeid - 😄...")
- check(u"😄😄😄😄😄\n2nd line", 28, u"FAILED some::nodeid - 😄...")
- check(u"😄😄😄😄😄\n2nd line", 29, u"FAILED some::nodeid - 😄😄...")
-
- # NOTE: constructed, not sure if this is supported.
- # It would fail if not using u"" in Python 2 for mocked_pos.
- mocked_pos = u"nodeid::😄::withunicode"
- check(u"😄😄😄😄😄\n2nd line", 29, u"FAILED nodeid::😄::withunicode")
- check(u"😄😄😄😄😄\n2nd line", 40, u"FAILED nodeid::😄::withunicode - 😄😄...")
- check(u"😄😄😄😄😄\n2nd line", 41, u"FAILED nodeid::😄::withunicode - 😄😄...")
- check(u"😄😄😄😄😄\n2nd line", 42, u"FAILED nodeid::😄::withunicode - 😄😄😄...")
- check(u"😄😄😄😄😄\n2nd line", 80, u"FAILED nodeid::😄::withunicode - 😄😄😄😄😄")