@@ -122,18 +122,19 @@ def test_sqlite(self):
122122 self .assertTrue (hasattr (conn , "enable_load_extension" ))
123123 # Backup feature requires modern SQLite, which we always have.
124124 self .assertTrue (hasattr (conn , "backup" ))
125- # Ensure that various extensions are present. These will raise
126- # if they are not.
127- cursor = conn .cursor ()
128- cursor .execute ("CREATE VIRTUAL TABLE fts3 USING fts3(sender, title, body);" )
129- cursor .execute ("CREATE VIRTUAL TABLE fts4 USING fts4(sender, title, body);" )
130- cursor .execute ("CREATE VIRTUAL TABLE fts5 USING fts5(sender, title, body);" )
131- cursor .execute ("CREATE VIRTUAL TABLE rtree USING rtree(id, minX, maxX);" )
125+ # Ensure that various extensions are present. These will raise if they are not. Note that
126+ # CPython upstream carries configuration flags for the Windows build, so geopoly is missing
127+ # on all versions and rtree is missing in 3.9. On non-Windows platforms, we configure
128+ # SQLite ourselves. We might want to patch the build to enable these on Windows, see #666.
129+ extensions = ["fts3" , "fts4" , "fts5" ]
132130 if os .name != "nt" :
133- # TODO(geofft): not sure why this isn't present in the prebuilt
134- # sqlite3 Windows library from CPython upstream, it seems weird to
135- # be inconsistent across platforms, but that's the status quo
136- cursor .execute ("CREATE VIRTUAL TABLE geopoly USING geopoly();" )
131+ extensions .append ("geopoly" )
132+ if os .name == "nt" and sys .version_info [0 :2 ] >= (3 , 9 ):
133+ extensions .append ("rtree" )
134+ cursor = conn .cursor ()
135+ for extension in extensions :
136+ with self .subTest (extension = extension ):
137+ cursor .execute (f"CREATE VIRTUAL TABLE test{ extension } USING { extension } (a, b, c);" )
137138 conn .close ()
138139
139140 def test_ssl (self ):
0 commit comments