gh-124486: Fix test_whichdb_ndbm in test_dbm on NetBSD (GH-136335)

On NetBSD, ndbm.open() does not fail for empty file.
This commit is contained in:
Serhiy Storchaka 2025-07-07 15:14:17 +03:00 committed by GitHub
parent 73e1207a4e
commit b7aa2a4b4d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -274,7 +274,8 @@ def test_whichdb(self):
@unittest.skipUnless(ndbm, reason='Test requires ndbm')
def test_whichdb_ndbm(self):
# Issue 17198: check that ndbm which is referenced in whichdb is defined
with open(_fname + '.db', 'wb'): pass
with open(_fname + '.db', 'wb') as f:
f.write(b'spam')
_bytes_fname = os.fsencode(_fname)
fnames = [_fname, os_helper.FakePath(_fname),
_bytes_fname, os_helper.FakePath(_bytes_fname)]