Kaydet (Commit) a7fc21ba authored tarafından Jeremy Hylton's avatar Jeremy Hylton

Silence warnings during test_os

üst cc8f44b8
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import os import os
import unittest import unittest
import warnings
from test_support import TESTFN, run_unittest from test_support import TESTFN, run_unittest
...@@ -29,6 +30,8 @@ class TemporaryFileTests(unittest.TestCase): ...@@ -29,6 +30,8 @@ class TemporaryFileTests(unittest.TestCase):
def test_tempnam(self): def test_tempnam(self):
if not hasattr(os, "tempnam"): if not hasattr(os, "tempnam"):
return return
warnings.filterwarnings("ignore", "tempnam", RuntimeWarning,
"test_os")
self.check_tempfile(os.tempnam()) self.check_tempfile(os.tempnam())
name = os.tempnam(TESTFN) name = os.tempnam(TESTFN)
...@@ -51,6 +54,8 @@ class TemporaryFileTests(unittest.TestCase): ...@@ -51,6 +54,8 @@ class TemporaryFileTests(unittest.TestCase):
def test_tmpnam(self): def test_tmpnam(self):
if not hasattr(os, "tmpnam"): if not hasattr(os, "tmpnam"):
return return
warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning,
"test_os")
self.check_tempfile(os.tmpnam()) self.check_tempfile(os.tmpnam())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment