]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] Add test for opening an SQLite with bytes path (GH-136331) (GH-137632)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 7 Oct 2025 20:35:06 +0000 (22:35 +0200)
committerGitHub <noreply@github.com>
Tue, 7 Oct 2025 20:35:06 +0000 (22:35 +0200)
(cherry picked from commit 1bde13b0e99592fbfce3538b27ada29ea09840a6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/test/test_sqlite3/test_dbapi.py

index 0284f2d10b052bc1b8ee5975f27374f9bdf51e26..1e595bdbd645a2946768f8505096f3301df4adef 100644 (file)
@@ -639,6 +639,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__(). """