Skip to content

Commit 1bde13b

Browse files
Add test for opening an SQLite with bytes path (GH-136331)
1 parent b36d23f commit 1bde13b

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
@@ -630,6 +630,14 @@ def test_deserialize_corrupt_database(self):
630630
class OpenTests(unittest.TestCase):
631631
_sql = "create table test(id integer)"
632632

633+
def test_open_with_bytes_path(self):
634+
path = os.fsencode(TESTFN)
635+
self.addCleanup(unlink, path)
636+
self.assertFalse(os.path.exists(path))
637+
with contextlib.closing(sqlite.connect(path)) as cx:
638+
self.assertTrue(os.path.exists(path))
639+
cx.execute(self._sql)
640+
633641
def test_open_with_path_like_object(self):
634642
""" Checks that we can successfully connect to a database using an object that
635643
is PathLike, i.e. has __fspath__(). """

0 commit comments

Comments
 (0)