[Python-checkins] r43744 - python/trunk/Lib/test/test_decimal.py python/trunk/Lib/test/test_difflib.py python/trunk/Lib/test/test_warnings.py
neal.norwitz
python-checkins at python.org
Sun Apr 9 10:36:47 CEST 2006
Author: neal.norwitz
Date: Sun Apr 9 10:36:46 2006
New Revision: 43744
Modified:
python/trunk/Lib/test/test_decimal.py
python/trunk/Lib/test/test_difflib.py
python/trunk/Lib/test/test_warnings.py
Log:
Fix tests so they pass in -R mode
Modified: python/trunk/Lib/test/test_decimal.py
==============================================================================
--- python/trunk/Lib/test/test_decimal.py (original)
+++ python/trunk/Lib/test/test_decimal.py Sun Apr 9 10:36:46 2006
@@ -42,11 +42,13 @@
# Tests are built around these assumed context defaults.
# test_main() restores the original context.
-ORIGINAL_CONTEXT = getcontext().copy()
-DefaultContext.prec = 9
-DefaultContext.rounding = ROUND_HALF_EVEN
-DefaultContext.traps = dict.fromkeys(Signals, 0)
-setcontext(DefaultContext)
+def init():
+ global ORIGINAL_CONTEXT
+ ORIGINAL_CONTEXT = getcontext().copy()
+ DefaultContext.prec = 9
+ DefaultContext.rounding = ROUND_HALF_EVEN
+ DefaultContext.traps = dict.fromkeys(Signals, 0)
+ setcontext(DefaultContext)
TESTDATADIR = 'decimaltestdata'
if __name__ == '__main__':
@@ -1069,6 +1071,7 @@
is enabled in regrtest.py
"""
+ init()
global TEST_ALL
TEST_ALL = arith or is_resource_enabled('decimal')
Modified: python/trunk/Lib/test/test_difflib.py
==============================================================================
--- python/trunk/Lib/test/test_difflib.py (original)
+++ python/trunk/Lib/test/test_difflib.py Sun Apr 9 10:36:46 2006
@@ -152,6 +152,10 @@
difflib.SequenceMatcher(None, old, new).get_opcodes()
-Doctests = doctest.DocTestSuite(difflib)
+def test_main():
+ difflib.HtmlDiff._default_prefix = 0
+ Doctests = doctest.DocTestSuite(difflib)
+ run_unittest(TestSFpatches, TestSFbugs, Doctests)
-run_unittest(TestSFpatches, TestSFbugs, Doctests)
+if __name__ == '__main__':
+ test_main()
Modified: python/trunk/Lib/test/test_warnings.py
==============================================================================
--- python/trunk/Lib/test/test_warnings.py (original)
+++ python/trunk/Lib/test/test_warnings.py Sun Apr 9 10:36:46 2006
@@ -84,5 +84,9 @@
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)
More information about the Python-checkins
mailing list