diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-09-21 18:19:07 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-09-21 18:19:07 (GMT) |
commit | 38425292fbb1811e78b02bbd190f6f4de75f6562 (patch) | |
tree | c10804e8f034bf9225dc7fa2f26d690a4fb3805d /Lib | |
parent | 3e62f78c4ef51972258b8f6bf76cb725cabddcad (diff) | |
download | cpython-38425292fbb1811e78b02bbd190f6f4de75f6562.zip cpython-38425292fbb1811e78b02bbd190f6f4de75f6562.tar.gz cpython-38425292fbb1811e78b02bbd190f6f4de75f6562.tar.bz2 |
Issue #9908: Fix os.stat() on bytes paths under Windows 7.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_os.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 7ce9959..12e516e 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -219,12 +219,12 @@ class StatAttributeTests(unittest.TestCase): os.unlink(self.fname) os.rmdir(support.TESTFN) - def test_stat_attributes(self): + def check_stat_attributes(self, fname): if not hasattr(os, "stat"): return import stat - result = os.stat(self.fname) + result = os.stat(fname) # Make sure direct access works self.assertEquals(result[stat.ST_SIZE], 3) @@ -281,6 +281,15 @@ class StatAttributeTests(unittest.TestCase): except TypeError: pass + def test_stat_attributes(self): + self.check_stat_attributes(self.fname) + + def test_stat_attributes_bytes(self): + try: + fname = self.fname.encode(sys.getfilesystemencoding()) + except UnicodeEncodeError: + self.skipTest("cannot encode %a for the filesystem" % self.fname) + self.check_stat_attributes(fname) def test_statvfs_attributes(self): if not hasattr(os, "statvfs"): |