]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add test for opening an SQLite with bytes path (GH-136331)
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 11 Aug 2025 06:16:54 +0000 (09:16 +0300)
committerGitHub <noreply@github.com>
Mon, 11 Aug 2025 06:16:54 +0000 (09:16 +0300)
Lib/test/test_sqlite3/test_dbapi.py

index 3602726437d8cf3a87d4dd0ebb31f9a64375fe75..74a511ba7c88c2bf2c98c64d6427d422de174c40 100644 (file)
@@ -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__(). """