Fix tests so they pass in -R mode
This commit is contained in:
parent
aa34b6c2e3
commit
ce4a9c9019
|
@ -42,6 +42,8 @@ Signals = getcontext().flags.keys()
|
|||
|
||||
# Tests are built around these assumed context defaults.
|
||||
# test_main() restores the original context.
|
||||
def init():
|
||||
global ORIGINAL_CONTEXT
|
||||
ORIGINAL_CONTEXT = getcontext().copy()
|
||||
DefaultContext.prec = 9
|
||||
DefaultContext.rounding = ROUND_HALF_EVEN
|
||||
|
@ -1069,6 +1071,7 @@ def test_main(arith=False, verbose=None):
|
|||
is enabled in regrtest.py
|
||||
"""
|
||||
|
||||
init()
|
||||
global TEST_ALL
|
||||
TEST_ALL = arith or is_resource_enabled('decimal')
|
||||
|
||||
|
|
|
@ -152,6 +152,10 @@ class TestSFpatches(unittest.TestCase):
|
|||
difflib.SequenceMatcher(None, old, new).get_opcodes()
|
||||
|
||||
|
||||
def test_main():
|
||||
difflib.HtmlDiff._default_prefix = 0
|
||||
Doctests = doctest.DocTestSuite(difflib)
|
||||
|
||||
run_unittest(TestSFpatches, TestSFbugs, Doctests)
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_main()
|
||||
|
|
|
@ -84,5 +84,9 @@ class TestModule(unittest.TestCase):
|
|||
def test_main(verbose=None):
|
||||
test_support.run_unittest(TestModule)
|
||||
|
||||
# Obscure hack so that this test passes after reloads (regrtest -R).
|
||||
if '__warningregistry__' in globals():
|
||||
del globals()['__warningregistry__']
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_main(verbose=True)
|
||||
|
|
Loading…
Reference in New Issue