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

This commit is contained in:
Hai Shi 2020-08-08 05:55:35 +08:00 committed by GitHub
parent e27a51c11e
commit fcce8c649a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 27 additions and 18 deletions

View file

@ -1,5 +1,6 @@
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
import os
import unittest
@ -9,7 +10,7 @@ from dbm.ndbm import error
class DbmTestCase(unittest.TestCase):
def setUp(self):
self.filename = support.TESTFN
self.filename = os_helper.TESTFN
self.d = dbm.ndbm.open(self.filename, 'c')
self.d.close()
@ -102,10 +103,10 @@ class DbmTestCase(unittest.TestCase):
with self.assertRaises(error):
db[b'not exist key'] = b'not exist value'
@unittest.skipUnless(support.TESTFN_NONASCII,
@unittest.skipUnless(os_helper.TESTFN_NONASCII,
'requires OS support of non-ASCII encodings')
def test_nonascii_filename(self):
filename = support.TESTFN_NONASCII
filename = os_helper.TESTFN_NONASCII
for suffix in ['', '.pag', '.dir', '.db']:
self.addCleanup(support.unlink, filename + suffix)
with dbm.ndbm.open(filename, 'c') as db: