[Python-checkins] cpython: Issue #25003: Skip test_os.URandomFDTests on Solaris 11.3 and newer

victor.stinner python-checkins at python.org
Fri Sep 18 16:26:37 CEST 2015


https://hg.python.org/cpython/rev/221e09b89186
changeset:   98055:221e09b89186
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Fri Sep 18 16:24:31 2015 +0200
summary:
  Issue #25003: Skip test_os.URandomFDTests on Solaris 11.3 and newer

When os.urandom() is implemented with the getrandom() function, it doesn't use
a file descriptor.

files:
  Lib/test/test_os.py |  16 +++++++++-------
  1 files changed, 9 insertions(+), 7 deletions(-)


diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -1225,13 +1225,15 @@
         self.assertNotEqual(data1, data2)
 
 
-HAVE_GETENTROPY = (sysconfig.get_config_var('HAVE_GETENTROPY') == 1)
-HAVE_GETRANDOM = (sysconfig.get_config_var('HAVE_GETRANDOM_SYSCALL') == 1)
-
- at unittest.skipIf(HAVE_GETENTROPY,
-                 "getentropy() does not use a file descriptor")
- at unittest.skipIf(HAVE_GETRANDOM,
-                 "getrandom() does not use a file descriptor")
+# os.urandom() doesn't use a file descriptor when it is implemented with the
+# getentropy() function, the getrandom() function or the getrandom() syscall
+OS_URANDOM_DONT_USE_FD = (
+    sysconfig.get_config_var('HAVE_GETENTROPY') == 1
+    or sysconfig.get_config_var('HAVE_GETRANDOM') == 1
+    or sysconfig.get_config_var('HAVE_GETRANDOM_SYSCALL') == 1)
+
+ at unittest.skipIf(OS_URANDOM_DONT_USE_FD ,
+                 "os.random() does not use a file descriptor")
 class URandomFDTests(unittest.TestCase):
     @unittest.skipUnless(resource, "test requires the resource module")
     def test_urandom_failure(self):

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list