gh-84461: Fix test_sqlite for Emscripten/WASI (#94125)

This commit is contained in:
Christian Heimes 2022-06-23 08:31:55 +02:00 committed by GitHub
parent fb1e9506c1
commit 15bfabd1aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -29,7 +29,10 @@
import unittest import unittest
import urllib.parse import urllib.parse
from test.support import SHORT_TIMEOUT, check_disallow_instantiation from test.support import (
SHORT_TIMEOUT, check_disallow_instantiation, requires_subprocess,
is_emscripten, is_wasi
)
from test.support import threading_helper from test.support import threading_helper
from _testcapi import INT_MAX, ULLONG_MAX from _testcapi import INT_MAX, ULLONG_MAX
from os import SEEK_SET, SEEK_CUR, SEEK_END from os import SEEK_SET, SEEK_CUR, SEEK_END
@ -653,6 +656,7 @@ def test_open_with_path_like_object(self):
@unittest.skipIf(sys.platform == "win32", "skipped on Windows") @unittest.skipIf(sys.platform == "win32", "skipped on Windows")
@unittest.skipIf(sys.platform == "darwin", "skipped on macOS") @unittest.skipIf(sys.platform == "darwin", "skipped on macOS")
@unittest.skipIf(is_emscripten or is_wasi, "not supported on Emscripten/WASI")
@unittest.skipUnless(TESTFN_UNDECODABLE, "only works if there are undecodable paths") @unittest.skipUnless(TESTFN_UNDECODABLE, "only works if there are undecodable paths")
def test_open_with_undecodable_path(self): def test_open_with_undecodable_path(self):
path = TESTFN_UNDECODABLE path = TESTFN_UNDECODABLE
@ -698,6 +702,7 @@ def test_open_uri_readonly(self):
@unittest.skipIf(sys.platform == "win32", "skipped on Windows") @unittest.skipIf(sys.platform == "win32", "skipped on Windows")
@unittest.skipIf(sys.platform == "darwin", "skipped on macOS") @unittest.skipIf(sys.platform == "darwin", "skipped on macOS")
@unittest.skipIf(is_emscripten or is_wasi, "not supported on Emscripten/WASI")
@unittest.skipUnless(TESTFN_UNDECODABLE, "only works if there are undecodable paths") @unittest.skipUnless(TESTFN_UNDECODABLE, "only works if there are undecodable paths")
def test_open_undecodable_uri(self): def test_open_undecodable_uri(self):
path = TESTFN_UNDECODABLE path = TESTFN_UNDECODABLE
@ -1453,6 +1458,7 @@ def test_blob_closed_db_read(self):
blob.read) blob.read)
@threading_helper.requires_working_threading()
class ThreadTests(unittest.TestCase): class ThreadTests(unittest.TestCase):
def setUp(self): def setUp(self):
self.con = sqlite.connect(":memory:") self.con = sqlite.connect(":memory:")
@ -1817,6 +1823,7 @@ def test_on_conflict_replace(self):
self.assertEqual(self.cu.fetchall(), [('Very different data!', 'foo')]) self.assertEqual(self.cu.fetchall(), [('Very different data!', 'foo')])
@requires_subprocess()
class MultiprocessTests(unittest.TestCase): class MultiprocessTests(unittest.TestCase):
CONNECTION_TIMEOUT = SHORT_TIMEOUT / 1000. # Defaults to 30 ms CONNECTION_TIMEOUT = SHORT_TIMEOUT / 1000. # Defaults to 30 ms