From 7ce03f3bea7dd92a5eed31d0485db700a95f8625 Mon Sep 17 00:00:00 2001 From: Khushboo Vashi Date: Mon, 27 Mar 2023 11:38:57 +0530 Subject: [PATCH] Fix UUID datatype typecast issue. --- web/pgadmin/utils/driver/psycopg3/typecast.py | 15 ++++----------- web/regression/feature_utils/base_feature_test.py | 7 ++----- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/web/pgadmin/utils/driver/psycopg3/typecast.py b/web/pgadmin/utils/driver/psycopg3/typecast.py index 03be07169..3adcbe49b 100644 --- a/web/pgadmin/utils/driver/psycopg3/typecast.py +++ b/web/pgadmin/utils/driver/psycopg3/typecast.py @@ -106,9 +106,9 @@ ALL_JSON_TYPES = PSYCOPG_SUPPORTED_JSON_TYPES +\ # OID reference psycopg/lib/_ipaddress.py PSYCOPG_SUPPORTED_IPADDRESS_ARRAY_TYPES = (1041, 651) -# uuid[] +# uuid[], uuid # OID reference psycopg/lib/extras.py -PSYCOPG_SUPPORTED_IPADDRESS_ARRAY_TYPES = (2951,) +PSYCOPG_SUPPORTED_IPADDRESS_ARRAY_TYPES = (2951, 2950) # int4range, int8range, numrange, daterange tsrange, tstzrange[] # OID reference psycopg/lib/_range.py @@ -132,15 +132,8 @@ def register_global_typecasters(): psycopg.adapters.register_loader(typ, TextLoaderpgAdmin) - # - # # define type caster to convert pg array types of above types into - # # array of string type - # pg_array_types_to_array_of_string_type = \ - # psycopg.extensions.new_array_type( - # TO_ARRAY_OF_STRING_DATATYPES, - # 'TYPECAST_TO_ARRAY_OF_STRING', pg_types_to_string_type - # ) - + # Define type caster to convert pg array types of above types into + # array of string type for typ in TO_ARRAY_OF_STRING_DATATYPES: psycopg.adapters.register_loader(typ, TextLoaderpgAdmin) diff --git a/web/regression/feature_utils/base_feature_test.py b/web/regression/feature_utils/base_feature_test.py index 21c981ceb..e2c479224 100644 --- a/web/regression/feature_utils/base_feature_test.py +++ b/web/regression/feature_utils/base_feature_test.py @@ -62,18 +62,15 @@ class BaseFeatureTest(BaseTestGenerator): pass def tearDown(self): - python2_failures = hasattr( - self, "_resultForDoCleanups") and self.current_test_failed() - python3_failures = hasattr(self, '_outcome') and self.any_step_failed() - if python2_failures or python3_failures: + if python3_failures: self._screenshot() self.after() def any_step_failed(self): - for step in self._outcome.errors: + for step in self._outcome.result.errors: if step[1] is not None: return True return False