Skip to content

Commit d26c2fe

Browse files
[3.13] gh-129870: Skip test_dump_virtual_tables if SQLite lacks FTS4 support (GH-129913) (#129918)
(cherry picked from commit cda83ca) Co-authored-by: Erlend E. Aasland <[email protected]>
1 parent 26041da commit d26c2fe

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Lib/test/test_sqlite3/test_dump.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from .util import memory_database
66
from .util import MemoryDatabaseMixin
7+
from .util import requires_virtual_table
78

89

910
class DumpTests(MemoryDatabaseMixin, unittest.TestCase):
@@ -206,6 +207,7 @@ def dict_factory(cu, row):
206207
self.assertEqual(expected, actual)
207208
self.assertEqual(self.cx.row_factory, dict_factory)
208209

210+
@requires_virtual_table("fts4")
209211
def test_dump_virtual_tables(self):
210212
# gh-64662
211213
expected = [

Lib/test/test_sqlite3/util.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import re
55
import sqlite3
66
import test.support
7+
import unittest
78

89

910
# Helper for temporary memory databases
@@ -75,3 +76,10 @@ def cx(self):
7576
@property
7677
def cu(self):
7778
return self.cur
79+
80+
81+
def requires_virtual_table(module):
82+
with memory_database() as cx:
83+
supported = (module,) in list(cx.execute("PRAGMA module_list"))
84+
reason = f"Requires {module!r} virtual table support"
85+
return unittest.skipUnless(supported, reason)

0 commit comments

Comments
 (0)