summaryrefslogtreecommitdiff
path: root/Lib/test/test_compiler.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-09-04 20:09:13 +0000
committerRaymond Hettinger <python@rcn.com>2004-09-04 20:09:13 +0000
commitc494039b485b5d281ab03da36a1dc9db5fddc1cb (patch)
tree48723929d33c32002fcffd6c07afb024aa96ab7a /Lib/test/test_compiler.py
parent8e9f38588bc8124655703a603688df18d136dc64 (diff)
downloadcpython-c494039b485b5d281ab03da36a1dc9db5fddc1cb.tar.gz
Change the strategy for coping with time intensive tests from
"all or none" to "all or some". This provides much greater test coverage without eating much time. It also makes it more likely that routine regression testing will unearth bugs.
Diffstat (limited to 'Lib/test/test_compiler.py')
-rw-r--r--Lib/test/test_compiler.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_compiler.py b/Lib/test/test_compiler.py
index bc2dd701a8..63cbc0080d 100644
--- a/Lib/test/test_compiler.py
+++ b/Lib/test/test_compiler.py
@@ -2,6 +2,7 @@ import compiler
import os
import test.test_support
import unittest
+from random import random
class CompilerTest(unittest.TestCase):
@@ -18,6 +19,8 @@ class CompilerTest(unittest.TestCase):
for basename in os.listdir(dir):
if not basename.endswith(".py"):
continue
+ if not TEST_ALL and random() < 0.98:
+ continue
path = os.path.join(dir, basename)
if test.test_support.verbose:
print "compiling", path
@@ -31,7 +34,8 @@ class CompilerTest(unittest.TestCase):
compiler.compile(buf, basename, "exec")
def test_main():
- test.test_support.requires("compiler")
+ global TEST_ALL
+ TEST_ALL = test.test_support.is_resource_enabled("compiler")
test.test_support.run_unittest(CompilerTest)
if __name__ == "__main__":