summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_stat.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-06-23 14:11:37 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-06-23 14:11:37 (GMT)
commitfcce2024ea97c76e25adf9ff45f72a9f0d431ac3 (patch)
treecee55fda00773952ffbce7cccdac660cc201a899 /Lib/test/test_stat.py
parent582cfbbf7489e94494e665092f6587d6160411c6 (diff)
parent36a7e4f74a7fdf193f0fd0fab8ace602bca490a5 (diff)
downloadcpython-fcce2024ea97c76e25adf9ff45f72a9f0d431ac3.zip
cpython-fcce2024ea97c76e25adf9ff45f72a9f0d431ac3.tar.gz
cpython-fcce2024ea97c76e25adf9ff45f72a9f0d431ac3.tar.bz2
Solaris' /dev/null is a symlink. The device test now uses stat instead of lstat to compensate
for symlinks.
Diffstat (limited to 'Lib/test/test_stat.py')
-rw-r--r--Lib/test/test_stat.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/test/test_stat.py b/Lib/test/test_stat.py
index 735b2e6..be0c5c5 100644
--- a/Lib/test/test_stat.py
+++ b/Lib/test/test_stat.py
@@ -62,8 +62,11 @@ class TestFilemode(unittest.TestCase):
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 @@ class TestFilemode(unittest.TestCase):
@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