From: Serhiy Storchaka Date: Mon, 11 Aug 2025 06:16:54 +0000 (+0300) Subject: Add test for opening an SQLite with bytes path (GH-136331) X-Git-Tag: v3.15.0a1~726 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1bde13b0e99592fbfce3538b27ada29ea09840a6;p=thirdparty%2FPython%2Fcpython.git Add test for opening an SQLite with bytes path (GH-136331) --- diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py index 3602726437d8..74a511ba7c88 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -630,6 +630,14 @@ class SerializeTests(unittest.TestCase): 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__(). """