diff options
| author | Larry Hastings <larry@hastings.org> | 2015-09-07 12:16:38 (GMT) |
|---|---|---|
| committer | Larry Hastings <larry@hastings.org> | 2015-09-07 12:16:38 (GMT) |
| commit | c8c47f55e636ed86791160944ccbb1ea651476bd (patch) | |
| tree | db97b6edb082a98c6ad2abcbacb6151ee2df2049 /Lib/test/test_unicode_file.py | |
| parent | 71f9633818b3a0cbd36b0f6ed164d436b1997fe9 (diff) | |
| parent | 8c85a2083fdc6188d32f1eb287151cdb7e79a54a (diff) | |
| download | cpython-c8c47f55e636ed86791160944ccbb1ea651476bd.zip cpython-c8c47f55e636ed86791160944ccbb1ea651476bd.tar.gz cpython-c8c47f55e636ed86791160944ccbb1ea651476bd.tar.bz2 | |
Merge heads.
Diffstat (limited to 'Lib/test/test_unicode_file.py')
| -rw-r--r-- | Lib/test/test_unicode_file.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Lib/test/test_unicode_file.py b/Lib/test/test_unicode_file.py index faa8da3..e4709a1 100644 --- a/Lib/test/test_unicode_file.py +++ b/Lib/test/test_unicode_file.py @@ -5,7 +5,7 @@ import os, glob, time, shutil import unicodedata import unittest -from test.support import (run_unittest, rmtree, +from test.support import (run_unittest, rmtree, change_cwd, TESTFN_ENCODING, TESTFN_UNICODE, TESTFN_UNENCODABLE, create_empty_file) if not os.path.supports_unicode_filenames: @@ -82,13 +82,11 @@ class TestUnicodeFiles(unittest.TestCase): self.assertFalse(os.path.exists(filename2 + '.new')) def _do_directory(self, make_name, chdir_name): - cwd = os.getcwd() if os.path.isdir(make_name): rmtree(make_name) os.mkdir(make_name) try: - os.chdir(chdir_name) - try: + with change_cwd(chdir_name): cwd_result = os.getcwd() name_result = make_name @@ -96,8 +94,6 @@ class TestUnicodeFiles(unittest.TestCase): name_result = unicodedata.normalize("NFD", name_result) self.assertEqual(os.path.basename(cwd_result),name_result) - finally: - os.chdir(cwd) finally: os.rmdir(make_name) |
