diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-11-15 21:27:41 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-11-15 21:27:41 (GMT) |
commit | 1ab6c2d2c2b6c78e492491542007edfb880889f0 (patch) | |
tree | 2933764c675aa8f715a176c7ae0cb8486bdd0f0a /Lib/test/test_pep277.py | |
parent | 6166519d2bfb0b6fd7ff304da89c59b10557d4a3 (diff) | |
download | cpython-1ab6c2d2c2b6c78e492491542007edfb880889f0.zip cpython-1ab6c2d2c2b6c78e492491542007edfb880889f0.tar.gz cpython-1ab6c2d2c2b6c78e492491542007edfb880889f0.tar.bz2 |
Issue #13374: The Windows bytes API has been deprecated in the os module. Use
Unicode filenames instead of bytes filenames to not depend on the ANSI code
page anymore and to support any filename.
Diffstat (limited to 'Lib/test/test_pep277.py')
-rw-r--r-- | Lib/test/test_pep277.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/test_pep277.py b/Lib/test/test_pep277.py index a1a4791..4b16cbb 100644 --- a/Lib/test/test_pep277.py +++ b/Lib/test/test_pep277.py @@ -1,6 +1,9 @@ # Test the Unicode versions of normal file functions # open, os.open, os.stat. os.listdir, os.rename, os.remove, os.mkdir, os.chdir, os.rmdir -import sys, os, unittest +import os +import sys +import unittest +import warnings from unicodedata import normalize from test import support @@ -155,7 +158,9 @@ class UnicodeFileTests(unittest.TestCase): @unittest.skipIf(sys.platform == 'darwin', 'irrelevant test on Mac OS X') def test_listdir(self): sf0 = set(self.files) - f1 = os.listdir(support.TESTFN.encode(sys.getfilesystemencoding())) + 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) self.assertEqual(sf0, sf2, "%a != %a" % (sf0, sf2)) |