summaryrefslogtreecommitdiff
path: root/Lib/test/test_random.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-09-05 00:00:42 +0000
committerRaymond Hettinger <python@rcn.com>2004-09-05 00:00:42 +0000
commitc1c43cad63a88eae694b174c9a0fe6242dd5972b (patch)
tree7ece3cc683d61331c761c51dcf48e775bdb4c369 /Lib/test/test_random.py
parentc4536a1deab6b14e4579e453289bd7648d144d36 (diff)
downloadcpython-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.py6
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)