[3.13] gh-124486: Fix test_whichdb_ndbm in test_dbm on NetBSD (GH-136335) (GH-136379)

On NetBSD, ndbm.open() does not fail for empty file.
(cherry picked from commit b7aa2a4b4d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Miss Islington (bot) 2025-07-07 14:50:40 +02:00 committed by GitHub
parent 843e8054b0
commit eea2af3dd8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -213,7 +213,8 @@ class WhichDBTestCase(unittest.TestCase):
@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)]