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

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

Issue 13390: Hunt memory allocations in addition to reference leaks
Patch Set: Created 7 years, 11 months 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/test/regrtest.py ('k') | Lib/test/test_sys.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 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 finally: 1571 finally:
1572 del obj[item] 1572 del obj[item]
1573 1573
1574 def strip_python_stderr(stderr): 1574 def strip_python_stderr(stderr):
1575 """Strip the stderr of a Python process from potential debug output 1575 """Strip the stderr of a Python process from potential debug output
1576 emitted by the interpreter. 1576 emitted by the interpreter.
1577 1577
1578 This will typically be run on the result of the communicate() method 1578 This will typically be run on the result of the communicate() method
1579 of a subprocess.Popen object. 1579 of a subprocess.Popen object.
1580 """ 1580 """
1581 stderr = re.sub(br"\[\d+ refs\]\r?\n?$", b"", stderr).strip() 1581 stderr = re.sub(br"\[\d+ refs, \d+ blocks\]\r?\n?$", b"", stderr).strip()
1582 return stderr 1582 return stderr
1583 1583
1584 def args_from_interpreter_flags(): 1584 def args_from_interpreter_flags():
1585 """Return a list of command-line arguments reproducing the current 1585 """Return a list of command-line arguments reproducing the current
1586 settings in sys.flags and sys.warnoptions.""" 1586 settings in sys.flags and sys.warnoptions."""
1587 flag_opt_map = { 1587 flag_opt_map = {
1588 'bytes_warning': 'b', 1588 'bytes_warning': 'b',
1589 'dont_write_bytecode': 'B', 1589 'dont_write_bytecode': 'B',
1590 'ignore_environment': 'E', 1590 'ignore_environment': 'E',
1591 'no_user_site': 's', 1591 'no_user_site': 's',
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 def cleanup(): 1715 def cleanup():
1716 if attr_is_local: 1716 if attr_is_local:
1717 setattr(object_to_patch, attr_name, old_value) 1717 setattr(object_to_patch, attr_name, old_value)
1718 else: 1718 else:
1719 delattr(object_to_patch, attr_name) 1719 delattr(object_to_patch, attr_name)
1720 1720
1721 test_instance.addCleanup(cleanup) 1721 test_instance.addCleanup(cleanup)
1722 1722
1723 # actually override the attribute 1723 # actually override the attribute
1724 setattr(object_to_patch, attr_name, new_value) 1724 setattr(object_to_patch, attr_name, new_value)
OLDNEW
« no previous file with comments | « Lib/test/regrtest.py ('k') | Lib/test/test_sys.py » ('j') | no next file with comments »

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