diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2023-03-10 21:06:28 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2023-03-10 21:06:28 +0000 |
| commit | e7aabd54c4defe237cecfa80863f0d7fa5a48035 (patch) | |
| tree | db8e99bb10de75c58067a685cac8000446bfe335 /test/sql | |
| parent | 7f4df1625ef06cbfda5ca2db34984fd576506fff (diff) | |
| parent | fd9aa847920b9e4dff61ef7a5555c9fa6e362484 (diff) | |
| download | sqlalchemy-e7aabd54c4defe237cecfa80863f0d7fa5a48035.tar.gz | |
Merge "Fix regression when deserializing python rows into cython" into main
Diffstat (limited to 'test/sql')
| -rw-r--r-- | test/sql/test_resultset.py | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/test/sql/test_resultset.py b/test/sql/test_resultset.py index 41bb81200..0537dc228 100644 --- a/test/sql/test_resultset.py +++ b/test/sql/test_resultset.py @@ -4,7 +4,11 @@ from contextlib import contextmanager import csv from io import StringIO import operator +import os import pickle +import subprocess +import sys +from tempfile import mkstemp from unittest.mock import Mock from unittest.mock import patch @@ -502,25 +506,25 @@ class CursorResultTest(fixtures.TablesTest): lambda: result[0]._mapping[addresses.c.address_id], ) - # @testing.variation("use_labels", [True, False]) - # def _dont_test_pickle_rows_other_process(self, connection, use_labels): - # result = self._pickle_row_data(connection, use_labels) - - # f, name = mkstemp("pkl") - # with os.fdopen(f, "wb") as f: - # pickle.dump(result, f) - # name = name.replace(os.sep, "/") - # code = ( - # "import sqlalchemy; import pickle; print([" - # f"r[0] for r in pickle.load(open('''{name}''', 'rb'))])" - # ) - # proc = subprocess.run( - # [sys.executable, "-c", code], stdout=subprocess.PIPE - # ) - # exp = str([r[0] for r in result]).encode() - # eq_(proc.returncode, 0) - # eq_(proc.stdout.strip(), exp) - # os.unlink(name) + @testing.variation("use_labels", [True, False]) + def test_pickle_rows_other_process(self, connection, use_labels): + result = self._pickle_row_data(connection, use_labels) + + f, name = mkstemp("pkl") + with os.fdopen(f, "wb") as f: + pickle.dump(result, f) + name = name.replace(os.sep, "/") + code = ( + "import sqlalchemy; import pickle; print([" + f"r[0] for r in pickle.load(open('''{name}''', 'rb'))])" + ) + proc = subprocess.run( + [sys.executable, "-c", code], stdout=subprocess.PIPE + ) + exp = str([r[0] for r in result]).encode() + eq_(proc.returncode, 0) + eq_(proc.stdout.strip(), exp) + os.unlink(name) def test_column_error_printing(self, connection): result = connection.execute(select(1)) |
