https://github.com/python/cpython/commit/1bde13b0e99592fbfce3538b27ada29ea09840a6
commit: 1bde13b0e99592fbfce3538b27ada29ea09840a6
branch: main
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2025-08-11T09:16:54+03:00
summary:
Add test for opening an SQLite with bytes path (GH-136331)
files:
M Lib/test/test_sqlite3/test_dbapi.py
diff --git a/Lib/test/test_sqlite3/test_dbapi.py
b/Lib/test/test_sqlite3/test_dbapi.py
index 3602726437d8cf..74a511ba7c88c2 100644
--- a/Lib/test/test_sqlite3/test_dbapi.py
+++ b/Lib/test/test_sqlite3/test_dbapi.py
@@ -630,6 +630,14 @@ def test_deserialize_corrupt_database(self):
class OpenTests(unittest.TestCase):
_sql = "create table test(id integer)"
+ def test_open_with_bytes_path(self):
+ path = os.fsencode(TESTFN)
+ 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)
+
def test_open_with_path_like_object(self):
""" Checks that we can successfully connect to a database using an
object that
is PathLike, i.e. has __fspath__(). """
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]