diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-08-04 11:48:56 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-08-04 11:48:56 (GMT) |
commit | 62f68ed31f6ace44f524797787df2eb66ffb306c (patch) | |
tree | 9bec0d19f4231fa005e4d82cb2396cc9782fa242 /Lib/test/support.py | |
parent | f96482e91a1e1806a3d17b18a1307bbd67d30c15 (diff) | |
download | cpython-62f68ed31f6ace44f524797787df2eb66ffb306c.zip cpython-62f68ed31f6ace44f524797787df2eb66ffb306c.tar.gz cpython-62f68ed31f6ace44f524797787df2eb66ffb306c.tar.bz2 |
Factor out stripping of interpreter debug output in test.support.strip_python_stderr()
Diffstat (limited to 'Lib/test/support.py')
-rw-r--r-- | Lib/test/support.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py index 558fbc2..0372f16 100644 --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -1243,3 +1243,13 @@ def swap_item(obj, item, new_val): yield finally: del obj[item] + +def strip_python_stderr(stderr): + """Strip the stderr of a Python process from potential debug output + emitted by the interpreter. + + This will typically be run on the result of the communicate() method + of a subprocess.Popen object. + """ + stderr = re.sub(br"\[\d+ refs\]\r?\n?$", b"", stderr).strip() + return stderr |