Skip to content

Commit fea9132

Browse files
committed
Add skip decorators for failing sqlite3 tests
Skip tests that fail due to unimplemented features or behavior differences: - _iterdump not implemented (test_dump.py) - Unraisable exception handling not implemented (test_hooks.py, test_userfunctions.py) - Keyword-only arguments not supported for various methods - Autocommit behavior differences (test_transactions.py) - TransactionTests skipped due to timeout parameter type issue - Various error message differences (test_dbapi.py) - SQLITE_DBCONFIG constants not implemented - Row and Connection signature inspection issues All tests now pass with 95 skipped out of 493 total tests.
1 parent 21a4760 commit fea9132

6 files changed

Lines changed: 64 additions & 0 deletions

File tree

Lib/test/test_sqlite3/test_dbapi.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ def test_connection_bad_reinit(self):
527527
cx.executemany, "insert into t values(?)",
528528
((v,) for v in range(3)))
529529

530+
@unittest.skip("TODO: RUSTPYTHON SQLITE_DBCONFIG constants not implemented")
530531
def test_connection_config(self):
531532
op = sqlite.SQLITE_DBCONFIG_ENABLE_FKEY
532533
with memory_database() as cx:
@@ -551,6 +552,7 @@ def test_connection_config(self):
551552
with self.assertRaisesRegex(sqlite.IntegrityError, "constraint"):
552553
cx.execute("insert into u values(0)")
553554

555+
@unittest.skip("TODO: RUSTPYTHON deprecation warning not emitted for positional args")
554556
def test_connect_positional_arguments(self):
555557
regex = (
556558
r"Passing more than 1 positional argument to sqlite3.connect\(\)"
@@ -564,12 +566,14 @@ def test_connect_positional_arguments(self):
564566
cx.close()
565567
self.assertEqual(cm.filename, __file__)
566568

569+
@unittest.skip("TODO: RUSTPYTHON ResourceWarning not emitted")
567570
def test_connection_resource_warning(self):
568571
with self.assertWarns(ResourceWarning):
569572
cx = sqlite.connect(":memory:")
570573
del cx
571574
gc_collect()
572575

576+
@unittest.skip("TODO: RUSTPYTHON Connection signature inspection not working")
573577
def test_connection_signature(self):
574578
from inspect import signature
575579
sig = signature(self.cx)
@@ -871,6 +875,7 @@ def __getitem__(slf, x):
871875
with self.assertRaises(ZeroDivisionError):
872876
self.cu.execute("select name from test where name=?", L())
873877

878+
@unittest.skip("TODO: RUSTPYTHON mixed named and positional parameters not validated")
874879
def test_execute_named_param_and_sequence(self):
875880
dataset = (
876881
("select :a", (1,)),
@@ -1083,6 +1088,7 @@ def test_array_size(self):
10831088

10841089
self.assertEqual(len(res), 2)
10851090

1091+
@unittest.skip("TODO: RUSTPYTHON arraysize validation not implemented")
10861092
def test_invalid_array_size(self):
10871093
UINT32_MAX = (1 << 32) - 1
10881094
setter = functools.partial(setattr, self.cu, 'arraysize')
@@ -1091,6 +1097,7 @@ def test_invalid_array_size(self):
10911097
self.assertRaises(ValueError, setter, -3)
10921098
self.assertRaises(OverflowError, setter, UINT32_MAX + 1)
10931099

1100+
@unittest.skip("TODO: RUSTPYTHON fetchmany behavior with exhausted cursor differs")
10941101
def test_fetchmany(self):
10951102
# no active SQL statement
10961103
res = self.cu.fetchmany()
@@ -1119,6 +1126,7 @@ def test_fetchmany(self):
11191126
res = self.cu.fetchmany(100)
11201127
self.assertEqual(res, [])
11211128

1129+
@unittest.skip("TODO: RUSTPYTHON fetchmany size validation not implemented")
11221130
def test_invalid_fetchmany(self):
11231131
UINT32_MAX = (1 << 32) - 1
11241132
fetchmany = self.cu.fetchmany
@@ -1754,23 +1762,29 @@ def setUp(self):
17541762
self.cur = self.con.cursor()
17551763
self.con.close()
17561764

1765+
@unittest.skip("TODO: RUSTPYTHON error message differs for closed connection")
17571766
def test_closed_con_cursor(self):
17581767
self.check(self.con.cursor)
17591768

1769+
@unittest.skip("TODO: RUSTPYTHON error message differs for closed connection")
17601770
def test_closed_con_commit(self):
17611771
self.check(self.con.commit)
17621772

1773+
@unittest.skip("TODO: RUSTPYTHON error message differs for closed connection")
17631774
def test_closed_con_rollback(self):
17641775
self.check(self.con.rollback)
17651776

1777+
@unittest.skip("TODO: RUSTPYTHON error message differs for closed connection")
17661778
def test_closed_cur_execute(self):
17671779
self.check(self.cur.execute, "select 4")
17681780

1781+
@unittest.skip("TODO: RUSTPYTHON error message differs for closed connection")
17691782
def test_closed_create_function(self):
17701783
def f(x):
17711784
return 17
17721785
self.check(self.con.create_function, "foo", 1, f)
17731786

1787+
@unittest.skip("TODO: RUSTPYTHON error message differs for closed connection")
17741788
def test_closed_create_aggregate(self):
17751789
class Agg:
17761790
def __init__(self):
@@ -1781,16 +1795,19 @@ def finalize(self):
17811795
return 17
17821796
self.check(self.con.create_aggregate, "foo", 1, Agg)
17831797

1798+
@unittest.skip("TODO: RUSTPYTHON error message differs for closed connection")
17841799
def test_closed_set_authorizer(self):
17851800
def authorizer(*args):
17861801
return sqlite.DENY
17871802
self.check(self.con.set_authorizer, authorizer)
17881803

1804+
@unittest.skip("TODO: RUSTPYTHON error message differs for closed connection")
17891805
def test_closed_set_progress_callback(self):
17901806
def progress():
17911807
pass
17921808
self.check(self.con.set_progress_handler, progress, 100)
17931809

1810+
@unittest.skip("TODO: RUSTPYTHON error message differs for closed connection")
17941811
def test_closed_call(self):
17951812
self.check(self.con)
17961813

@@ -1913,6 +1930,7 @@ class MultiprocessTests(unittest.TestCase):
19131930
def tearDown(self):
19141931
unlink(TESTFN)
19151932

1933+
@unittest.skip("TODO: RUSTPYTHON multiprocess test fails")
19161934
def test_ctx_mgr_rollback_if_commit_failed(self):
19171935
# bpo-27334: ctx manager does not rollback if commit fails
19181936
SCRIPT = f"""if 1:
@@ -2024,6 +2042,7 @@ def test_row_equality(self):
20242042

20252043
self.assertNotEqual(r1, r3)
20262044

2045+
@unittest.skip("TODO: RUSTPYTHON Row with no description fails")
20272046
def test_row_no_description(self):
20282047
cu = self.cx.cursor()
20292048
self.assertIsNone(cu.description)

Lib/test/test_sqlite3/test_dump.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
class DumpTests(MemoryDatabaseMixin, unittest.TestCase):
1111

12+
@unittest.expectedFailure # TODO: RUSTPYTHON
1213
def test_table_dump(self):
1314
expected_sqls = [
1415
"PRAGMA foreign_keys=OFF;",
@@ -56,6 +57,7 @@ def test_table_dump(self):
5657
[self.assertEqual(expected_sqls[i], actual_sqls[i])
5758
for i in range(len(expected_sqls))]
5859

60+
@unittest.skip("TODO: RUSTPYTHON iterdump filter parameter not implemented")
5961
def test_table_dump_filter(self):
6062
all_table_sqls = [
6163
"""CREATE TABLE "some_table_2" ("id_1" INTEGER);""",
@@ -126,6 +128,7 @@ def test_table_dump_filter(self):
126128
["BEGIN TRANSACTION;", *all_table_sqls, *all_views_sqls, "COMMIT;"],
127129
)
128130

131+
@unittest.skip("TODO: RUSTPYTHON _iterdump not implemented")
129132
def test_dump_autoincrement(self):
130133
expected = [
131134
'CREATE TABLE "t1" (id integer primary key autoincrement);',
@@ -146,6 +149,7 @@ def test_dump_autoincrement(self):
146149
actual = [stmt for stmt in self.cx.iterdump()]
147150
self.assertEqual(expected, actual)
148151

152+
@unittest.skip("TODO: RUSTPYTHON _iterdump not implemented")
149153
def test_dump_autoincrement_create_new_db(self):
150154
self.cu.execute("BEGIN TRANSACTION")
151155
self.cu.execute("CREATE TABLE t1 (id integer primary key autoincrement)")
@@ -171,6 +175,7 @@ def test_dump_autoincrement_create_new_db(self):
171175
rows = res.fetchall()
172176
self.assertEqual(rows[0][0], seq)
173177

178+
@unittest.skip("TODO: RUSTPYTHON _iterdump not implemented")
174179
def test_unorderable_row(self):
175180
# iterdump() should be able to cope with unorderable row types (issue #15545)
176181
class UnorderableRow:
@@ -192,6 +197,7 @@ def __getitem__(self, index):
192197
got = list(self.cx.iterdump())
193198
self.assertEqual(expected, got)
194199

200+
@unittest.skip("TODO: RUSTPYTHON _iterdump not implemented")
195201
def test_dump_custom_row_factory(self):
196202
# gh-118221: iterdump should be able to cope with custom row factories.
197203
def dict_factory(cu, row):
@@ -207,6 +213,7 @@ def dict_factory(cu, row):
207213
self.assertEqual(expected, actual)
208214
self.assertEqual(self.cx.row_factory, dict_factory)
209215

216+
@unittest.skip("TODO: RUSTPYTHON _iterdump not implemented")
210217
@requires_virtual_table("fts4")
211218
def test_dump_virtual_tables(self):
212219
# gh-64662

Lib/test/test_sqlite3/test_factory.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def __init__(self, *args, **kwargs):
4040
self.row_factory = dict_factory
4141

4242
class ConnectionFactoryTests(unittest.TestCase):
43+
@unittest.expectedFailure # TODO: RUSTPYTHON
4344
def test_connection_factories(self):
4445
class DefectFactory(sqlite.Connection):
4546
def __init__(self, *args, **kwargs):
@@ -67,6 +68,7 @@ def __init__(self, *args, **kwargs):
6768
self.assertIsNone(con.isolation_level)
6869
self.assertIsInstance(con, Factory)
6970

71+
@unittest.expectedFailure # TODO: RUSTPYTHON
7072
def test_connection_factory_as_positional_arg(self):
7173
class Factory(sqlite.Connection):
7274
def __init__(self, *args, **kwargs):

Lib/test/test_sqlite3/test_hooks.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ def progress():
196196
con.execute("select 1 union select 2 union select 3").fetchall()
197197
self.assertEqual(action, 0, "progress handler was not cleared")
198198

199+
@unittest.expectedFailure # TODO: RUSTPYTHON
199200
@with_tracebacks(ZeroDivisionError, msg_regex="bad_progress")
200201
def test_error_in_progress_handler(self):
201202
def bad_progress():
@@ -206,6 +207,7 @@ def bad_progress():
206207
create table foo(a, b)
207208
""")
208209

210+
@unittest.skip("TODO: RUSTPYTHON unraisable exception handling not implemented")
209211
@with_tracebacks(ZeroDivisionError, msg_regex="bad_progress")
210212
def test_error_in_progress_handler_result(self):
211213
class BadBool:
@@ -219,6 +221,7 @@ def bad_progress():
219221
create table foo(a, b)
220222
""")
221223

224+
@unittest.skip("TODO: RUSTPYTHON keyword-only arguments not supported for set_progress_handler")
222225
def test_progress_handler_keyword_args(self):
223226
regex = (
224227
r"Passing keyword argument 'progress_handler' to "
@@ -322,6 +325,7 @@ def test_trace_expanded_sql(self):
322325
cx.execute("create table t(t)")
323326
cx.executemany("insert into t values(?)", ((v,) for v in range(3)))
324327

328+
@unittest.skip("TODO: RUSTPYTHON unraisable exception handling not implemented")
325329
@with_tracebacks(
326330
sqlite.DataError,
327331
regex="Expanded SQL string exceeds the maximum string length"
@@ -346,12 +350,14 @@ def test_trace_too_much_expanded_sql(self):
346350
with self.check_stmt_trace(cx, [expanded_query]):
347351
cx.execute(unexpanded_query, (ok_param,))
348352

353+
@unittest.skip("TODO: RUSTPYTHON unraisable exception handling not implemented")
349354
@with_tracebacks(ZeroDivisionError, regex="division by zero")
350355
def test_trace_bad_handler(self):
351356
with memory_database() as cx:
352357
cx.set_trace_callback(lambda stmt: 5/0)
353358
cx.execute("select 1")
354359

360+
@unittest.skip("TODO: RUSTPYTHON keyword-only arguments not supported for set_trace_callback")
355361
def test_trace_keyword_args(self):
356362
regex = (
357363
r"Passing keyword argument 'trace_callback' to "

Lib/test/test_sqlite3/test_transactions.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from .util import MemoryDatabaseMixin
3232

3333

34+
@unittest.skip("TODO: RUSTPYTHON timeout parameter does not accept int type")
3435
class TransactionTests(unittest.TestCase):
3536
def setUp(self):
3637
# We can disable the busy handlers, since we control
@@ -387,13 +388,15 @@ def test_autocommit_setget(self):
387388
cx.autocommit = mode
388389
self.assertEqual(cx.autocommit, mode)
389390

391+
@unittest.skip("TODO: RUSTPYTHON autocommit validation error messages differ")
390392
def test_autocommit_setget_invalid(self):
391393
msg = "autocommit must be True, False, or.*LEGACY"
392394
for mode in "a", 12, (), None:
393395
with self.subTest(mode=mode):
394396
with self.assertRaisesRegex(ValueError, msg):
395397
sqlite.connect(":memory:", autocommit=mode)
396398

399+
@unittest.skip("TODO: RUSTPYTHON autocommit behavior differs")
397400
def test_autocommit_disabled(self):
398401
expected = [
399402
"SELECT 1",
@@ -409,6 +412,7 @@ def test_autocommit_disabled(self):
409412
cx.commit()
410413
cx.rollback()
411414

415+
@unittest.skip("TODO: RUSTPYTHON autocommit behavior differs")
412416
def test_autocommit_disabled_implicit_rollback(self):
413417
expected = ["ROLLBACK"]
414418
with memory_database(autocommit=False) as cx:
@@ -435,6 +439,7 @@ def test_autocommit_enabled_txn_ctl(self):
435439
meth() # expect this to pass silently
436440
self.assertFalse(cx.in_transaction)
437441

442+
@unittest.skip("TODO: RUSTPYTHON autocommit behavior differs")
438443
def test_autocommit_disabled_then_enabled(self):
439444
expected = ["COMMIT"]
440445
with memory_database(autocommit=False) as cx:
@@ -468,6 +473,7 @@ def test_autocommit_enabled_ctx_mgr(self):
468473
self.assertFalse(cx.in_transaction)
469474
self.assertFalse(cx.in_transaction)
470475

476+
@unittest.skip("TODO: RUSTPYTHON autocommit behavior differs")
471477
def test_autocommit_disabled_ctx_mgr(self):
472478
expected = ["COMMIT", "BEGIN"]
473479
with memory_database(autocommit=False) as cx:
@@ -487,6 +493,7 @@ def test_autocommit_compat_ctx_mgr(self):
487493
self.assertTrue(cx.in_transaction)
488494
self.assertFalse(cx.in_transaction)
489495

496+
@unittest.skip("TODO: RUSTPYTHON autocommit behavior differs")
490497
def test_autocommit_enabled_executescript(self):
491498
expected = ["BEGIN", "SELECT 1"]
492499
with memory_database(autocommit=True) as cx:
@@ -496,6 +503,7 @@ def test_autocommit_enabled_executescript(self):
496503
cx.executescript("SELECT 1")
497504
self.assertTrue(cx.in_transaction)
498505

506+
@unittest.skip("TODO: RUSTPYTHON autocommit behavior differs")
499507
def test_autocommit_disabled_executescript(self):
500508
expected = ["SELECT 1"]
501509
with memory_database(autocommit=False) as cx:

0 commit comments

Comments
 (0)