Changeset: 3b80a59fda09 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3b80a59fda09
Modified Files:
sql/test/2026/Tests/autocommit-after-failed-transaction.SQL.py
Branch: default
Log Message:
Make test autocommit-after-failed-transaction conditional on pymonetdb version
This test verifies that mserver provides enough information so pymonetdb
can accurately track the current auto commit mode.
Only recent versions of pymonetdb even try to track the mode.
On versions that don't, this test will always fail.
diffs (35 lines):
diff --git a/sql/test/2026/Tests/autocommit-after-failed-transaction.SQL.py
b/sql/test/2026/Tests/autocommit-after-failed-transaction.SQL.py
--- a/sql/test/2026/Tests/autocommit-after-failed-transaction.SQL.py
+++ b/sql/test/2026/Tests/autocommit-after-failed-transaction.SQL.py
@@ -1,7 +1,22 @@
from os import environ
-import sys
+import re, sys
+
+# import these before importing tpymonetdb as pymonetdb
+from pymonetdb import __version__ as pymonetdb_version
+from pymonetdb import __file__ as pymonetdb_location
+
from MonetDBtesting import tpymonetdb as pymonetdb
+# Only recent pymonetdb's track autocommit status
+print(f'# pymonetdb version: {pymonetdb_version} {pymonetdb_location}',
file=sys.stderr)
+pymonetdb_version_components = [
+ (int(component) if all(ch.isdigit() for ch in component) else component)
+ for component in re.findall(r'\d+|[a-zA-Z]+\d*',pymonetdb_version)
+]
+if pymonetdb_version_components < [1, 9, 1]:
+ print(f"# -> old version of pymonetdb which doesn't track autocommit",
file=sys.stderr)
+ sys.exit(0)
+
conn = pymonetdb.connect(database=environ['TSTDB'], port=environ['MAPIPORT'],
autocommit=True)
cursor = conn.cursor()
@@ -34,6 +49,7 @@ execute("SELECT 42", True)
execute("START TRANSACTION", False)
execute("COMMIT", True)
+# test auto commit mode is tracked correctly
execute("START TRANSACTION", False)
execute("SELECT SELECT FROM SELECT WHERE SELECT = SELECT", False,
expected_exception='syntax error')
execute("COMMIT", True, expected_exception='will ROLLBACK')
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]