Close subprocess pipes to clear ResourceWarning messages in debug mode.

This commit is contained in:
Brian Curtin 2010-11-01 14:00:33 +00:00
parent 1f1c247adb
commit c4ac887917
2 changed files with 3 additions and 0 deletions

View File

@ -24,6 +24,8 @@ def _assert_python(expected_success, *args):
out, err = p.communicate()
finally:
subprocess._cleanup()
p.stdout.close()
p.stderr.close()
rc = p.returncode
if (rc and expected_success) or (not rc and not expected_success):
raise AssertionError(

View File

@ -231,6 +231,7 @@ sys.stdout.buffer.write(path)"""
code = '; '.join(code)
p = _spawn_python_with_env('-S', '-c', code)
stdout, _ = p.communicate()
p.stdout.close()
self.assertIn(path1.encode('ascii'), stdout)
self.assertIn(path2.encode('ascii'), stdout)