From 7e2fa62211bacd0eec259578ff3448ab86384323 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 18 Dec 2011 13:28:17 -0800 Subject: [PATCH] PipeReaderArrayTestCase: sleep for fast computers Allows reliable triggering of the failure mode on fast computers. --- pym/portage/tests/process/test_poll.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pym/portage/tests/process/test_poll.py b/pym/portage/tests/process/test_poll.py index 30816db2b..1a0c8ce70 100644 --- a/pym/portage/tests/process/test_poll.py +++ b/pym/portage/tests/process/test_poll.py @@ -11,6 +11,7 @@ from _emerge.SpawnProcess import SpawnProcess class PipeReaderTestCase(TestCase): _use_array = False + _echo_cmd = "echo -n '%s'" def _testPipeReader(self, test_string, use_pty): """ @@ -31,7 +32,7 @@ class PipeReaderTestCase(TestCase): master_file = os.fdopen(master_fd, 'rb', 0) slave_file = os.fdopen(slave_fd, 'wb', 0) producer = SpawnProcess( - args=["bash", "-c", "echo -n '%s'" % test_string], + args=["bash", "-c", self._echo_cmd % test_string], env=os.environ, fd_pipes={1:slave_fd}, scheduler=scheduler) producer.start() @@ -67,6 +68,8 @@ class PipeReaderTestCase(TestCase): class PipeReaderArrayTestCase(PipeReaderTestCase): _use_array = True + # sleep allows reliable triggering of the failure mode on fast computers + _echo_cmd = "sleep 0.1 ; echo -n '%s'" def __init__(self, *args, **kwargs): super(PipeReaderArrayTestCase, self).__init__(*args, **kwargs) -- 2.26.2