From 8ea3346a9dc7fed882769b1644b53ca27cce02f2 Mon Sep 17 00:00:00 2001 From: Dave Page Date: Tue, 16 May 2023 04:50:01 +0100 Subject: [PATCH] Handle SQL_ASCII databases when running test cases. * Handle cases when psycopg returns bytes instead of a string. See https://github.com/psycopg/psycopg/issues/561 * A more appropriate fix, suggested by Daniele Varrazzo * Fix typo. * Re-think this check. Our own driver effectively monkey-patches the psycopg encoding mappings. --- web/regression/python_test_utils/test_utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/regression/python_test_utils/test_utils.py b/web/regression/python_test_utils/test_utils.py index 99b9c7f3d..dcb286e6f 100644 --- a/web/regression/python_test_utils/test_utils.py +++ b/web/regression/python_test_utils/test_utils.py @@ -1186,6 +1186,10 @@ def get_server_type(server): if isinstance(version_string, tuple): version_string = version_string[0] + # Handle SQL_ASCII (https://github.com/psycopg/psycopg/issues/561) + version_string = version_string.decode() if \ + hasattr(version_string, 'decode') else version_string + if "EnterpriseDB" in version_string: return 'ppas'