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