[Python-checkins] cpython (merge 3.3 -> default): Solaris' /dev/null is a symlink. The device test now uses stat instead of lstat
christian.heimes
python-checkins at python.org
Sun Jun 23 16:16:19 CEST 2013
http://hg.python.org/cpython/rev/6fd45b004d78
changeset: 84277:6fd45b004d78
parent: 84275:a39d2223be23
parent: 84276:6c23ca1982b3
user: Christian Heimes <christian at cheimes.de>
date: Sun Jun 23 16:11:37 2013 +0200
summary:
Solaris' /dev/null is a symlink. The device test now uses stat instead of lstat to compensate
for symlinks.
files:
Lib/test/test_stat.py | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/Lib/test/test_stat.py b/Lib/test/test_stat.py
--- a/Lib/test/test_stat.py
+++ b/Lib/test/test_stat.py
@@ -62,8 +62,11 @@
pass
tearDown = setUp
- def get_mode(self, fname=TESTFN):
- st_mode = os.lstat(fname).st_mode
+ def get_mode(self, fname=TESTFN, lstat=True):
+ if lstat:
+ st_mode = os.lstat(fname).st_mode
+ else:
+ st_mode = os.stat(fname).st_mode
modestr = self.statmod.filemode(st_mode)
return st_mode, modestr
@@ -153,13 +156,13 @@
@unittest.skipUnless(os.name == 'posix', 'requires Posix')
def test_devices(self):
if os.path.exists(os.devnull):
- st_mode, modestr = self.get_mode(os.devnull)
+ st_mode, modestr = self.get_mode(os.devnull, lstat=False)
self.assertEqual(modestr[0], 'c')
self.assertS_IS("CHR", st_mode)
# Linux block devices, BSD has no block devices anymore
for blockdev in ("/dev/sda", "/dev/hda"):
if os.path.exists(blockdev):
- st_mode, modestr = self.get_mode(blockdev)
+ st_mode, modestr = self.get_mode(blockdev, lstat=False)
self.assertEqual(modestr[0], 'b')
self.assertS_IS("BLK", st_mode)
break
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list