[3.14] Add test for opening an SQLite with bytes path (GH-136331) (GH-137632)

(cherry picked from commit 1bde13b0e9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Miss Islington (bot) 2025-10-07 22:35:06 +02:00 committed by GitHub
parent 181cecc5c0
commit 827c90b8b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -639,6 +639,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__(). """