Changeset: aa753bd6b2f8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=aa753bd6b2f8
Modified Files:
sql/test/Users/Tests/table.SQL.py
Branch: mtest
Log Message:
WIP: convert tests for table
diffs (67 lines):
diff --git a/sql/test/Users/Tests/table.SQL.py
b/sql/test/Users/Tests/table.SQL.py
--- a/sql/test/Users/Tests/table.SQL.py
+++ b/sql/test/Users/Tests/table.SQL.py
@@ -2,28 +2,41 @@
# SET a GRANTed ROLE for a USER (possible).
# CREATE TABLE and INSERT (possible).
###
-
-import os, sys
-import pymonetdb
+from MonetDBtesting.sqltest import SQLTestCase
-db=os.getenv("TSTDB")
-port=int(os.getenv("MAPIPORT"))
-client = pymonetdb.connect(database=db, port=port, autocommit=True,
user='my_user', password='p1')
-cursor = client.cursor()
+with SQLTestCase() as tc:
+ tc.connect(username="my_user", password="p1")
+ tc.execute("SET ROLE my_role").assertSucceeded()
+ tc.execute("""
+ CREATE TABLE my_schema.my_table (
+ obsid INT NOT NULL AUTO_INCREMENT,
+ time_s BIGINT NULL,
+ time_e BIGINT NULL,
+ PRIMARY KEY (obsid)
+ ) """).assertSucceeded()
+ tc.execute("INSERT INTO my_schema.my_table (time_s) values
(300)").assertRowCount(1)
+
+# import os, sys
+# import pymonetdb
-# exceptions will output
-cursor.execute("SET ROLE my_role")
-cursor.execute("""
-CREATE TABLE my_schema.my_table (
- obsid INT NOT NULL AUTO_INCREMENT,
- time_s BIGINT NULL,
- time_e BIGINT NULL,
- PRIMARY KEY (obsid)
-) """)
-rowsaffected=cursor.execute("INSERT INTO my_schema.my_table (time_s) values
(300)")
-if rowsaffected != 1:
- print("affected rows should be 1, not %d\n" % rwosaffected)
- sys.exit(-1)
+# db=os.getenv("TSTDB")
+# port=int(os.getenv("MAPIPORT"))
+# client = pymonetdb.connect(database=db, port=port, autocommit=True,
user='my_user', password='p1')
+# cursor = client.cursor()
-cursor.close()
-client.close()
+# # exceptions will output
+# cursor.execute("SET ROLE my_role")
+# cursor.execute("""
+# CREATE TABLE my_schema.my_table (
+# obsid INT NOT NULL AUTO_INCREMENT,
+# time_s BIGINT NULL,
+# time_e BIGINT NULL,
+# PRIMARY KEY (obsid)
+# ) """)
+# rowsaffected=cursor.execute("INSERT INTO my_schema.my_table (time_s) values
(300)")
+# if rowsaffected != 1:
+# print("affected rows should be 1, not %d\n" % rwosaffected)
+# sys.exit(-1)
+
+# cursor.close()
+# client.close()
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list