]> granicus.if.org Git - python/commitdiff
SF bug #1022010: Import random fails
authorRaymond Hettinger <python@rcn.com>
Sat, 4 Sep 2004 20:13:29 +0000 (20:13 +0000)
committerRaymond Hettinger <python@rcn.com>
Sat, 4 Sep 2004 20:13:29 +0000 (20:13 +0000)
* Complete the previous patch by making sure that the MachineRandom
  tests are only run when the underlying resource is available.

Lib/test/test_random.py

index 0396e586ce3ac870f44f74f6caefc28ed66288e9..139e8bf2948cdbab56ad00acd5c20d541aef23f8 100644 (file)
@@ -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