From: Zac Medico Date: Sun, 18 Dec 2011 21:28:17 +0000 (-0800) Subject: PipeReaderArrayTestCase: sleep for fast computers X-Git-Tag: v2.2.0_alpha82~41 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7e2fa62211bacd0eec259578ff3448ab86384323;p=portage.git PipeReaderArrayTestCase: sleep for fast computers Allows reliable triggering of the failure mode on fast computers. --- 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)