Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(207177)

Side by Side Diff: Lib/test/support.py

Issue 7652: Merge C version of decimal into py3k.
Patch Set: Created 8 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/decimal.py ('k') | Lib/test/test_decimal.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """Supporting definitions for the Python regression tests.""" 1 """Supporting definitions for the Python regression tests."""
2 2
3 if __name__ != 'test.support': 3 if __name__ != 'test.support':
4 raise ImportError('support must be imported from the test package') 4 raise ImportError('support must be imported from the test package')
5 5
6 import contextlib 6 import contextlib
7 import errno 7 import errno
8 import functools 8 import functools
9 import gc 9 import gc
10 import socket 10 import socket
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1399 if fnmatch.fnmatchcase(name, match_tests): 1399 if fnmatch.fnmatchcase(name, match_tests):
1400 return True 1400 return True
1401 return False 1401 return False
1402 _filter_suite(suite, case_pred) 1402 _filter_suite(suite, case_pred)
1403 _run_suite(suite) 1403 _run_suite(suite)
1404 1404
1405 1405
1406 #======================================================================= 1406 #=======================================================================
1407 # doctest driver. 1407 # doctest driver.
1408 1408
1409 def run_doctest(module, verbosity=None): 1409 def run_doctest(module, verbosity=None, optionflags=0):
1410 """Run doctest on the given module. Return (#failures, #tests). 1410 """Run doctest on the given module. Return (#failures, #tests).
1411 1411
1412 If optional argument verbosity is not specified (or is None), pass 1412 If optional argument verbosity is not specified (or is None), pass
1413 support's belief about verbosity on to doctest. Else doctest's 1413 support's belief about verbosity on to doctest. Else doctest's
1414 usual behavior is used (it searches sys.argv for -v). 1414 usual behavior is used (it searches sys.argv for -v).
1415 """ 1415 """
1416 1416
1417 import doctest 1417 import doctest
1418 1418
1419 if verbosity is None: 1419 if verbosity is None:
1420 verbosity = verbose 1420 verbosity = verbose
1421 else: 1421 else:
1422 verbosity = None 1422 verbosity = None
1423 1423
1424 f, t = doctest.testmod(module, verbose=verbosity) 1424 f, t = doctest.testmod(module, verbose=verbosity, optionflags=optionflags)
1425 if f: 1425 if f:
1426 raise TestFailed("%d of %d doctests failed" % (f, t)) 1426 raise TestFailed("%d of %d doctests failed" % (f, t))
1427 if verbose: 1427 if verbose:
1428 print('doctest (%s) ... %d tests with zero failures' % 1428 print('doctest (%s) ... %d tests with zero failures' %
1429 (module.__name__, t)) 1429 (module.__name__, t))
1430 return f, t 1430 return f, t
1431 1431
1432 1432
1433 #======================================================================= 1433 #=======================================================================
1434 # Support for saving and restoring the imported modules. 1434 # Support for saving and restoring the imported modules.
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1716 def cleanup(): 1716 def cleanup():
1717 if attr_is_local: 1717 if attr_is_local:
1718 setattr(object_to_patch, attr_name, old_value) 1718 setattr(object_to_patch, attr_name, old_value)
1719 else: 1719 else:
1720 delattr(object_to_patch, attr_name) 1720 delattr(object_to_patch, attr_name)
1721 1721
1722 test_instance.addCleanup(cleanup) 1722 test_instance.addCleanup(cleanup)
1723 1723
1724 # actually override the attribute 1724 # actually override the attribute
1725 setattr(object_to_patch, attr_name, new_value) 1725 setattr(object_to_patch, attr_name, new_value)
OLDNEW
« no previous file with comments | « Lib/decimal.py ('k') | Lib/test/test_decimal.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+