From ca5e8fd07e4526238516eed920bfbc6179b099df Mon Sep 17 00:00:00 2001 From: Valentin Rigal Date: Tue, 25 Jul 2023 10:37:29 +0200 Subject: [PATCH] Fix test for MySQL astral unicode replacement --- tests/log_parser/test_store_failure_lines.py | 24 ++++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/tests/log_parser/test_store_failure_lines.py b/tests/log_parser/test_store_failure_lines.py index 2ddfe98aa..3458b0387 100644 --- a/tests/log_parser/test_store_failure_lines.py +++ b/tests/log_parser/test_store_failure_lines.py @@ -99,13 +99,23 @@ def test_store_error_summary_astral(activate_responses, test_repository, test_jo assert failure.repository == test_repository - assert ( - failure.test - == u"toolkit/content/tests/widgets/test_videocontrols_video_direction.html " - ) - assert failure.subtest == u"Test timed out. " - assert failure.message == u"" - assert failure.stack.endswith("") + # Specific unicode chars cannot be inserted as MySQL pseudo-UTF8 and are replaced by a plain text representation + if settings.DATABASES['default']['ENGINE'] == 'django.db.backends.mysql': + assert ( + failure.test + == "toolkit/content/tests/widgets/test_videocontrols_video_direction.html " + ) + assert failure.subtest == "Test timed out. " + assert failure.message == "" + assert failure.stack.endswith("") + else: + assert ( + failure.test + == "toolkit/content/tests/widgets/test_videocontrols_video_direction.html 🍆" + ) + assert failure.subtest == "Test timed out. 𐂁" + assert failure.message == "󰅑" + assert failure.stack.endswith("󰅑") assert failure.stackwalk_stdout is None assert failure.stackwalk_stderr is None