Skip to content

Commit 827c90b

Browse files
[3.14] Add test for opening an SQLite with bytes path (GH-136331) (GH-137632)
(cherry picked from commit 1bde13b) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
1 parent 181cecc commit 827c90b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Lib/test/test_sqlite3/test_dbapi.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,14 @@ def test_deserialize_corrupt_database(self):
639639
class OpenTests(unittest.TestCase):
640640
_sql = "create table test(id integer)"
641641

642+
def test_open_with_bytes_path(self):
643+
path = os.fsencode(TESTFN)
644+
self.addCleanup(unlink, path)
645+
self.assertFalse(os.path.exists(path))
646+
with contextlib.closing(sqlite.connect(path)) as cx:
647+
self.assertTrue(os.path.exists(path))
648+
cx.execute(self._sql)
649+
642650
def test_open_with_path_like_object(self):
643651
""" Checks that we can successfully connect to a database using an object that
644652
is PathLike, i.e. has __fspath__(). """

0 commit comments

Comments
 (0)