From d93406fdcea3caa3dd82326c010677a4799cb4bc Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Mon, 28 Oct 2024 09:59:03 +0100 Subject: [PATCH] Better diagnostics in tests in case text not found in response (#43428) The assertions during tests checkign if content was in response, did not print the content of the response, which made it difficult to diagnose what was wrong with the response. Adding response in case of failure should help to investigate issues in CI where those asserts fail. --- tests_common/test_utils/www.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests_common/test_utils/www.py b/tests_common/test_utils/www.py index 0a19c312fba4e..e9489fcb9ef99 100644 --- a/tests_common/test_utils/www.py +++ b/tests_common/test_utils/www.py @@ -52,9 +52,9 @@ def check_content_in_response(text, resp, resp_code=200): assert resp_code == resp.status_code if isinstance(text, list): for line in text: - assert line in resp_html, f"Couldn't find {line!r}" + assert line in resp_html, f"Couldn't find {line!r}\nThe response was:\n{resp_html!r}" else: - assert text in resp_html, f"Couldn't find {text!r}" + assert text in resp_html, f"Couldn't find {text!r}\nThe response was:\n{resp_html!r}" def check_content_not_in_response(text, resp, resp_code=200):