From: Zac Medico Date: Mon, 29 Aug 2011 03:59:26 +0000 (-0700) Subject: test_poll: fix "ResourceWarning: unclosed file" X-Git-Tag: v2.2.0_alpha52~42 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b76d113b6c23fdcb4dcbf8084e7e3773448d0ff5;p=portage.git test_poll: fix "ResourceWarning: unclosed file" --- diff --git a/pym/portage/tests/process/test_poll.py b/pym/portage/tests/process/test_poll.py index ee6ee0c3f..c3b50d4be 100644 --- a/pym/portage/tests/process/test_poll.py +++ b/pym/portage/tests/process/test_poll.py @@ -34,6 +34,14 @@ class PipeReaderTestCase(TestCase): scheduler=scheduler) consumer.start() - consumer.wait() + + # This will ensure that both tasks have exited, which + # is necessary to avoid "ResourceWarning: unclosed file" + # warnings since Python 3.2 (and also ensures that we + # don't leave any zombie child processes). + scheduler.schedule() + self.assertEqual(producer.returncode, os.EX_OK) + self.assertEqual(consumer.returncode, os.EX_OK) + output = consumer.getvalue().decode('ascii', 'replace') self.assertEqual(test_string, output)