diff options
author | Raymond Hettinger <python@rcn.com> | 2004-09-05 00:00:42 +0000 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-09-05 00:00:42 +0000 |
commit | c1c43cad63a88eae694b174c9a0fe6242dd5972b (patch) | |
tree | 7ece3cc683d61331c761c51dcf48e775bdb4c369 /Lib/test/test_random.py | |
parent | c4536a1deab6b14e4579e453289bd7648d144d36 (diff) | |
download | cpython-git-c1c43cad63a88eae694b174c9a0fe6242dd5972b.tar.gz |
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/test_random.py')
-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 139e8bf294..f30ed1fbd4 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) |