diff options
author | Anthony Sottile <asottile@umich.edu> | 2019-02-25 22:32:27 (GMT) |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-02-25 22:32:27 (GMT) |
commit | 8377cd4fcd0d51d86834c9b0518d29aac3b49e18 (patch) | |
tree | e8d82c3567b2d39ff0bd285d25ce2d02359ae070 /Lib/test/test_tempfile.py | |
parent | 9c3f284de598550be6687964c23fd7599e53b20e (diff) | |
download | cpython-8377cd4fcd0d51d86834c9b0518d29aac3b49e18.zip cpython-8377cd4fcd0d51d86834c9b0518d29aac3b49e18.tar.gz cpython-8377cd4fcd0d51d86834c9b0518d29aac3b49e18.tar.bz2 |
Clean up code which checked presence of os.{stat,lstat,chmod} (#11643)
Diffstat (limited to 'Lib/test/test_tempfile.py')
-rw-r--r-- | Lib/test/test_tempfile.py | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py index e5098d2..3c0b9a7 100644 --- a/Lib/test/test_tempfile.py +++ b/Lib/test/test_tempfile.py @@ -8,6 +8,7 @@ import sys import re import warnings import contextlib +import stat import weakref from unittest import mock @@ -16,12 +17,6 @@ from test import support from test.support import script_helper -if hasattr(os, 'stat'): - import stat - has_stat = 1 -else: - has_stat = 0 - has_textmode = (tempfile._text_openflags != tempfile._bin_openflags) has_spawnl = hasattr(os, 'spawnl') @@ -433,7 +428,6 @@ class TestMkstempInner(TestBadTempdir, BaseTestCase): finally: os.rmdir(dir) - @unittest.skipUnless(has_stat, 'os.stat not available') def test_file_mode(self): # _mkstemp_inner creates files with the proper mode @@ -738,7 +732,6 @@ class TestMkdtemp(TestBadTempdir, BaseTestCase): finally: os.rmdir(dir) - @unittest.skipUnless(has_stat, 'os.stat not available') def test_mode(self): # mkdtemp creates directories with the proper mode @@ -1221,8 +1214,7 @@ class TestSpooledTemporaryFile(BaseTestCase): f.write(b'abcdefg\n') f.truncate(20) self.assertTrue(f._rolled) - if has_stat: - self.assertEqual(os.fstat(f.fileno()).st_size, 20) + self.assertEqual(os.fstat(f.fileno()).st_size, 20) if tempfile.NamedTemporaryFile is not tempfile.TemporaryFile: |