Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-136289: Fix test_sqlite3 on platforms with strict UTF-8 filesystem (…
…GH-136326)

(cherry picked from commit 85b817d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
  • Loading branch information
serhiy-storchaka authored and miss-islington committed Jul 7, 2025
commit dab9167276549deed0a8bc4db1b1ad9f6d9db78d
26 changes: 14 additions & 12 deletions Lib/test/test_sqlite3/test_dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
import warnings

from test.support import (
SHORT_TIMEOUT, check_disallow_instantiation, requires_subprocess,
is_apple, is_emscripten, is_wasi
SHORT_TIMEOUT, check_disallow_instantiation, requires_subprocess
)
from test.support import gc_collect
from test.support import threading_helper, import_helper
Expand Down Expand Up @@ -649,14 +648,21 @@ def test_open_with_path_like_object(self):
self.assertTrue(os.path.exists(path))
cx.execute(self._sql)

def get_undecodable_path(self):
path = TESTFN_UNDECODABLE
if not path:
self.skipTest("only works if there are undecodable paths")
try:
open(path, 'wb').close()
except OSError:
self.skipTest(f"can't create file with undecodable path {path!r}")
unlink(path)
return path

@unittest.skipIf(sys.platform == "win32", "skipped on Windows")
@unittest.skipIf(is_apple, "skipped on Apple platforms")
@unittest.skipIf(is_emscripten or is_wasi, "not supported on Emscripten/WASI")
@unittest.skipUnless(TESTFN_UNDECODABLE, "only works if there are undecodable paths")
def test_open_with_undecodable_path(self):
path = TESTFN_UNDECODABLE
path = self.get_undecodable_path()
self.addCleanup(unlink, path)
self.assertFalse(os.path.exists(path))
with contextlib.closing(sqlite.connect(path)) as cx:
self.assertTrue(os.path.exists(path))
cx.execute(self._sql)
Expand Down Expand Up @@ -696,14 +702,10 @@ def test_open_uri_readonly(self):
cx.execute(self._sql)

@unittest.skipIf(sys.platform == "win32", "skipped on Windows")
@unittest.skipIf(is_apple, "skipped on Apple platforms")
@unittest.skipIf(is_emscripten or is_wasi, "not supported on Emscripten/WASI")
@unittest.skipUnless(TESTFN_UNDECODABLE, "only works if there are undecodable paths")
def test_open_undecodable_uri(self):
path = TESTFN_UNDECODABLE
path = self.get_undecodable_path()
self.addCleanup(unlink, path)
uri = "file:" + urllib.parse.quote(path)
self.assertFalse(os.path.exists(path))
with contextlib.closing(sqlite.connect(uri, uri=True)) as cx:
self.assertTrue(os.path.exists(path))
cx.execute(self._sql)
Expand Down