From: Serhiy Storchaka Date: Mon, 7 Jul 2025 12:14:17 +0000 (+0300) Subject: gh-124486: Fix test_whichdb_ndbm in test_dbm on NetBSD (GH-136335) X-Git-Tag: v3.15.0a1~1066 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b7aa2a4b4df697db6ea45a555eeb3fefa5ca5bd4;p=thirdparty%2FPython%2Fcpython.git gh-124486: Fix test_whichdb_ndbm in test_dbm on NetBSD (GH-136335) On NetBSD, ndbm.open() does not fail for empty file. --- diff --git a/Lib/test/test_dbm.py b/Lib/test/test_dbm.py index 7e8d78b89405..ae9faabd536a 100644 --- a/Lib/test/test_dbm.py +++ b/Lib/test/test_dbm.py @@ -274,7 +274,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)]