bpo-40275: Use new test.support helper submodules in tests (GH-21785)

This commit is contained in:
Hai Shi 2020-08-08 19:05:24 +08:00 committed by GitHub
parent d94af3f7ed
commit c6f282f3b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 16 deletions

View file

@ -1,4 +1,3 @@
from test import support
from test.support import import_helper
from test.support import os_helper
import_helper.import_module("dbm.ndbm") #skip if not supported
@ -16,7 +15,7 @@ class DbmTestCase(unittest.TestCase):
def tearDown(self):
for suffix in ['', '.pag', '.dir', '.db']:
support.unlink(self.filename + suffix)
os_helper.unlink(self.filename + suffix)
def test_keys(self):
self.d = dbm.ndbm.open(self.filename, 'c')
@ -108,7 +107,7 @@ class DbmTestCase(unittest.TestCase):
def test_nonascii_filename(self):
filename = os_helper.TESTFN_NONASCII
for suffix in ['', '.pag', '.dir', '.db']:
self.addCleanup(support.unlink, filename + suffix)
self.addCleanup(os_helper.unlink, filename + suffix)
with dbm.ndbm.open(filename, 'c') as db:
db[b'key'] = b'value'
self.assertTrue(any(os.path.exists(filename + suffix)