diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-09-18 14:24:31 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-09-18 14:24:31 (GMT) |
commit | d8f432a98c6bbe143002f45e181b7e5243d1166e (patch) | |
tree | d41f2876fcc9ecc1b8ac6e3b058b4a81421cef30 | |
parent | 3abf44e48f973d5ffba779471a6c4dab00be2f77 (diff) | |
download | cpython-d8f432a98c6bbe143002f45e181b7e5243d1166e.zip cpython-d8f432a98c6bbe143002f45e181b7e5243d1166e.tar.gz cpython-d8f432a98c6bbe143002f45e181b7e5243d1166e.tar.bz2 |
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.
-rw-r--r-- | 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 index b73b64b..d4b9e9c 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1225,13 +1225,15 @@ class URandomTests(unittest.TestCase): self.assertNotEqual(data1, data2) -HAVE_GETENTROPY = (sysconfig.get_config_var('HAVE_GETENTROPY') == 1) -HAVE_GETRANDOM = (sysconfig.get_config_var('HAVE_GETRANDOM_SYSCALL') == 1) - -@unittest.skipIf(HAVE_GETENTROPY, - "getentropy() does not use a file descriptor") -@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) + +@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): |