summaryrefslogtreecommitdiff
path: root/Lib/test/test_tempfile.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_tempfile.py')
-rw-r--r--Lib/test/test_tempfile.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py
index 4ff56b8bf6..9c4c158b22 100644
--- a/Lib/test/test_tempfile.py
+++ b/Lib/test/test_tempfile.py
@@ -324,10 +324,9 @@ class TestMkstempInner(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
- if not has_stat:
- return # ugh, can't use SkipTest.
file = self.do_create()
mode = stat.S_IMODE(os.stat(file.name).st_mode)
@@ -339,10 +338,9 @@ class TestMkstempInner(BaseTestCase):
expected = user * (1 + 8 + 64)
self.assertEqual(mode, expected)
+ @unittest.skipUnless(has_spawnl, 'os.spawnl not available')
def test_noinherit(self):
# _mkstemp_inner file handles are not inherited by child processes
- if not has_spawnl:
- return # ugh, can't use SkipTest.
if support.verbose:
v="v"
@@ -377,10 +375,9 @@ class TestMkstempInner(BaseTestCase):
"child process caught fatal signal %d" % -retval)
self.assertFalse(retval > 0, "child process reports failure %d"%retval)
+ @unittest.skipUnless(has_textmode, "text mode not available")
def test_textmode(self):
# _mkstemp_inner can create files in text mode
- if not has_textmode:
- return # ugh, can't use SkipTest.
# A text file is truncated at the first Ctrl+Z byte
f = self.do_create(bin=0)
@@ -556,10 +553,9 @@ class TestMkdtemp(BaseTestCase):
finally:
os.rmdir(dir)
+ @unittest.skipUnless(has_stat, 'os.stat not available')
def test_mode(self):
# mkdtemp creates directories with the proper mode
- if not has_stat:
- return # ugh, can't use SkipTest.
dir = self.do_create()
try: