Skip to content

Commit 0909618

Browse files
committed
SA14/Tests: Remove masking the resultproxy and fix setup of fake cursors
Beforehand, after observing errors like:: RuntimeError: number of values in row (1) differ from number of column processors (0) we decided to take the `resultproxy` out of the equation in order to work on the real gist of SQLAlchemy 1.4 compatibility. When looking at this again, it turned out that the root cause have been inaccuracies when setting up fake cursors within the test cases. SQLAlchemy <1.4 might have been more forgiving on that, but >=1.4 isn't.
1 parent bb70be8 commit 0909618

File tree

4 files changed

+4
-50
lines changed

4 files changed

+4
-50
lines changed

src/crate/client/sqlalchemy/dialect.py

-5
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@
2323
from datetime import datetime, date
2424
from distutils.version import LooseVersion
2525

26-
# FIXME: Workaround to be able to use SQLAlchemy 1.4.
27-
# Caveat: This purges the ``cresultproxy`` extension
28-
# at runtime, so it will impose a speed bump.
29-
import crate.client.sqlalchemy.monkey # noqa:F401, lgtm[py/unused-import]
30-
3126
from sqlalchemy import types as sqltypes
3227
from sqlalchemy.engine import default, reflection
3328
from sqlalchemy.sql import functions

src/crate/client/sqlalchemy/monkey.py

-44
This file was deleted.

src/crate/client/sqlalchemy/tests/dialect_test.py

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
from sqlalchemy.testing import eq_, in_
3535

3636
fake_cursor = MagicMock(name='fake_cursor')
37+
fake_cursor.description = (
38+
('foo', None, None, None, None, None, None),
39+
)
3740
FakeCursor = MagicMock(name='FakeCursor', spec=Cursor)
3841
FakeCursor.return_value = fake_cursor
3942

src/crate/client/sqlalchemy/tests/dict_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def test_assign_null_to_object_array(self):
139139
@patch('crate.client.connection.Cursor', FakeCursor)
140140
def test_assign_to_craty_type_after_commit(self):
141141
session, Character = self.set_up_character_and_cursor(
142-
return_value=[('Trillian', None, None)]
142+
return_value=[('Trillian', None)]
143143
)
144144
char = Character(name='Trillian')
145145
session.add(char)

0 commit comments

Comments
 (0)