From 04b31c3ae437e46369b83bb779115a263739a232 Mon Sep 17 00:00:00 2001 From: Nicola Coretti Date: Mon, 17 Jul 2023 11:03:13 +0200 Subject: [PATCH] Fix failing sqla compliance tests for ws dialect (#357) * Re enable test for issue #342 * Mark unsupported feature as xfail * Convert Decimal type to float if decimal isn't enforced * Update changelog --- CHANGELOG.rst | 1 + sqlalchemy_exasol/websocket.py | 2 +- test/integration/sqlalchemy/test_suite.py | 25 +++++------------------ 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 33238059..07fc7960 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -7,6 +7,7 @@ Unreleased --------- - Fixed `prepared statements send the wrong types as parameters to the server `_ +- Fixed `Various SQLA compliance tests are failing for the websocket based dialect `_ .. _changelog-4.5.1: diff --git a/sqlalchemy_exasol/websocket.py b/sqlalchemy_exasol/websocket.py index a1446fc4..0a19decf 100644 --- a/sqlalchemy_exasol/websocket.py +++ b/sqlalchemy_exasol/websocket.py @@ -30,7 +30,7 @@ def bind_processor(self, dialect): def result_processor(self, dialect, coltype): if not self.asdecimal: - return None + return lambda value: None if value is None else float(value) fstring = "%%.%df" % self._effective_decimal_return_scale diff --git a/test/integration/sqlalchemy/test_suite.py b/test/integration/sqlalchemy/test_suite.py index 31d48dc8..c9ace80e 100644 --- a/test/integration/sqlalchemy/test_suite.py +++ b/test/integration/sqlalchemy/test_suite.py @@ -23,11 +23,6 @@ LongNameBlowoutTest as _LongNameBlowoutTest, ) -ISSUE_342 = pytest.mark.xfail( - "websocket" in testing.db.dialect.driver, - reason="Not implemented yet see also https://github.com/exasol/sqlalchemy-exasol/issues/342", -) - class RowFetchTest(_RowFetchTest): RATIONAL = cleandoc( @@ -71,7 +66,6 @@ def test_has_table_view_schema(self, connection): class InsertBehaviorTest(_InsertBehaviorTest): - @ISSUE_342 @pytest.mark.xfail( "turbodbc" in testing.db.dialect.driver, reason=cleandoc( @@ -83,6 +77,11 @@ class InsertBehaviorTest(_InsertBehaviorTest): ), strict=True, ) + @pytest.mark.xfail( + "websocket" in testing.db.dialect.driver, + reason="This currently isn't supported by the websocket protocol L3-1064.", + strict=True, + ) @testing.requires.empty_inserts_executemany def test_empty_insert_multiple(self, connection): super().test_empty_insert_multiple(connection) @@ -285,25 +284,11 @@ class NumericTest(_NumericTest): EXASOL and pyodbc.""" ), ) - @ISSUE_342 @testing.requires.implicit_decimal_binds @testing.emits_warning(r".*does \*not\* support Decimal objects natively") def test_decimal_coerce_round_trip(self, connection): super().test_decimal_coerce_round_trip(connection) - @ISSUE_342 - @testing.emits_warning(r".*does \*not\* support Decimal objects natively") - def test_render_literal_numeric_asfloat(self, literal_round_trip): - super().test_render_literal_numeric_asfloat(literal_round_trip) - - @ISSUE_342 - def test_numeric_as_float(self, do_numeric_test): - super().test_numeric_as_float(do_numeric_test) - - @ISSUE_342 - def test_float_coerce_round_trip(self, connection): - super().test_float_coerce_round_trip(connection) - class QuotedNameArgumentTest(_QuotedNameArgumentTest): RATIONAL = cleandoc(