diff options
author | Raymond Hettinger <python@rcn.com> | 2004-09-05 00:00:42 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-09-05 00:00:42 (GMT) |
commit | c1c43cad63a88eae694b174c9a0fe6242dd5972b (patch) | |
tree | 7ece3cc683d61331c761c51dcf48e775bdb4c369 /Lib/test | |
parent | c4536a1deab6b14e4579e453289bd7648d144d36 (diff) | |
download | cpython-c1c43cad63a88eae694b174c9a0fe6242dd5972b.zip cpython-c1c43cad63a88eae694b174c9a0fe6242dd5972b.tar.gz cpython-c1c43cad63a88eae694b174c9a0fe6242dd5972b.tar.bz2 |
Fulfill Martin's request to use try/except rather than a "look before
you leap" approach. Makes the early call to os.urandom() unnecessary.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_random.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py index 139e8bf..f30ed1f 100644 --- a/Lib/test/test_random.py +++ b/Lib/test/test_random.py @@ -495,7 +495,11 @@ def test_main(verbose=None): TestDistributions, TestModule] - if random._urandom is not None: + try: + random.HardwareRandom().random() + except NotImplementedError: + pass + else: testclasses.append(HardwareRandom_TestBasicOps) test_support.run_unittest(*testclasses) |