Skip to content

Commit e762405

Browse files
Add test for opening an SQLite with bytes path
1 parent 1953713 commit e762405

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

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

0 commit comments

Comments
 (0)