diff --git a/uaclient/tests/test_cli.py b/uaclient/tests/test_cli.py index bc81b2fd85..bab063c5d1 100644 --- a/uaclient/tests/test_cli.py +++ b/uaclient/tests/test_cli.py @@ -289,6 +289,14 @@ def test_user_facing_error_handled_gracefully( assert "" == out assert "{}\n".format(expected_msg) == err error_log = caplog_text() + # pytest 4.6.x started indenting trailing lines in log messages, which + # meant that our matching here stopped working once we introduced + # newlines into this log output in #973. (If focal moves onto pytest + # 5.x before release, then we can remove this workaround.) The + # upstream issue is https://github.com/pytest-dev/pytest/issues/5515 + error_log = "\n".join( + [line.strip() for line in error_log.splitlines()] + ) assert expected_msg in error_log assert "Traceback (most recent call last):" in error_log