import os
import test.test_support
import unittest
+from random import random
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
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__":
def eval_equation(self, s):
#global DEFAULT_PRECISION
#print DEFAULT_PRECISION
+
+ if not TEST_ALL and random.random() < 0.90:
+ return
+
try:
Sides = s.split('->')
L = Sides[0].strip().split()
def test_main(arith=False, verbose=None):
""" Execute the tests.
- Runs arithmetic tests if arith is True or if the "decimal" resource
- is enables in regrtest.py
+ Runs all arithmetic tests if arith is True or if the "decimal" resource
+ is enabled in regrtest.py
"""
+
+ global TEST_ALL
+ TEST_ALL = arith or is_resource_enabled('decimal')
+
test_classes = [
DecimalExplicitConstructionTest,
DecimalImplicitConstructionTest,
DecimalUsabilityTest,
DecimalPythonAPItests,
ContextAPItests,
+ DecimalTest,
]
- if arith or is_resource_enabled('decimal'):
- test_classes.extend([DecimalTest])
-
run_unittest(*test_classes)
import decimal as DecimalModule
run_doctest(DecimalModule, verbose)
- return
if __name__ == '__main__':
# Calling with no arguments runs all tests.
- # Calling with "Skip" will skipover the arithmetic tests.
+ # Calling with "Skip" will skip over 90% of the arithmetic tests.
if len(sys.argv) == 1:
test_main(arith=True, verbose=True)
elif len(sys.argv) == 2: