From: Raymond Hettinger Date: Sat, 4 Sep 2004 20:13:29 +0000 (+0000) Subject: SF bug #1022010: Import random fails X-Git-Tag: v2.4b1~342 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b8717631561fec74cb1ab1963d918e53ead29a97;p=python SF bug #1022010: Import random fails * Complete the previous patch by making sure that the MachineRandom tests are only run when the underlying resource is available. --- diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py index 0396e586ce..139e8bf294 100644 --- a/Lib/test/test_random.py +++ b/Lib/test/test_random.py @@ -490,11 +490,14 @@ class TestModule(unittest.TestCase): self.failUnless(set(random.__all__) <= set(dir(random))) def test_main(verbose=None): - testclasses = (WichmannHill_TestBasicOps, + testclasses = [WichmannHill_TestBasicOps, MersenneTwister_TestBasicOps, - HardwareRandom_TestBasicOps, TestDistributions, - TestModule) + TestModule] + + if random._urandom is not None: + testclasses.append(HardwareRandom_TestBasicOps) + test_support.run_unittest(*testclasses) # verify reference counting