diff options
author | Hai Shi <shihai1992@gmail.com> | 2020-08-04 00:47:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-03 18:47:42 +0200 |
commit | bb0424b122e3d222a558bd4177ce37befd3e0347 (patch) | |
tree | f5962e6276319558e48b702b6fa5a48f5c03ff6b /Lib/test/test_unicode_file_functions.py | |
parent | a7f5d93bb6906d0f999248b47295d3a59b130f4d (diff) | |
download | cpython-git-bb0424b122e3d222a558bd4177ce37befd3e0347.tar.gz |
bpo-40275: Use new test.support helper submodules in tests (GH-21451)
Diffstat (limited to 'Lib/test/test_unicode_file_functions.py')
-rw-r--r-- | Lib/test/test_unicode_file_functions.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/Lib/test/test_unicode_file_functions.py b/Lib/test/test_unicode_file_functions.py index 1cd0d621cd..7ef11aac9f 100644 --- a/Lib/test/test_unicode_file_functions.py +++ b/Lib/test/test_unicode_file_functions.py @@ -6,6 +6,8 @@ import unittest import warnings from unicodedata import normalize from test import support +from test.support import os_helper + filenames = [ '1_abc', @@ -62,14 +64,14 @@ class UnicodeFileTests(unittest.TestCase): def setUp(self): try: - os.mkdir(support.TESTFN) + os.mkdir(os_helper.TESTFN) except FileExistsError: pass - self.addCleanup(support.rmtree, support.TESTFN) + self.addCleanup(os_helper.rmtree, os_helper.TESTFN) files = set() for name in self.files: - name = os.path.join(support.TESTFN, self.norm(name)) + name = os.path.join(os_helper.TESTFN, self.norm(name)) with open(name, 'wb') as f: f.write((name+'\n').encode("utf-8")) os.stat(name) @@ -144,9 +146,10 @@ class UnicodeFileTests(unittest.TestCase): sf0 = set(self.files) with warnings.catch_warnings(): warnings.simplefilter("ignore", DeprecationWarning) - f1 = os.listdir(support.TESTFN.encode(sys.getfilesystemencoding())) - f2 = os.listdir(support.TESTFN) - sf2 = set(os.path.join(support.TESTFN, f) for f in f2) + f1 = os.listdir(os_helper.TESTFN.encode( + sys.getfilesystemencoding())) + f2 = os.listdir(os_helper.TESTFN) + sf2 = set(os.path.join(os_helper.TESTFN, f) for f in f2) self.assertEqual(sf0, sf2, "%a != %a" % (sf0, sf2)) self.assertEqual(len(f1), len(f2)) @@ -156,9 +159,10 @@ class UnicodeFileTests(unittest.TestCase): os.rename("tmp", name) def test_directory(self): - dirname = os.path.join(support.TESTFN, 'Gr\xfc\xdf-\u66e8\u66e9\u66eb') + dirname = os.path.join(os_helper.TESTFN, + 'Gr\xfc\xdf-\u66e8\u66e9\u66eb') filename = '\xdf-\u66e8\u66e9\u66eb' - with support.temp_cwd(dirname): + with os_helper.temp_cwd(dirname): with open(filename, 'wb') as f: f.write((filename + '\n').encode("utf-8")) os.access(filename,os.R_OK) |