diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-10-01 07:47:30 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-10-01 07:47:30 (GMT) |
commit | bae2d6203fca3ecaaf9fbc7cee84ad83ddf52dc5 (patch) | |
tree | 495b0afaa05b7c0d235af2e54c70015b16f4d2e3 /Lib/test | |
parent | 87bddbac9d178b549fac830adc76bc8f100b2a47 (diff) | |
download | cpython-bae2d6203fca3ecaaf9fbc7cee84ad83ddf52dc5.zip cpython-bae2d6203fca3ecaaf9fbc7cee84ad83ddf52dc5.tar.gz cpython-bae2d6203fca3ecaaf9fbc7cee84ad83ddf52dc5.tar.bz2 |
Issue #25003: On Solaris 11.3 or newer, os.urandom() now uses the getrandom()
function instead of the getentropy() function. The getentropy() function is
blocking to generate very good quality entropy, os.urandom() doesn't need such
high-quality entropy.
Diffstat (limited to 'Lib/test')
-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 bb717cc..da5a130 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1226,13 +1226,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): |