diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-12-21 00:16:38 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-12-21 00:16:38 (GMT) |
commit | fe02e3902920181b76e7e7a9c761209b7ddb1be1 (patch) | |
tree | 6dc0382c3faae561c2ccd1d2cd38fcbd0f4c3b99 /Lib/test/test_os.py | |
parent | 94cb7a24298ee0a4d6a3bb6b8ae80a7729e9f788 (diff) | |
download | cpython-fe02e3902920181b76e7e7a9c761209b7ddb1be1.zip cpython-fe02e3902920181b76e7e7a9c761209b7ddb1be1.tar.gz cpython-fe02e3902920181b76e7e7a9c761209b7ddb1be1.tar.bz2 |
Issue #22585: On OpenBSD 5.6 and newer, os.urandom() now calls getentropy(),
instead of reading /dev/urandom, to get pseudo-random bytes.
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r-- | Lib/test/test_os.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index ce6bd91..152ba93 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -27,6 +27,7 @@ import codecs import decimal import fractions import pickle +import sysconfig try: import threading except ImportError: @@ -1053,6 +1054,12 @@ class URandomTests(unittest.TestCase): data2 = self.get_urandom_subprocess(16) self.assertNotEqual(data1, data2) + +HAVE_GETENTROPY = (sysconfig.get_config_var('HAVE_GETENTROPY') == 1) + +@unittest.skipIf(HAVE_GETENTROPY, + "getentropy() does not use a file descriptor") +class URandomFDTests(unittest.TestCase): @unittest.skipUnless(resource, "test requires the resource module") def test_urandom_failure(self): # Check urandom() failing when it is not able to open /dev/random. |