Commit c4ac8879 authored by Brian Curtin's avatar Brian Curtin

Close subprocess pipes to clear ResourceWarning messages in debug mode.

parent 1f1c247a
...@@ -24,6 +24,8 @@ def _assert_python(expected_success, *args): ...@@ -24,6 +24,8 @@ def _assert_python(expected_success, *args):
out, err = p.communicate() out, err = p.communicate()
finally: finally:
subprocess._cleanup() subprocess._cleanup()
p.stdout.close()
p.stderr.close()
rc = p.returncode rc = p.returncode
if (rc and expected_success) or (not rc and not expected_success): if (rc and expected_success) or (not rc and not expected_success):
raise AssertionError( raise AssertionError(
......
...@@ -231,6 +231,7 @@ sys.stdout.buffer.write(path)""" ...@@ -231,6 +231,7 @@ sys.stdout.buffer.write(path)"""
code = '; '.join(code) code = '; '.join(code)
p = _spawn_python_with_env('-S', '-c', code) p = _spawn_python_with_env('-S', '-c', code)
stdout, _ = p.communicate() stdout, _ = p.communicate()
p.stdout.close()
self.assertIn(path1.encode('ascii'), stdout) self.assertIn(path1.encode('ascii'), stdout)
self.assertIn(path2.encode('ascii'), stdout) self.assertIn(path2.encode('ascii'), stdout)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment