Skip to content

Commit fc76e3b

Browse files
gh-116303: Skip some sqlite3 tests if testcapi is unavailable
- Lib/test/support/__init__.py - Lib/test/test_audit.py - Lib/test/test_gdb/test_misc.py - Lib/test/test_inspect/test_inspect.py - Lib/test/test_pydoc/test_pydoc.py
1 parent cfbdce7 commit fc76e3b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Lib/test/test_sqlite3/test_dbapi.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@
3131

3232
from test.support import (
3333
SHORT_TIMEOUT, check_disallow_instantiation, requires_subprocess,
34-
is_apple, is_emscripten, is_wasi
34+
is_apple, is_emscripten, is_wasi, import_helper
3535
)
3636
from test.support import gc_collect
3737
from test.support import threading_helper
38-
from _testcapi import INT_MAX, ULLONG_MAX
3938
from os import SEEK_SET, SEEK_CUR, SEEK_END
4039
from test.support.os_helper import TESTFN, TESTFN_UNDECODABLE, unlink, temp_dir, FakePath
4140

@@ -1200,6 +1199,7 @@ def test_blob_seek_and_tell(self):
12001199
self.assertEqual(self.blob.tell(), 40)
12011200

12021201
def test_blob_seek_error(self):
1202+
testcapi = import_helper.import_module("_testcapi")
12031203
msg_oor = "offset out of blob range"
12041204
msg_orig = "'origin' should be os.SEEK_SET, os.SEEK_CUR, or os.SEEK_END"
12051205
msg_of = "seek offset results in overflow"
@@ -1217,9 +1217,9 @@ def test_blob_seek_error(self):
12171217
# Force overflow errors
12181218
self.blob.seek(1, SEEK_SET)
12191219
with self.assertRaisesRegex(OverflowError, msg_of):
1220-
self.blob.seek(INT_MAX, SEEK_CUR)
1220+
self.blob.seek(testcapi.INT_MAX, SEEK_CUR)
12211221
with self.assertRaisesRegex(OverflowError, msg_of):
1222-
self.blob.seek(INT_MAX, SEEK_END)
1222+
self.blob.seek(testcapi.INT_MAX, SEEK_END)
12231223

12241224
def test_blob_read(self):
12251225
buf = self.blob.read()
@@ -1374,13 +1374,14 @@ def test_blob_mapping_invalid_index_type(self):
13741374
self.blob["a"] = b"b"
13751375

13761376
def test_blob_get_item_error(self):
1377+
testcapi = import_helper.import_module("_testcapi")
13771378
dataset = [len(self.blob), 105, -105]
13781379
for idx in dataset:
13791380
with self.subTest(idx=idx):
13801381
with self.assertRaisesRegex(IndexError, "index out of range"):
13811382
self.blob[idx]
13821383
with self.assertRaisesRegex(IndexError, "cannot fit 'int'"):
1383-
self.blob[ULLONG_MAX]
1384+
self.blob[testcapi.ULLONG_MAX]
13841385

13851386
# Provoke read error
13861387
self.cx.execute("update test set b='aaaa' where rowid=1")

0 commit comments

Comments
 (0)