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

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

Issue 13390: Hunt memory allocations in addition to reference leaks
Patch Set: Created 6 years, 10 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 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 finally: 1765 finally:
1766 del obj[item] 1766 del obj[item]
1767 1767
1768 def strip_python_stderr(stderr): 1768 def strip_python_stderr(stderr):
1769 """Strip the stderr of a Python process from potential debug output 1769 """Strip the stderr of a Python process from potential debug output
1770 emitted by the interpreter. 1770 emitted by the interpreter.
1771 1771
1772 This will typically be run on the result of the communicate() method 1772 This will typically be run on the result of the communicate() method
1773 of a subprocess.Popen object. 1773 of a subprocess.Popen object.
1774 """ 1774 """
1775 stderr = re.sub(br"\[\d+ refs\]\r?\n?", b"", stderr).strip() 1775 stderr = re.sub(br"\[\d+ refs, \d+ blocks\]\r?\n?", b"", stderr).strip()
1776 return stderr 1776 return stderr
1777 1777
1778 def args_from_interpreter_flags(): 1778 def args_from_interpreter_flags():
1779 """Return a list of command-line arguments reproducing the current 1779 """Return a list of command-line arguments reproducing the current
1780 settings in sys.flags and sys.warnoptions.""" 1780 settings in sys.flags and sys.warnoptions."""
1781 return subprocess._args_from_interpreter_flags() 1781 return subprocess._args_from_interpreter_flags()
1782 1782
1783 #============================================================ 1783 #============================================================
1784 # Support for assertions about logging. 1784 # Support for assertions about logging.
1785 #============================================================ 1785 #============================================================
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 def cleanup(): 1927 def cleanup():
1928 if attr_is_local: 1928 if attr_is_local:
1929 setattr(object_to_patch, attr_name, old_value) 1929 setattr(object_to_patch, attr_name, old_value)
1930 else: 1930 else:
1931 delattr(object_to_patch, attr_name) 1931 delattr(object_to_patch, attr_name)
1932 1932
1933 test_instance.addCleanup(cleanup) 1933 test_instance.addCleanup(cleanup)
1934 1934
1935 # actually override the attribute 1935 # actually override the attribute
1936 setattr(object_to_patch, attr_name, new_value) 1936 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+