diff options
author | Raymond Hettinger <python@rcn.com> | 2004-09-04 20:09:13 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-09-04 20:09:13 (GMT) |
commit | ed20ad8473d3ec5c44f0de03a4b0caf40cdc991f (patch) | |
tree | d249951c813998dbc58d09849311f657ada3a802 /Lib/test/test_decimal.py | |
parent | 1fbf9c5ec10d38d58837e20a681604440aa7b3da (diff) | |
download | cpython-ed20ad8473d3ec5c44f0de03a4b0caf40cdc991f.zip cpython-ed20ad8473d3ec5c44f0de03a4b0caf40cdc991f.tar.gz cpython-ed20ad8473d3ec5c44f0de03a4b0caf40cdc991f.tar.bz2 |
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_decimal.py')
-rw-r--r-- | Lib/test/test_decimal.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index 8711e4e..a4e4041 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -181,6 +181,10 @@ class DecimalTest(unittest.TestCase): 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() @@ -997,9 +1001,13 @@ class ContextAPItests(unittest.TestCase): 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, @@ -1008,20 +1016,17 @@ def test_main(arith=False, verbose=None): 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: |