From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D64C01382C5 for ; Sun, 6 May 2018 01:28:22 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F21CCE086F; Sun, 6 May 2018 01:28:20 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BC3BBE086F for ; Sun, 6 May 2018 01:28:19 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4C76A335C87 for ; Sun, 6 May 2018 01:28:18 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 32F1235 for ; Sun, 6 May 2018 01:28:16 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1525570010.87aeab1a62cc6fa1d48354a42ec4fa787dbe9603.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/util/futures/asyncio/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/tests/util/futures/asyncio/test_pipe_closed.py X-VCS-Directories: pym/portage/tests/util/futures/asyncio/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 87aeab1a62cc6fa1d48354a42ec4fa787dbe9603 X-VCS-Branch: master Date: Sun, 6 May 2018 01:28:16 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: c8c80880-6764-42e0-9248-b09587e46381 X-Archives-Hash: a7877100cefb730ceb68045b6f82d251 commit: 87aeab1a62cc6fa1d48354a42ec4fa787dbe9603 Author: Zac Medico gentoo org> AuthorDate: Sun May 6 01:19:08 2018 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun May 6 01:26:50 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=87aeab1a WriterPipeClosedTestCase: retry filling pipe This should suppress spurious writer callback observed twice for pypy in travis. See: https://travis-ci.org/gentoo/portage/jobs/375411936 See: https://travis-ci.org/gentoo/portage/jobs/373734825 .../tests/util/futures/asyncio/test_pipe_closed.py | 39 +++++++++++++--------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/pym/portage/tests/util/futures/asyncio/test_pipe_closed.py b/pym/portage/tests/util/futures/asyncio/test_pipe_closed.py index 5398ca35c..e63829888 100644 --- a/pym/portage/tests/util/futures/asyncio/test_pipe_closed.py +++ b/pym/portage/tests/util/futures/asyncio/test_pipe_closed.py @@ -105,25 +105,32 @@ class WriterPipeClosedTestCase(_PipeClosedTestCase, TestCase): writer_callback.called = loop.create_future() _set_nonblocking(write_end.fileno()) + loop.add_writer(write_end.fileno(), writer_callback) - # Fill up the pipe, so that no writer callbacks should be - # received until the state has changed. - while True: - try: - os.write(write_end.fileno(), 512 * b'0') - except EnvironmentError as e: - if e.errno != errno.EAGAIN: - raise + # With pypy we've seen intermittent spurious writer callbacks + # here, so retry until the correct state is achieved. + tries = 10 + while tries: + tries -= 1 + + # Fill up the pipe, so that no writer callbacks should be + # received until the state has changed. + while True: + try: + os.write(write_end.fileno(), 512 * b'0') + except EnvironmentError as e: + if e.errno != errno.EAGAIN: + raise + break + + # Allow the loop to check for IO events, and assert + # that our future is still not done. + loop.run_until_complete(asyncio.sleep(0, loop=loop)) + if writer_callback.called.done(): + writer_callback.called = loop.create_future() + else: break - # We've seen at least one spurious writer callback when - # this was registered before the pipe was filled, so - # register it afterwards. - loop.add_writer(write_end.fileno(), writer_callback) - - # Allow the loop to check for IO events, and assert - # that our future is still not done. - loop.run_until_complete(asyncio.sleep(0, loop=loop)) self.assertFalse(writer_callback.called.done()) # Demonstrate that the callback is called afer the