mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
Issue #9908: Fix os.stat() on bytes paths under Windows 7.
This commit is contained in:
parent
3e62f78c4e
commit
38425292fb
3 changed files with 44 additions and 19 deletions
|
|
@ -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"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue