<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-packages/pexpect.git/tests, branch issue-20-try-2</title>
<subtitle>github.com: pexpect/pexpect.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pexpect.git/'/>
<entry>
<title>more naughty attempts, cleaning up, as not to lose</title>
<updated>2014-05-25T16:20:33+00:00</updated>
<author>
<name>jquast</name>
<email>contact@jeffquast.com</email>
</author>
<published>2014-05-25T16:20:33+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pexpect.git/commit/?id=e4d63327d2d4890b1ef549f87f0a137e6fa7eb94'/>
<id>e4d63327d2d4890b1ef549f87f0a137e6fa7eb94</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Issue #20: Strange EOF/TIMEOUT behavior</title>
<updated>2014-05-25T06:34:48+00:00</updated>
<author>
<name>jquast</name>
<email>contact@jeffquast.com</email>
</author>
<published>2014-05-25T06:29:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pexpect.git/commit/?id=78b16ad8f06ce20b5274a7a7c17f3a8a042edd46'/>
<id>78b16ad8f06ce20b5274a7a7c17f3a8a042edd46</id>
<content type='text'>
Problem
-------

When running a subprocess that writes a lot of data to stdout, then
exits, it is possible to read all data from stdout, then, when calling
waitpid(2), to be told the subprocess has not yet exited.

pexpect would then call read_nonblocking and block for a full 30
seconds, because there remains no more data on stdout.

Solution
--------

Add new parameter, poll_exit to read_nonblocking so that select(2) is
called at shorter intervals than previously done, but still up until
timeout specified, doing a poll for waitpid(2) at regular intervals.
This ensures that no longer than (default, 0.15) seconds elapse, instead
of the default of 30.

Testing
-------

Includes travis changes for python3.4, also disabling use_site_packages
which doesn't appear supported any longer (most builds have been failing
for some time). Additionally, a 'death' flag for checking select(2)
after waitpid(2) was necessary only for python3.4 on travis, i could not
reproduce locally.

All existing unit tests, of course. However, as a race condition, it is
not possible to reliably reproduce, it may require anywhere from 1 to 5
minutes of looping to cause it to reproduce, so it was not put into base
tests.

A simple program was authored::

   TIMEOUT=1
   def test_2():
       while True:
           stime = time.time()
           child = pexpect.spawn('ls -lR /dev',
                                 timeout=TIMEOUT)
           child.expect(pexpect.EOF)
           elapsed = time.time() - stime
           print('got eof in {0:0.2f} in pid {1}'
                 .format(elapsed, child.pid))
           assert math.floor(elapsed) &lt; TIMEOUT, elapsed

Without this change, this program will raise an exception after several
dozen runs, hitting the race condition.

With this change, I have been executing this program for several thousand
iterations without failed assertion.

PLEASE CONFER
-------------

@takluyver, with this change, I think we may also delete the
self.__irix_hack and its surrounding hack -- and even the first
self.isalive() check just before this change, for "some systems
such as Solaris" without any penalty in performance.

What do you think?
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Problem
-------

When running a subprocess that writes a lot of data to stdout, then
exits, it is possible to read all data from stdout, then, when calling
waitpid(2), to be told the subprocess has not yet exited.

pexpect would then call read_nonblocking and block for a full 30
seconds, because there remains no more data on stdout.

Solution
--------

Add new parameter, poll_exit to read_nonblocking so that select(2) is
called at shorter intervals than previously done, but still up until
timeout specified, doing a poll for waitpid(2) at regular intervals.
This ensures that no longer than (default, 0.15) seconds elapse, instead
of the default of 30.

Testing
-------

Includes travis changes for python3.4, also disabling use_site_packages
which doesn't appear supported any longer (most builds have been failing
for some time). Additionally, a 'death' flag for checking select(2)
after waitpid(2) was necessary only for python3.4 on travis, i could not
reproduce locally.

All existing unit tests, of course. However, as a race condition, it is
not possible to reliably reproduce, it may require anywhere from 1 to 5
minutes of looping to cause it to reproduce, so it was not put into base
tests.

A simple program was authored::

   TIMEOUT=1
   def test_2():
       while True:
           stime = time.time()
           child = pexpect.spawn('ls -lR /dev',
                                 timeout=TIMEOUT)
           child.expect(pexpect.EOF)
           elapsed = time.time() - stime
           print('got eof in {0:0.2f} in pid {1}'
                 .format(elapsed, child.pid))
           assert math.floor(elapsed) &lt; TIMEOUT, elapsed

Without this change, this program will raise an exception after several
dozen runs, hitting the race condition.

With this change, I have been executing this program for several thousand
iterations without failed assertion.

PLEASE CONFER
-------------

@takluyver, with this change, I think we may also delete the
self.__irix_hack and its surrounding hack -- and even the first
self.isalive() check just before this change, for "some systems
such as Solaris" without any penalty in performance.

What do you think?
</pre>
</div>
</content>
</entry>
<entry>
<title>assertRaises is not 2.6-&gt;3.x compatible</title>
<updated>2014-03-07T07:05:43+00:00</updated>
<author>
<name>jquast</name>
<email>contact@jeffquast.com</email>
</author>
<published>2014-03-07T07:05:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pexpect.git/commit/?id=0600cbc0d356cfa2e2fbcf2428214726085b19e2'/>
<id>0600cbc0d356cfa2e2fbcf2428214726085b19e2</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>closes issue #42, self.buffer decoded implicitly</title>
<updated>2014-03-07T06:46:43+00:00</updated>
<author>
<name>jquast</name>
<email>contact@jeffquast.com</email>
</author>
<published>2014-03-07T06:46:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pexpect.git/commit/?id=5a393f4af034e180beb275d90b1d8f7475b68a63'/>
<id>5a393f4af034e180beb275d90b1d8f7475b68a63</id>
<content type='text'>
create a unit tests which otherwise failed for python3 only: mock the
return value of set_unique_prompt for a value of False, which causes
ExceptionPxssh to raise.

previously, displaying self.buffer within the exception causes
bytes() to be implicitly decoded to str (unicode type in py3). python2
didn't care. it is implicitly decoded as 'ascii' encoding, without
warning.

Then, use the %r to represent it as b'xyz' in python3. Also, display
what we expected to be more helpful for the user. What is actually
happening here is the 'set PS1=' command is used so that pexpect can
more regularly understand when the prompt is awaiting command input, and
it is set to something more predictable. You'd be suprised what kind of
hackery can happen to prompt values even if PS1 is explicitly set,
especially in today's oh-my-zhs and git-prompt.sh extensions.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
create a unit tests which otherwise failed for python3 only: mock the
return value of set_unique_prompt for a value of False, which causes
ExceptionPxssh to raise.

previously, displaying self.buffer within the exception causes
bytes() to be implicitly decoded to str (unicode type in py3). python2
didn't care. it is implicitly decoded as 'ascii' encoding, without
warning.

Then, use the %r to represent it as b'xyz' in python3. Also, display
what we expected to be more helpful for the user. What is actually
happening here is the 'set PS1=' command is used so that pexpect can
more regularly understand when the prompt is awaiting command input, and
it is set to something more predictable. You'd be suprised what kind of
hackery can happen to prompt values even if PS1 is explicitly set,
especially in today's oh-my-zhs and git-prompt.sh extensions.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fixing test for signal interrupt exception</title>
<updated>2014-02-06T23:49:09+00:00</updated>
<author>
<name>Matthew Printz</name>
<email>matt.printz@rackspace.com</email>
</author>
<published>2014-02-06T23:49:09+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pexpect.git/commit/?id=9b74f12bbe35f2a60b5cc389438fefd0218fec40'/>
<id>9b74f12bbe35f2a60b5cc389438fefd0218fec40</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Adding test to for signal handling error</title>
<updated>2014-02-06T18:25:43+00:00</updated>
<author>
<name>Matthew Printz</name>
<email>matt.printz@rackspace.com</email>
</author>
<published>2014-02-06T18:25:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pexpect.git/commit/?id=954f2c743123f35c991318285ff7d63390e2bd62'/>
<id>954f2c743123f35c991318285ff7d63390e2bd62</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Test for previous commit</title>
<updated>2014-01-07T20:46:56+00:00</updated>
<author>
<name>Eric Hanchrow</name>
<email>ehanchrow@ine.com</email>
</author>
<published>2014-01-07T20:46:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pexpect.git/commit/?id=a541386825c547c2ba5b2b430ba7de1c14784549'/>
<id>a541386825c547c2ba5b2b430ba7de1c14784549</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Make test_sighup robust against a parent process ignoring SIGHUP</title>
<updated>2013-11-04T18:36:25+00:00</updated>
<author>
<name>Thomas Kluyver</name>
<email>takowl@gmail.com</email>
</author>
<published>2013-11-04T18:36:25+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pexpect.git/commit/?id=1fbfddf33d196fd1f211fb95efdaa810b8b5dad3'/>
<id>1fbfddf33d196fd1f211fb95efdaa810b8b5dad3</id>
<content type='text'>
Fedora build machines call signal.signal(signal.SIGHUP, signal.SIG_IGN)
as part of daemonizing, but this test needs the child process to use the
default signal handler.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fedora build machines call signal.signal(signal.SIGHUP, signal.SIG_IGN)
as part of daemonizing, but this test needs the child process to use the
default signal handler.
</pre>
</div>
</content>
</entry>
<entry>
<title>Correct test for stack trace munging</title>
<updated>2013-10-27T17:29:48+00:00</updated>
<author>
<name>Thomas Kluyver</name>
<email>takowl@gmail.com</email>
</author>
<published>2013-10-27T17:29:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pexpect.git/commit/?id=af003bc2b6ebb83902439a2ab172f08603cdfed2'/>
<id>af003bc2b6ebb83902439a2ab172f08603cdfed2</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Test and cleanup of pexpect.psh</title>
<updated>2013-10-22T00:00:06+00:00</updated>
<author>
<name>Thomas Kluyver</name>
<email>takowl@gmail.com</email>
</author>
<published>2013-10-22T00:00:06+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/pexpect.git/commit/?id=35931f5d160a8307773db35e56fcc247a51d8219'/>
<id>35931f5d160a8307773db35e56fcc247a51d8219</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
