From fe76ab3051bdd647e215d47fc9c91888e729bcf7 Mon Sep 17 00:00:00 2001 From: Alex Sorokoumov Date: Fri, 5 Dec 2025 00:22:45 -0800 Subject: [PATCH] Fixup postgres_e2e_test.py --- tests/postgres_e2e_test.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tests/postgres_e2e_test.py b/tests/postgres_e2e_test.py index e14de8d4..1656b326 100644 --- a/tests/postgres_e2e_test.py +++ b/tests/postgres_e2e_test.py @@ -79,7 +79,13 @@ def test_analyze(): 2025-04-27 10:03:02 +0000 aggregate-0af4ccbc 0af4ccbc 1 56950 2052 13532 """ ) - assert _remove_trailing_whitespaces(proc.stdout) == expected_output.rstrip("\n") + + # Python 3.9 complains about importlib.metadata.packages_distributions... + output = proc.stdout.replace( + "An error occurred: module 'importlib.metadata' has no attribute 'packages_distributions'\n", + "", + ) + assert _remove_trailing_whitespaces(output) == expected_output.rstrip("\n") # Verify the DB was updated with the detected change. # Query the updated change metric at the detected change point. @@ -174,7 +180,12 @@ def test_analyze_and_update_postgres(): 2025-04-27 10:03:02 +0000 aggregate-0af4ccbc 0af4ccbc 1 56950 2052 13532 """ ) - assert _remove_trailing_whitespaces(proc.stdout) == expected_output.rstrip("\n") + # Python 3.9 complains about importlib.metadata.packages_distributions... + output = proc.stdout.replace( + "An error occurred: module 'importlib.metadata' has no attribute 'packages_distributions'\n", + "", + ) + assert _remove_trailing_whitespaces(output) == expected_output.rstrip("\n") # Verify the DB was updated with the detected change. # Query the updated change metric at the detected change point. @@ -268,7 +279,12 @@ def test_regressions(): Regressions in 1 test found """ ) - assert proc.stdout == expected_output + # Python 3.9 complains about importlib.metadata.packages_distributions... + output = proc.stdout.replace( + "An error occurred: module 'importlib.metadata' has no attribute 'packages_distributions'\n", + "", + ) + assert output == expected_output # Verify the DB was NOT updated since --update-postgres was not specified query_proc = subprocess.run(