summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pep277.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-09-06 11:14:49 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-09-06 11:14:49 (GMT)
commit5fbadb63ef2a3d7645396e1f11fe9303883c7e65 (patch)
tree75d288ce9278350ed4dd3730de0d822999e76340 /Lib/test/test_pep277.py
parentdcaf4ccf3f1d8040313f68b77424d39691389164 (diff)
parent2a23adf4405bcd903aabf445dd54867d95f494a1 (diff)
downloadcpython-5fbadb63ef2a3d7645396e1f11fe9303883c7e65.zip
cpython-5fbadb63ef2a3d7645396e1f11fe9303883c7e65.tar.gz
cpython-5fbadb63ef2a3d7645396e1f11fe9303883c7e65.tar.bz2
Use support.change_cwd() in tests.
Diffstat (limited to 'Lib/test/test_pep277.py')
-rw-r--r--Lib/test/test_pep277.py8
1 files changed, 1 insertions, 7 deletions
diff --git a/Lib/test/test_pep277.py b/Lib/test/test_pep277.py
index 6c833a8..98c716b 100644
--- a/Lib/test/test_pep277.py
+++ b/Lib/test/test_pep277.py
@@ -158,17 +158,11 @@ class UnicodeFileTests(unittest.TestCase):
def test_directory(self):
dirname = os.path.join(support.TESTFN, 'Gr\xfc\xdf-\u66e8\u66e9\u66eb')
filename = '\xdf-\u66e8\u66e9\u66eb'
- oldwd = os.getcwd()
- os.mkdir(dirname)
- os.chdir(dirname)
- try:
+ with support.temp_cwd(dirname):
with open(filename, 'wb') as f:
f.write((filename + '\n').encode("utf-8"))
os.access(filename,os.R_OK)
os.remove(filename)
- finally:
- os.chdir(oldwd)
- os.rmdir(dirname)
class UnicodeNFCFileTests(UnicodeFileTests):