Skip to content

Commit

Permalink
Fix failing sqla compliance tests for ws dialect (#357)
Browse files Browse the repository at this point in the history
* Re enable test for issue #342
* Mark unsupported feature as xfail
* Convert Decimal type to float if decimal isn't enforced
* Update changelog
  • Loading branch information
Nicoretti authored Jul 17, 2023
1 parent 4b12ad0 commit 04b31c3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Unreleased
---------

- Fixed `prepared statements send the wrong types as parameters to the server <https://github.com/exasol/sqlalchemy-exasol/issues/341>`_
- Fixed `Various SQLA compliance tests are failing for the websocket based dialect <https://github.com/exasol/sqlalchemy-exasol/issues/342>`_

.. _changelog-4.5.1:

Expand Down
2 changes: 1 addition & 1 deletion sqlalchemy_exasol/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
25 changes: 5 additions & 20 deletions test/integration/sqlalchemy/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand All @@ -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)
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 04b31c3

Please sign in to comment.