Skip to content

Instantly share code, notes, and snippets.

@drewsonne
Created January 27, 2018 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drewsonne/2d3083310e82f7b4302149fb353bfff3 to your computer and use it in GitHub Desktop.
Save drewsonne/2d3083310e82f7b4302149fb353bfff3 to your computer and use it in GitHub Desktop.
python-inquirer test results
$ source ~/.virtualenvs/python-inquirer/bin/activate
(python-inquirer) drews@mbp: ~/Development/python-inquirer
$ py.test
========================================================= test session starts =========================================================
platform darwin -- Python 3.5.4, pytest-3.3.2, py-1.5.2, pluggy-0.6.0
rootdir: /Users/drews/Dropbox/Development/python-inquirer, inifile: setup.cfg
plugins: xdist-1.22.0, forked-0.2, cov-2.5.1
collected 96 items
tests/acceptance/test_checkbox.py .FFFFFF. [ 8%]
tests/acceptance/test_list.py ....... [ 15%]
tests/acceptance/test_password.py FFF [ 18%]
tests/acceptance/test_pre_answers.py F [ 19%]
tests/acceptance/test_text.py FF [ 21%]
tests/integration/console_render/test_basic.py . [ 22%]
tests/integration/console_render/test_checkbox.py ............ [ 35%]
tests/integration/console_render/test_confirm.py ....... [ 42%]
tests/integration/console_render/test_list.py ....... [ 50%]
tests/integration/console_render/test_password.py .... [ 54%]
tests/integration/console_render/test_text.py ...... [ 60%]
tests/unit/test_prompt.py .... [ 64%]
tests/unit/test_question.py ............................. [ 94%]
tests/unit/test_render.py . [ 95%]
tests/unit/test_theme.py .... [100%]
============================================================== FAILURES ===============================================================
_____________________________________________________ CheckTest.test_select_last ______________________________________________________
self = <pexpect.expect.Expecter object at 0x106c62278>, timeout = 0.9997391700744629
def expect_loop(self, timeout=-1):
"""Blocking expect"""
spawn = self.spawn
if timeout is not None:
end_time = time.time() + timeout
try:
incoming = spawn.buffer
spawn.buffer = spawn.string_type() # Treat buffer as new data
while True:
idx = self.new_data(incoming)
# Keep reading until exception or return.
if idx is not None:
return idx
# No match at this point
if (timeout is not None) and (timeout < 0):
return self.timeout()
# Still have time left, so read more data
> incoming = spawn.read_nonblocking(spawn.maxread, timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.pty_spawn.spawn object at 0x106c620f0>, size = 2000, timeout = 0.9997391700744629
def read_nonblocking(self, size=1, timeout=-1):
'''This reads at most size characters from the child application. It
includes a timeout. If the read does not complete within the timeout
period then a TIMEOUT exception is raised. If the end of file is read
then an EOF exception will be raised. If a logfile is specified, a
copy is written to that log.
If timeout is None then the read may block indefinitely.
If timeout is -1 then the self.timeout value is used. If timeout is 0
then the child is polled and if there is no data immediately ready
then this will raise a TIMEOUT exception.
The timeout refers only to the amount of time to read at least one
character. This is not affected by the 'size' parameter, so if you call
read_nonblocking(size=100, timeout=30) and only one character is
available right away then one character will be returned immediately.
It will not wait for 30 seconds for another 99 characters to come in.
This is a wrapper around os.read(). It uses select.select() to
implement the timeout. '''
if self.closed:
raise ValueError('I/O operation on closed file.')
if timeout == -1:
timeout = self.timeout
# Note that some systems such as Solaris do not give an EOF when
# the child dies. In fact, you can still try to read
# from the child_fd -- it will block forever or until TIMEOUT.
# For this case, I test isalive() before doing any reading.
# If isalive() is false, then I pretend that this is the same as EOF.
if not self.isalive():
# timeout of 0 means "poll"
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 0)
if not r:
self.flag_eof = True
raise EOF('End Of File (EOF). Braindead platform.')
elif self.__irix_hack:
# Irix takes a long time before it realizes a child was terminated.
# FIXME So does this mean Irix systems are forced to always have
# FIXME a 2 second delay when calling read_nonblocking? That sucks.
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 2)
if not r and not self.isalive():
self.flag_eof = True
raise EOF('End Of File (EOF). Slow platform.')
r, w, e = select_ignore_interrupts([self.child_fd], [], [], timeout)
if not r:
if not self.isalive():
# Some platforms, such as Irix, will claim that their
# processes are alive; timeout on the select; and
# then finally admit that they are not alive.
self.flag_eof = True
raise EOF('End of File (EOF). Very slow platform.')
else:
> raise TIMEOUT('Timeout exceeded.')
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/pty_spawn.py:466: TIMEOUT
During handling of the above exception, another exception occurred:
self = <tests.acceptance.test_checkbox.CheckTest testMethod=test_select_last>
def test_select_last(self):
for i in range(10):
self.sut.send(key.DOWN)
self.sut.send(key.SPACE)
self.sut.send(key.ENTER)
self.sut.expect(
"{'interests': \['Computers', 'Books', 'History'\]}.*",
> timeout=1
)
tests/acceptance/test_checkbox.py:64:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:327: in expect
timeout, searchwindowsize, async_)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:355: in expect_list
return exp.expect_loop(timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:104: in expect_loop
return self.timeout(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.expect.Expecter object at 0x106c62278>, err = TIMEOUT('Timeout exceeded.',)
def timeout(self, err=None):
spawn = self.spawn
spawn.before = spawn.buffer
spawn.after = TIMEOUT
index = self.searcher.timeout_index
if index >= 0:
spawn.match = TIMEOUT
spawn.match_index = index
return index
else:
spawn.match = None
spawn.match_index = None
msg = str(spawn)
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
> raise TIMEOUT(msg)
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
E <pexpect.pty_spawn.spawn object at 0x106c620f0>
E command: /Users/drews/.virtualenvs/python-inquirer/bin/python
E args: ['/Users/drews/.virtualenvs/python-inquirer/bin/python', 'examples/checkbox.py']
E buffer (last 100 chars): b'K\r\n \x1b(B\x1b[m o Fantasy\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o History\x1b(B\x1b[m\x1b[K\r\n^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B \r\n'
E before (last 100 chars): b'K\r\n \x1b(B\x1b[m o Fantasy\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o History\x1b(B\x1b[m\x1b[K\r\n^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B \r\n'
E after: <class 'pexpect.exceptions.TIMEOUT'>
E match: None
E match_index: None
E exitstatus: None
E flag_eof: False
E pid: 16220
E child_fd: 11
E closed: False
E timeout: 30
E delimiter: <class 'pexpect.exceptions.EOF'>
E logfile: None
E logfile_read: None
E logfile_send: None
E maxread: 2000
E ignorecase: False
E searchwindowsize: None
E delaybeforesend: 0.05
E delayafterclose: 0.1
E delayafterterminate: 0.1
E searcher: searcher_re:
E 0: re.compile("b"{'interests': \\['Computers', 'Books', 'History'\\]}.*"")
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:68: TIMEOUT
___________________________________________________ CheckTest.test_select_one_more ____________________________________________________
self = <pexpect.expect.Expecter object at 0x106cb8550>, timeout = 0.999687910079956
def expect_loop(self, timeout=-1):
"""Blocking expect"""
spawn = self.spawn
if timeout is not None:
end_time = time.time() + timeout
try:
incoming = spawn.buffer
spawn.buffer = spawn.string_type() # Treat buffer as new data
while True:
idx = self.new_data(incoming)
# Keep reading until exception or return.
if idx is not None:
return idx
# No match at this point
if (timeout is not None) and (timeout < 0):
return self.timeout()
# Still have time left, so read more data
> incoming = spawn.read_nonblocking(spawn.maxread, timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.pty_spawn.spawn object at 0x106cb8390>, size = 2000, timeout = 0.999687910079956
def read_nonblocking(self, size=1, timeout=-1):
'''This reads at most size characters from the child application. It
includes a timeout. If the read does not complete within the timeout
period then a TIMEOUT exception is raised. If the end of file is read
then an EOF exception will be raised. If a logfile is specified, a
copy is written to that log.
If timeout is None then the read may block indefinitely.
If timeout is -1 then the self.timeout value is used. If timeout is 0
then the child is polled and if there is no data immediately ready
then this will raise a TIMEOUT exception.
The timeout refers only to the amount of time to read at least one
character. This is not affected by the 'size' parameter, so if you call
read_nonblocking(size=100, timeout=30) and only one character is
available right away then one character will be returned immediately.
It will not wait for 30 seconds for another 99 characters to come in.
This is a wrapper around os.read(). It uses select.select() to
implement the timeout. '''
if self.closed:
raise ValueError('I/O operation on closed file.')
if timeout == -1:
timeout = self.timeout
# Note that some systems such as Solaris do not give an EOF when
# the child dies. In fact, you can still try to read
# from the child_fd -- it will block forever or until TIMEOUT.
# For this case, I test isalive() before doing any reading.
# If isalive() is false, then I pretend that this is the same as EOF.
if not self.isalive():
# timeout of 0 means "poll"
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 0)
if not r:
self.flag_eof = True
raise EOF('End Of File (EOF). Braindead platform.')
elif self.__irix_hack:
# Irix takes a long time before it realizes a child was terminated.
# FIXME So does this mean Irix systems are forced to always have
# FIXME a 2 second delay when calling read_nonblocking? That sucks.
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 2)
if not r and not self.isalive():
self.flag_eof = True
raise EOF('End Of File (EOF). Slow platform.')
r, w, e = select_ignore_interrupts([self.child_fd], [], [], timeout)
if not r:
if not self.isalive():
# Some platforms, such as Irix, will claim that their
# processes are alive; timeout on the select; and
# then finally admit that they are not alive.
self.flag_eof = True
raise EOF('End of File (EOF). Very slow platform.')
else:
> raise TIMEOUT('Timeout exceeded.')
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/pty_spawn.py:466: TIMEOUT
During handling of the above exception, another exception occurred:
self = <tests.acceptance.test_checkbox.CheckTest testMethod=test_select_one_more>
def test_select_one_more(self):
self.sut.send(key.DOWN)
self.sut.send(key.DOWN)
self.sut.send(key.SPACE)
self.sut.send(key.DOWN)
self.sut.send(key.SPACE)
self.sut.send(key.ENTER)
self.sut.expect(
"{'interests': \['Computers', 'Books', 'Science', 'Nature'\]}.*",
> timeout=1
)
tests/acceptance/test_checkbox.py:32:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:327: in expect
timeout, searchwindowsize, async_)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:355: in expect_list
return exp.expect_loop(timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:104: in expect_loop
return self.timeout(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.expect.Expecter object at 0x106cb8550>, err = TIMEOUT('Timeout exceeded.',)
def timeout(self, err=None):
spawn = self.spawn
spawn.before = spawn.buffer
spawn.after = TIMEOUT
index = self.searcher.timeout_index
if index >= 0:
spawn.match = TIMEOUT
spawn.match_index = index
return index
else:
spawn.match = None
spawn.match_index = None
msg = str(spawn)
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
> raise TIMEOUT(msg)
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
E <pexpect.pty_spawn.spawn object at 0x106cb8390>
E command: /Users/drews/.virtualenvs/python-inquirer/bin/python
E args: ['/Users/drews/.virtualenvs/python-inquirer/bin/python', 'examples/checkbox.py']
E buffer (last 100 chars): b'\r\n \x1b(B\x1b[m o Nature\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o Fantasy\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o History\x1b(B\x1b[m\x1b[K\r\n^[[B ^[[B \r\n'
E before (last 100 chars): b'\r\n \x1b(B\x1b[m o Nature\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o Fantasy\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o History\x1b(B\x1b[m\x1b[K\r\n^[[B ^[[B \r\n'
E after: <class 'pexpect.exceptions.TIMEOUT'>
E match: None
E match_index: None
E exitstatus: None
E flag_eof: False
E pid: 16221
E child_fd: 12
E closed: False
E timeout: 30
E delimiter: <class 'pexpect.exceptions.EOF'>
E logfile: None
E logfile_read: None
E logfile_send: None
E maxread: 2000
E ignorecase: False
E searchwindowsize: None
E delaybeforesend: 0.05
E delayafterclose: 0.1
E delayafterterminate: 0.1
E searcher: searcher_re:
E 0: re.compile("b"{'interests': \\['Computers', 'Books', 'Science', 'Nature'\\]}.*"")
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:68: TIMEOUT
___________________________________________________ CheckTest.test_select_the_third ___________________________________________________
self = <pexpect.expect.Expecter object at 0x106c89358>, timeout = 0.9997289180755615
def expect_loop(self, timeout=-1):
"""Blocking expect"""
spawn = self.spawn
if timeout is not None:
end_time = time.time() + timeout
try:
incoming = spawn.buffer
spawn.buffer = spawn.string_type() # Treat buffer as new data
while True:
idx = self.new_data(incoming)
# Keep reading until exception or return.
if idx is not None:
return idx
# No match at this point
if (timeout is not None) and (timeout < 0):
return self.timeout()
# Still have time left, so read more data
> incoming = spawn.read_nonblocking(spawn.maxread, timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.pty_spawn.spawn object at 0x106c89128>, size = 2000, timeout = 0.9997289180755615
def read_nonblocking(self, size=1, timeout=-1):
'''This reads at most size characters from the child application. It
includes a timeout. If the read does not complete within the timeout
period then a TIMEOUT exception is raised. If the end of file is read
then an EOF exception will be raised. If a logfile is specified, a
copy is written to that log.
If timeout is None then the read may block indefinitely.
If timeout is -1 then the self.timeout value is used. If timeout is 0
then the child is polled and if there is no data immediately ready
then this will raise a TIMEOUT exception.
The timeout refers only to the amount of time to read at least one
character. This is not affected by the 'size' parameter, so if you call
read_nonblocking(size=100, timeout=30) and only one character is
available right away then one character will be returned immediately.
It will not wait for 30 seconds for another 99 characters to come in.
This is a wrapper around os.read(). It uses select.select() to
implement the timeout. '''
if self.closed:
raise ValueError('I/O operation on closed file.')
if timeout == -1:
timeout = self.timeout
# Note that some systems such as Solaris do not give an EOF when
# the child dies. In fact, you can still try to read
# from the child_fd -- it will block forever or until TIMEOUT.
# For this case, I test isalive() before doing any reading.
# If isalive() is false, then I pretend that this is the same as EOF.
if not self.isalive():
# timeout of 0 means "poll"
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 0)
if not r:
self.flag_eof = True
raise EOF('End Of File (EOF). Braindead platform.')
elif self.__irix_hack:
# Irix takes a long time before it realizes a child was terminated.
# FIXME So does this mean Irix systems are forced to always have
# FIXME a 2 second delay when calling read_nonblocking? That sucks.
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 2)
if not r and not self.isalive():
self.flag_eof = True
raise EOF('End Of File (EOF). Slow platform.')
r, w, e = select_ignore_interrupts([self.child_fd], [], [], timeout)
if not r:
if not self.isalive():
# Some platforms, such as Irix, will claim that their
# processes are alive; timeout on the select; and
# then finally admit that they are not alive.
self.flag_eof = True
raise EOF('End of File (EOF). Very slow platform.')
else:
> raise TIMEOUT('Timeout exceeded.')
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/pty_spawn.py:466: TIMEOUT
During handling of the above exception, another exception occurred:
self = <tests.acceptance.test_checkbox.CheckTest testMethod=test_select_the_third>
def test_select_the_third(self):
self.sut.send(key.DOWN)
self.sut.send(key.DOWN)
self.sut.send(key.SPACE)
self.sut.send(key.ENTER)
self.sut.expect(
> "{'interests': \['Computers', 'Books', 'Science'\]}.*", timeout=1)
tests/acceptance/test_checkbox.py:21:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:327: in expect
timeout, searchwindowsize, async_)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:355: in expect_list
return exp.expect_loop(timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:104: in expect_loop
return self.timeout(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.expect.Expecter object at 0x106c89358>, err = TIMEOUT('Timeout exceeded.',)
def timeout(self, err=None):
spawn = self.spawn
spawn.before = spawn.buffer
spawn.after = TIMEOUT
index = self.searcher.timeout_index
if index >= 0:
spawn.match = TIMEOUT
spawn.match_index = index
return index
else:
spawn.match = None
spawn.match_index = None
msg = str(spawn)
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
> raise TIMEOUT(msg)
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
E <pexpect.pty_spawn.spawn object at 0x106c89128>
E command: /Users/drews/.virtualenvs/python-inquirer/bin/python
E args: ['/Users/drews/.virtualenvs/python-inquirer/bin/python', 'examples/checkbox.py']
E buffer (last 100 chars): b'[m\x1b[K\r\n \x1b(B\x1b[m o Nature\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o Fantasy\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o History\x1b(B\x1b[m\x1b[K\r\n^[[B \r\n'
E before (last 100 chars): b'[m\x1b[K\r\n \x1b(B\x1b[m o Nature\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o Fantasy\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o History\x1b(B\x1b[m\x1b[K\r\n^[[B \r\n'
E after: <class 'pexpect.exceptions.TIMEOUT'>
E match: None
E match_index: None
E exitstatus: None
E flag_eof: False
E pid: 16222
E child_fd: 13
E closed: False
E timeout: 30
E delimiter: <class 'pexpect.exceptions.EOF'>
E logfile: None
E logfile_read: None
E logfile_send: None
E maxread: 2000
E ignorecase: False
E searchwindowsize: None
E delaybeforesend: 0.05
E delayafterclose: 0.1
E delayafterterminate: 0.1
E searcher: searcher_re:
E 0: re.compile("b"{'interests': \\['Computers', 'Books', 'Science'\\]}.*"")
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:68: TIMEOUT
__________________________________________________ CheckTest.test_select_with_arrows __________________________________________________
self = <pexpect.expect.Expecter object at 0x106ccad68>, timeout = 0.999445915222168
def expect_loop(self, timeout=-1):
"""Blocking expect"""
spawn = self.spawn
if timeout is not None:
end_time = time.time() + timeout
try:
incoming = spawn.buffer
spawn.buffer = spawn.string_type() # Treat buffer as new data
while True:
idx = self.new_data(incoming)
# Keep reading until exception or return.
if idx is not None:
return idx
# No match at this point
if (timeout is not None) and (timeout < 0):
return self.timeout()
# Still have time left, so read more data
> incoming = spawn.read_nonblocking(spawn.maxread, timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.pty_spawn.spawn object at 0x106ccae80>, size = 2000, timeout = 0.999445915222168
def read_nonblocking(self, size=1, timeout=-1):
'''This reads at most size characters from the child application. It
includes a timeout. If the read does not complete within the timeout
period then a TIMEOUT exception is raised. If the end of file is read
then an EOF exception will be raised. If a logfile is specified, a
copy is written to that log.
If timeout is None then the read may block indefinitely.
If timeout is -1 then the self.timeout value is used. If timeout is 0
then the child is polled and if there is no data immediately ready
then this will raise a TIMEOUT exception.
The timeout refers only to the amount of time to read at least one
character. This is not affected by the 'size' parameter, so if you call
read_nonblocking(size=100, timeout=30) and only one character is
available right away then one character will be returned immediately.
It will not wait for 30 seconds for another 99 characters to come in.
This is a wrapper around os.read(). It uses select.select() to
implement the timeout. '''
if self.closed:
raise ValueError('I/O operation on closed file.')
if timeout == -1:
timeout = self.timeout
# Note that some systems such as Solaris do not give an EOF when
# the child dies. In fact, you can still try to read
# from the child_fd -- it will block forever or until TIMEOUT.
# For this case, I test isalive() before doing any reading.
# If isalive() is false, then I pretend that this is the same as EOF.
if not self.isalive():
# timeout of 0 means "poll"
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 0)
if not r:
self.flag_eof = True
raise EOF('End Of File (EOF). Braindead platform.')
elif self.__irix_hack:
# Irix takes a long time before it realizes a child was terminated.
# FIXME So does this mean Irix systems are forced to always have
# FIXME a 2 second delay when calling read_nonblocking? That sucks.
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 2)
if not r and not self.isalive():
self.flag_eof = True
raise EOF('End Of File (EOF). Slow platform.')
r, w, e = select_ignore_interrupts([self.child_fd], [], [], timeout)
if not r:
if not self.isalive():
# Some platforms, such as Irix, will claim that their
# processes are alive; timeout on the select; and
# then finally admit that they are not alive.
self.flag_eof = True
raise EOF('End of File (EOF). Very slow platform.')
else:
> raise TIMEOUT('Timeout exceeded.')
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/pty_spawn.py:466: TIMEOUT
During handling of the above exception, another exception occurred:
self = <tests.acceptance.test_checkbox.CheckTest testMethod=test_select_with_arrows>
def test_select_with_arrows(self):
self.sut.send(key.DOWN)
self.sut.send(key.DOWN)
self.sut.send(key.RIGHT)
self.sut.send(key.ENTER)
self.sut.expect(
"{'interests': \['Computers', 'Books', 'Science'\]}.*",
> timeout=1
)
tests/acceptance/test_checkbox.py:48:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:327: in expect
timeout, searchwindowsize, async_)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:355: in expect_list
return exp.expect_loop(timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:104: in expect_loop
return self.timeout(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.expect.Expecter object at 0x106ccad68>, err = TIMEOUT('Timeout exceeded.',)
def timeout(self, err=None):
spawn = self.spawn
spawn.before = spawn.buffer
spawn.after = TIMEOUT
index = self.searcher.timeout_index
if index >= 0:
spawn.match = TIMEOUT
spawn.match_index = index
return index
else:
spawn.match = None
spawn.match_index = None
msg = str(spawn)
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
> raise TIMEOUT(msg)
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
E <pexpect.pty_spawn.spawn object at 0x106ccae80>
E command: /Users/drews/.virtualenvs/python-inquirer/bin/python
E args: ['/Users/drews/.virtualenvs/python-inquirer/bin/python', 'examples/checkbox.py']
E buffer (last 100 chars): b'[K\r\n \x1b(B\x1b[m o Nature\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o Fantasy\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o History\x1b(B\x1b[m\x1b[K\r\n^[[B^[[C\r\n'
E before (last 100 chars): b'[K\r\n \x1b(B\x1b[m o Nature\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o Fantasy\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o History\x1b(B\x1b[m\x1b[K\r\n^[[B^[[C\r\n'
E after: <class 'pexpect.exceptions.TIMEOUT'>
E match: None
E match_index: None
E exitstatus: None
E flag_eof: False
E pid: 16223
E child_fd: 14
E closed: False
E timeout: 30
E delimiter: <class 'pexpect.exceptions.EOF'>
E logfile: None
E logfile_read: None
E logfile_send: None
E maxread: 2000
E ignorecase: False
E searchwindowsize: None
E delaybeforesend: 0.05
E delayafterclose: 0.1
E delayafterterminate: 0.1
E searcher: searcher_re:
E 0: re.compile("b"{'interests': \\['Computers', 'Books', 'Science'\\]}.*"")
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:68: TIMEOUT
_______________________________________________________ CheckTest.test_unselect _______________________________________________________
self = <pexpect.expect.Expecter object at 0x106ce1fd0>, timeout = 0.9997279644012451
def expect_loop(self, timeout=-1):
"""Blocking expect"""
spawn = self.spawn
if timeout is not None:
end_time = time.time() + timeout
try:
incoming = spawn.buffer
spawn.buffer = spawn.string_type() # Treat buffer as new data
while True:
idx = self.new_data(incoming)
# Keep reading until exception or return.
if idx is not None:
return idx
# No match at this point
if (timeout is not None) and (timeout < 0):
return self.timeout()
# Still have time left, so read more data
> incoming = spawn.read_nonblocking(spawn.maxread, timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.pty_spawn.spawn object at 0x106ce1ba8>, size = 2000, timeout = 0.9997279644012451
def read_nonblocking(self, size=1, timeout=-1):
'''This reads at most size characters from the child application. It
includes a timeout. If the read does not complete within the timeout
period then a TIMEOUT exception is raised. If the end of file is read
then an EOF exception will be raised. If a logfile is specified, a
copy is written to that log.
If timeout is None then the read may block indefinitely.
If timeout is -1 then the self.timeout value is used. If timeout is 0
then the child is polled and if there is no data immediately ready
then this will raise a TIMEOUT exception.
The timeout refers only to the amount of time to read at least one
character. This is not affected by the 'size' parameter, so if you call
read_nonblocking(size=100, timeout=30) and only one character is
available right away then one character will be returned immediately.
It will not wait for 30 seconds for another 99 characters to come in.
This is a wrapper around os.read(). It uses select.select() to
implement the timeout. '''
if self.closed:
raise ValueError('I/O operation on closed file.')
if timeout == -1:
timeout = self.timeout
# Note that some systems such as Solaris do not give an EOF when
# the child dies. In fact, you can still try to read
# from the child_fd -- it will block forever or until TIMEOUT.
# For this case, I test isalive() before doing any reading.
# If isalive() is false, then I pretend that this is the same as EOF.
if not self.isalive():
# timeout of 0 means "poll"
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 0)
if not r:
self.flag_eof = True
raise EOF('End Of File (EOF). Braindead platform.')
elif self.__irix_hack:
# Irix takes a long time before it realizes a child was terminated.
# FIXME So does this mean Irix systems are forced to always have
# FIXME a 2 second delay when calling read_nonblocking? That sucks.
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 2)
if not r and not self.isalive():
self.flag_eof = True
raise EOF('End Of File (EOF). Slow platform.')
r, w, e = select_ignore_interrupts([self.child_fd], [], [], timeout)
if not r:
if not self.isalive():
# Some platforms, such as Irix, will claim that their
# processes are alive; timeout on the select; and
# then finally admit that they are not alive.
self.flag_eof = True
raise EOF('End of File (EOF). Very slow platform.')
else:
> raise TIMEOUT('Timeout exceeded.')
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/pty_spawn.py:466: TIMEOUT
During handling of the above exception, another exception occurred:
self = <tests.acceptance.test_checkbox.CheckTest testMethod=test_unselect>
def test_unselect(self):
self.sut.send(key.SPACE)
self.sut.send(key.SPACE)
self.sut.send(key.ENTER)
> self.sut.expect("{'interests': \['Books', 'Computers'\]}.*", timeout=1)
tests/acceptance/test_checkbox.py:39:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:327: in expect
timeout, searchwindowsize, async_)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:355: in expect_list
return exp.expect_loop(timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:104: in expect_loop
return self.timeout(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.expect.Expecter object at 0x106ce1fd0>, err = TIMEOUT('Timeout exceeded.',)
def timeout(self, err=None):
spawn = self.spawn
spawn.before = spawn.buffer
spawn.after = TIMEOUT
index = self.searcher.timeout_index
if index >= 0:
spawn.match = TIMEOUT
spawn.match_index = index
return index
else:
spawn.match = None
spawn.match_index = None
msg = str(spawn)
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
> raise TIMEOUT(msg)
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
E <pexpect.pty_spawn.spawn object at 0x106ce1ba8>
E command: /Users/drews/.virtualenvs/python-inquirer/bin/python
E args: ['/Users/drews/.virtualenvs/python-inquirer/bin/python', 'examples/checkbox.py']
E buffer (last 100 chars): b'\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o Nature\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o Fantasy\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o History\x1b(B\x1b[m\x1b[K\r\n \r\n'
E before (last 100 chars): b'\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o Nature\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o Fantasy\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o History\x1b(B\x1b[m\x1b[K\r\n \r\n'
E after: <class 'pexpect.exceptions.TIMEOUT'>
E match: None
E match_index: None
E exitstatus: None
E flag_eof: False
E pid: 16224
E child_fd: 15
E closed: False
E timeout: 30
E delimiter: <class 'pexpect.exceptions.EOF'>
E logfile: None
E logfile_read: None
E logfile_send: None
E maxread: 2000
E ignorecase: False
E searchwindowsize: None
E delaybeforesend: 0.05
E delayafterclose: 0.1
E delayafterterminate: 0.1
E searcher: searcher_re:
E 0: re.compile("b"{'interests': \\['Books', 'Computers'\\]}.*"")
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:68: TIMEOUT
_________________________________________________ CheckTest.test_unselect_with_arrows _________________________________________________
self = <pexpect.expect.Expecter object at 0x106d51a90>, timeout = 0.9996798038482666
def expect_loop(self, timeout=-1):
"""Blocking expect"""
spawn = self.spawn
if timeout is not None:
end_time = time.time() + timeout
try:
incoming = spawn.buffer
spawn.buffer = spawn.string_type() # Treat buffer as new data
while True:
idx = self.new_data(incoming)
# Keep reading until exception or return.
if idx is not None:
return idx
# No match at this point
if (timeout is not None) and (timeout < 0):
return self.timeout()
# Still have time left, so read more data
> incoming = spawn.read_nonblocking(spawn.maxread, timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.pty_spawn.spawn object at 0x106d519e8>, size = 2000, timeout = 0.9996798038482666
def read_nonblocking(self, size=1, timeout=-1):
'''This reads at most size characters from the child application. It
includes a timeout. If the read does not complete within the timeout
period then a TIMEOUT exception is raised. If the end of file is read
then an EOF exception will be raised. If a logfile is specified, a
copy is written to that log.
If timeout is None then the read may block indefinitely.
If timeout is -1 then the self.timeout value is used. If timeout is 0
then the child is polled and if there is no data immediately ready
then this will raise a TIMEOUT exception.
The timeout refers only to the amount of time to read at least one
character. This is not affected by the 'size' parameter, so if you call
read_nonblocking(size=100, timeout=30) and only one character is
available right away then one character will be returned immediately.
It will not wait for 30 seconds for another 99 characters to come in.
This is a wrapper around os.read(). It uses select.select() to
implement the timeout. '''
if self.closed:
raise ValueError('I/O operation on closed file.')
if timeout == -1:
timeout = self.timeout
# Note that some systems such as Solaris do not give an EOF when
# the child dies. In fact, you can still try to read
# from the child_fd -- it will block forever or until TIMEOUT.
# For this case, I test isalive() before doing any reading.
# If isalive() is false, then I pretend that this is the same as EOF.
if not self.isalive():
# timeout of 0 means "poll"
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 0)
if not r:
self.flag_eof = True
raise EOF('End Of File (EOF). Braindead platform.')
elif self.__irix_hack:
# Irix takes a long time before it realizes a child was terminated.
# FIXME So does this mean Irix systems are forced to always have
# FIXME a 2 second delay when calling read_nonblocking? That sucks.
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 2)
if not r and not self.isalive():
self.flag_eof = True
raise EOF('End Of File (EOF). Slow platform.')
r, w, e = select_ignore_interrupts([self.child_fd], [], [], timeout)
if not r:
if not self.isalive():
# Some platforms, such as Irix, will claim that their
# processes are alive; timeout on the select; and
# then finally admit that they are not alive.
self.flag_eof = True
raise EOF('End of File (EOF). Very slow platform.')
else:
> raise TIMEOUT('Timeout exceeded.')
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/pty_spawn.py:466: TIMEOUT
During handling of the above exception, another exception occurred:
self = <tests.acceptance.test_checkbox.CheckTest testMethod=test_unselect_with_arrows>
def test_unselect_with_arrows(self):
self.sut.send(key.DOWN)
self.sut.send(key.LEFT)
self.sut.send(key.ENTER)
> self.sut.expect("{'interests': \['Computers'\]}.*", timeout=1)
tests/acceptance/test_checkbox.py:55:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:327: in expect
timeout, searchwindowsize, async_)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:355: in expect_list
return exp.expect_loop(timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:104: in expect_loop
return self.timeout(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.expect.Expecter object at 0x106d51a90>, err = TIMEOUT('Timeout exceeded.',)
def timeout(self, err=None):
spawn = self.spawn
spawn.before = spawn.buffer
spawn.after = TIMEOUT
index = self.searcher.timeout_index
if index >= 0:
spawn.match = TIMEOUT
spawn.match_index = index
return index
else:
spawn.match = None
spawn.match_index = None
msg = str(spawn)
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
> raise TIMEOUT(msg)
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
E <pexpect.pty_spawn.spawn object at 0x106d519e8>
E command: /Users/drews/.virtualenvs/python-inquirer/bin/python
E args: ['/Users/drews/.virtualenvs/python-inquirer/bin/python', 'examples/checkbox.py']
E buffer (last 100 chars): b'\x1b[m\x1b[K\r\n \x1b(B\x1b[m o Nature\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o Fantasy\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o History\x1b(B\x1b[m\x1b[K\r\n^[[D\r\n'
E before (last 100 chars): b'\x1b[m\x1b[K\r\n \x1b(B\x1b[m o Nature\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o Fantasy\x1b(B\x1b[m\x1b[K\r\n \x1b(B\x1b[m o History\x1b(B\x1b[m\x1b[K\r\n^[[D\r\n'
E after: <class 'pexpect.exceptions.TIMEOUT'>
E match: None
E match_index: None
E exitstatus: None
E flag_eof: False
E pid: 16225
E child_fd: 16
E closed: False
E timeout: 30
E delimiter: <class 'pexpect.exceptions.EOF'>
E logfile: None
E logfile_read: None
E logfile_send: None
E maxread: 2000
E ignorecase: False
E searchwindowsize: None
E delaybeforesend: 0.05
E delayafterclose: 0.1
E delayafterterminate: 0.1
E searcher: searcher_re:
E 0: re.compile("b"{'interests': \\['Computers'\\]}.*"")
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:68: TIMEOUT
_____________________________________________________ PasswordTest.test_backspace _____________________________________________________
self = <pexpect.expect.Expecter object at 0x106ce3ba8>, timeout = 0.998056173324585
def expect_loop(self, timeout=-1):
"""Blocking expect"""
spawn = self.spawn
if timeout is not None:
end_time = time.time() + timeout
try:
incoming = spawn.buffer
spawn.buffer = spawn.string_type() # Treat buffer as new data
while True:
idx = self.new_data(incoming)
# Keep reading until exception or return.
if idx is not None:
return idx
# No match at this point
if (timeout is not None) and (timeout < 0):
return self.timeout()
# Still have time left, so read more data
> incoming = spawn.read_nonblocking(spawn.maxread, timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.pty_spawn.spawn object at 0x106ce3be0>, size = 2000, timeout = 0.998056173324585
def read_nonblocking(self, size=1, timeout=-1):
'''This reads at most size characters from the child application. It
includes a timeout. If the read does not complete within the timeout
period then a TIMEOUT exception is raised. If the end of file is read
then an EOF exception will be raised. If a logfile is specified, a
copy is written to that log.
If timeout is None then the read may block indefinitely.
If timeout is -1 then the self.timeout value is used. If timeout is 0
then the child is polled and if there is no data immediately ready
then this will raise a TIMEOUT exception.
The timeout refers only to the amount of time to read at least one
character. This is not affected by the 'size' parameter, so if you call
read_nonblocking(size=100, timeout=30) and only one character is
available right away then one character will be returned immediately.
It will not wait for 30 seconds for another 99 characters to come in.
This is a wrapper around os.read(). It uses select.select() to
implement the timeout. '''
if self.closed:
raise ValueError('I/O operation on closed file.')
if timeout == -1:
timeout = self.timeout
# Note that some systems such as Solaris do not give an EOF when
# the child dies. In fact, you can still try to read
# from the child_fd -- it will block forever or until TIMEOUT.
# For this case, I test isalive() before doing any reading.
# If isalive() is false, then I pretend that this is the same as EOF.
if not self.isalive():
# timeout of 0 means "poll"
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 0)
if not r:
self.flag_eof = True
raise EOF('End Of File (EOF). Braindead platform.')
elif self.__irix_hack:
# Irix takes a long time before it realizes a child was terminated.
# FIXME So does this mean Irix systems are forced to always have
# FIXME a 2 second delay when calling read_nonblocking? That sucks.
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 2)
if not r and not self.isalive():
self.flag_eof = True
raise EOF('End Of File (EOF). Slow platform.')
r, w, e = select_ignore_interrupts([self.child_fd], [], [], timeout)
if not r:
if not self.isalive():
# Some platforms, such as Irix, will claim that their
# processes are alive; timeout on the select; and
# then finally admit that they are not alive.
self.flag_eof = True
raise EOF('End of File (EOF). Very slow platform.')
else:
> raise TIMEOUT('Timeout exceeded.')
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/pty_spawn.py:466: TIMEOUT
During handling of the above exception, another exception occurred:
self = <tests.acceptance.test_password.PasswordTest testMethod=test_backspace>
def test_backspace(self):
self.sut.expect("What's.*", timeout=1)
self.sut.send('abcde')
self.sut.send(key.BACKSPACE)
self.sut.send(key.ENTER)
> self.sut.expect("{'password': 'abcd'}", timeout=1)
tests/acceptance/test_password.py:21:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:327: in expect
timeout, searchwindowsize, async_)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:355: in expect_list
return exp.expect_loop(timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:104: in expect_loop
return self.timeout(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.expect.Expecter object at 0x106ce3ba8>, err = TIMEOUT('Timeout exceeded.',)
def timeout(self, err=None):
spawn = self.spawn
spawn.before = spawn.buffer
spawn.after = TIMEOUT
index = self.searcher.timeout_index
if index >= 0:
spawn.match = TIMEOUT
spawn.match_index = index
return index
else:
spawn.match = None
spawn.match_index = None
msg = str(spawn)
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
> raise TIMEOUT(msg)
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
E <pexpect.pty_spawn.spawn object at 0x106ce3be0>
E command: /Users/drews/.virtualenvs/python-inquirer/bin/python
E args: ['/Users/drews/.virtualenvs/python-inquirer/bin/python', 'examples/password.py']
E buffer (last 100 chars): b"'s your password: ****\r\r\x1b7\x1b[79;1H\x1b[J\x1b8\r\n\x1b[A\x1b[K\x1b(B\x1b[m[\x1b[33m?\x1b(B\x1b[m]\x1b(B\x1b[m What's your password: *****"
E before (last 100 chars): b"'s your password: ****\r\r\x1b7\x1b[79;1H\x1b[J\x1b8\r\n\x1b[A\x1b[K\x1b(B\x1b[m[\x1b[33m?\x1b(B\x1b[m]\x1b(B\x1b[m What's your password: *****"
E after: <class 'pexpect.exceptions.TIMEOUT'>
E match: None
E match_index: None
E exitstatus: None
E flag_eof: False
E pid: 16234
E child_fd: 17
E closed: False
E timeout: 30
E delimiter: <class 'pexpect.exceptions.EOF'>
E logfile: None
E logfile_read: None
E logfile_send: None
E maxread: 2000
E ignorecase: False
E searchwindowsize: None
E delaybeforesend: 0.05
E delayafterclose: 0.1
E delayafterterminate: 0.1
E searcher: searcher_re:
E 0: re.compile("b"{'password': 'abcd'}"")
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:68: TIMEOUT
__________________________________________________ PasswordTest.test_backspace_limit __________________________________________________
self = <pexpect.expect.Expecter object at 0x106cb85f8>, timeout = 0.9997289180755615
def expect_loop(self, timeout=-1):
"""Blocking expect"""
spawn = self.spawn
if timeout is not None:
end_time = time.time() + timeout
try:
incoming = spawn.buffer
spawn.buffer = spawn.string_type() # Treat buffer as new data
while True:
idx = self.new_data(incoming)
# Keep reading until exception or return.
if idx is not None:
return idx
# No match at this point
if (timeout is not None) and (timeout < 0):
return self.timeout()
# Still have time left, so read more data
> incoming = spawn.read_nonblocking(spawn.maxread, timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.pty_spawn.spawn object at 0x106cb8ac8>, size = 2000, timeout = 0.9997289180755615
def read_nonblocking(self, size=1, timeout=-1):
'''This reads at most size characters from the child application. It
includes a timeout. If the read does not complete within the timeout
period then a TIMEOUT exception is raised. If the end of file is read
then an EOF exception will be raised. If a logfile is specified, a
copy is written to that log.
If timeout is None then the read may block indefinitely.
If timeout is -1 then the self.timeout value is used. If timeout is 0
then the child is polled and if there is no data immediately ready
then this will raise a TIMEOUT exception.
The timeout refers only to the amount of time to read at least one
character. This is not affected by the 'size' parameter, so if you call
read_nonblocking(size=100, timeout=30) and only one character is
available right away then one character will be returned immediately.
It will not wait for 30 seconds for another 99 characters to come in.
This is a wrapper around os.read(). It uses select.select() to
implement the timeout. '''
if self.closed:
raise ValueError('I/O operation on closed file.')
if timeout == -1:
timeout = self.timeout
# Note that some systems such as Solaris do not give an EOF when
# the child dies. In fact, you can still try to read
# from the child_fd -- it will block forever or until TIMEOUT.
# For this case, I test isalive() before doing any reading.
# If isalive() is false, then I pretend that this is the same as EOF.
if not self.isalive():
# timeout of 0 means "poll"
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 0)
if not r:
self.flag_eof = True
raise EOF('End Of File (EOF). Braindead platform.')
elif self.__irix_hack:
# Irix takes a long time before it realizes a child was terminated.
# FIXME So does this mean Irix systems are forced to always have
# FIXME a 2 second delay when calling read_nonblocking? That sucks.
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 2)
if not r and not self.isalive():
self.flag_eof = True
raise EOF('End Of File (EOF). Slow platform.')
r, w, e = select_ignore_interrupts([self.child_fd], [], [], timeout)
if not r:
if not self.isalive():
# Some platforms, such as Irix, will claim that their
# processes are alive; timeout on the select; and
# then finally admit that they are not alive.
self.flag_eof = True
raise EOF('End of File (EOF). Very slow platform.')
else:
> raise TIMEOUT('Timeout exceeded.')
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/pty_spawn.py:466: TIMEOUT
During handling of the above exception, another exception occurred:
self = <tests.acceptance.test_password.PasswordTest testMethod=test_backspace_limit>
def test_backspace_limit(self):
self.sut.expect("What's.*", timeout=1)
self.sut.send('a')
self.sut.send(key.BACKSPACE)
self.sut.send(key.BACKSPACE)
self.sut.send('b')
self.sut.send(key.ENTER)
> self.sut.expect("{'password': 'b'}", timeout=1)
tests/acceptance/test_password.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:327: in expect
timeout, searchwindowsize, async_)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:355: in expect_list
return exp.expect_loop(timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:104: in expect_loop
return self.timeout(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.expect.Expecter object at 0x106cb85f8>, err = TIMEOUT('Timeout exceeded.',)
def timeout(self, err=None):
spawn = self.spawn
spawn.before = spawn.buffer
spawn.after = TIMEOUT
index = self.searcher.timeout_index
if index >= 0:
spawn.match = TIMEOUT
spawn.match_index = index
return index
else:
spawn.match = None
spawn.match_index = None
msg = str(spawn)
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
> raise TIMEOUT(msg)
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
E <pexpect.pty_spawn.spawn object at 0x106cb8ac8>
E command: /Users/drews/.virtualenvs/python-inquirer/bin/python
E args: ['/Users/drews/.virtualenvs/python-inquirer/bin/python', 'examples/password.py']
E buffer (last 100 chars): b"\r\r\x1b7\x1b[79;1H\x1b[J\x1b8\r\n\x1b[A\x1b[K\x1b(B\x1b[m[\x1b[33m?\x1b(B\x1b[m]\x1b(B\x1b[m What's your password: *b\r\n"
E before (last 100 chars): b"\r\r\x1b7\x1b[79;1H\x1b[J\x1b8\r\n\x1b[A\x1b[K\x1b(B\x1b[m[\x1b[33m?\x1b(B\x1b[m]\x1b(B\x1b[m What's your password: *b\r\n"
E after: <class 'pexpect.exceptions.TIMEOUT'>
E match: None
E match_index: None
E exitstatus: None
E flag_eof: False
E pid: 16235
E child_fd: 18
E closed: False
E timeout: 30
E delimiter: <class 'pexpect.exceptions.EOF'>
E logfile: None
E logfile_read: None
E logfile_send: None
E maxread: 2000
E ignorecase: False
E searchwindowsize: None
E delaybeforesend: 0.05
E delayafterclose: 0.1
E delayafterterminate: 0.1
E searcher: searcher_re:
E 0: re.compile("b"{'password': 'b'}"")
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:68: TIMEOUT
___________________________________________________ PasswordTest.test_default_input ___________________________________________________
self = <pexpect.expect.Expecter object at 0x106d67cc0>, timeout = 0.9983429908752441
def expect_loop(self, timeout=-1):
"""Blocking expect"""
spawn = self.spawn
if timeout is not None:
end_time = time.time() + timeout
try:
incoming = spawn.buffer
spawn.buffer = spawn.string_type() # Treat buffer as new data
while True:
idx = self.new_data(incoming)
# Keep reading until exception or return.
if idx is not None:
return idx
# No match at this point
if (timeout is not None) and (timeout < 0):
return self.timeout()
# Still have time left, so read more data
> incoming = spawn.read_nonblocking(spawn.maxread, timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.pty_spawn.spawn object at 0x106d67e10>, size = 2000, timeout = 0.9983429908752441
def read_nonblocking(self, size=1, timeout=-1):
'''This reads at most size characters from the child application. It
includes a timeout. If the read does not complete within the timeout
period then a TIMEOUT exception is raised. If the end of file is read
then an EOF exception will be raised. If a logfile is specified, a
copy is written to that log.
If timeout is None then the read may block indefinitely.
If timeout is -1 then the self.timeout value is used. If timeout is 0
then the child is polled and if there is no data immediately ready
then this will raise a TIMEOUT exception.
The timeout refers only to the amount of time to read at least one
character. This is not affected by the 'size' parameter, so if you call
read_nonblocking(size=100, timeout=30) and only one character is
available right away then one character will be returned immediately.
It will not wait for 30 seconds for another 99 characters to come in.
This is a wrapper around os.read(). It uses select.select() to
implement the timeout. '''
if self.closed:
raise ValueError('I/O operation on closed file.')
if timeout == -1:
timeout = self.timeout
# Note that some systems such as Solaris do not give an EOF when
# the child dies. In fact, you can still try to read
# from the child_fd -- it will block forever or until TIMEOUT.
# For this case, I test isalive() before doing any reading.
# If isalive() is false, then I pretend that this is the same as EOF.
if not self.isalive():
# timeout of 0 means "poll"
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 0)
if not r:
self.flag_eof = True
raise EOF('End Of File (EOF). Braindead platform.')
elif self.__irix_hack:
# Irix takes a long time before it realizes a child was terminated.
# FIXME So does this mean Irix systems are forced to always have
# FIXME a 2 second delay when calling read_nonblocking? That sucks.
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 2)
if not r and not self.isalive():
self.flag_eof = True
raise EOF('End Of File (EOF). Slow platform.')
r, w, e = select_ignore_interrupts([self.child_fd], [], [], timeout)
if not r:
if not self.isalive():
# Some platforms, such as Irix, will claim that their
# processes are alive; timeout on the select; and
# then finally admit that they are not alive.
self.flag_eof = True
raise EOF('End of File (EOF). Very slow platform.')
else:
> raise TIMEOUT('Timeout exceeded.')
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/pty_spawn.py:466: TIMEOUT
During handling of the above exception, another exception occurred:
self = <tests.acceptance.test_password.PasswordTest testMethod=test_default_input>
def test_default_input(self):
self.sut.expect(".*What's.*", timeout=1)
self.sut.send('abcde')
self.sut.send(key.ENTER)
> self.sut.expect("{'password': 'abcde'}", timeout=1)
tests/acceptance/test_password.py:14:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:327: in expect
timeout, searchwindowsize, async_)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:355: in expect_list
return exp.expect_loop(timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:104: in expect_loop
return self.timeout(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.expect.Expecter object at 0x106d67cc0>, err = TIMEOUT('Timeout exceeded.',)
def timeout(self, err=None):
spawn = self.spawn
spawn.before = spawn.buffer
spawn.after = TIMEOUT
index = self.searcher.timeout_index
if index >= 0:
spawn.match = TIMEOUT
spawn.match_index = index
return index
else:
spawn.match = None
spawn.match_index = None
msg = str(spawn)
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
> raise TIMEOUT(msg)
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
E <pexpect.pty_spawn.spawn object at 0x106d67e10>
E command: /Users/drews/.virtualenvs/python-inquirer/bin/python
E args: ['/Users/drews/.virtualenvs/python-inquirer/bin/python', 'examples/password.py']
E buffer (last 100 chars): b"'s your password: ****\r\r\x1b7\x1b[79;1H\x1b[J\x1b8\r\n\x1b[A\x1b[K\x1b(B\x1b[m[\x1b[33m?\x1b(B\x1b[m]\x1b(B\x1b[m What's your password: *****"
E before (last 100 chars): b"'s your password: ****\r\r\x1b7\x1b[79;1H\x1b[J\x1b8\r\n\x1b[A\x1b[K\x1b(B\x1b[m[\x1b[33m?\x1b(B\x1b[m]\x1b(B\x1b[m What's your password: *****"
E after: <class 'pexpect.exceptions.TIMEOUT'>
E match: None
E match_index: None
E exitstatus: None
E flag_eof: False
E pid: 16236
E child_fd: 19
E closed: False
E timeout: 30
E delimiter: <class 'pexpect.exceptions.EOF'>
E logfile: None
E logfile_read: None
E logfile_send: None
E maxread: 2000
E ignorecase: False
E searchwindowsize: None
E delaybeforesend: 0.05
E delayafterclose: 0.1
E delayafterterminate: 0.1
E searcher: searcher_re:
E 0: re.compile("b"{'password': 'abcde'}"")
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:68: TIMEOUT
__________________________________________________ PreAnswersTest.test_minimal_input __________________________________________________
self = <pexpect.expect.Expecter object at 0x106e005c0>, timeout = 0.9700989723205566
def expect_loop(self, timeout=-1):
"""Blocking expect"""
spawn = self.spawn
if timeout is not None:
end_time = time.time() + timeout
try:
incoming = spawn.buffer
spawn.buffer = spawn.string_type() # Treat buffer as new data
while True:
idx = self.new_data(incoming)
# Keep reading until exception or return.
if idx is not None:
return idx
# No match at this point
if (timeout is not None) and (timeout < 0):
return self.timeout()
# Still have time left, so read more data
> incoming = spawn.read_nonblocking(spawn.maxread, timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.pty_spawn.spawn object at 0x106e00048>, size = 2000, timeout = 0.9700989723205566
def read_nonblocking(self, size=1, timeout=-1):
'''This reads at most size characters from the child application. It
includes a timeout. If the read does not complete within the timeout
period then a TIMEOUT exception is raised. If the end of file is read
then an EOF exception will be raised. If a logfile is specified, a
copy is written to that log.
If timeout is None then the read may block indefinitely.
If timeout is -1 then the self.timeout value is used. If timeout is 0
then the child is polled and if there is no data immediately ready
then this will raise a TIMEOUT exception.
The timeout refers only to the amount of time to read at least one
character. This is not affected by the 'size' parameter, so if you call
read_nonblocking(size=100, timeout=30) and only one character is
available right away then one character will be returned immediately.
It will not wait for 30 seconds for another 99 characters to come in.
This is a wrapper around os.read(). It uses select.select() to
implement the timeout. '''
if self.closed:
raise ValueError('I/O operation on closed file.')
if timeout == -1:
timeout = self.timeout
# Note that some systems such as Solaris do not give an EOF when
# the child dies. In fact, you can still try to read
# from the child_fd -- it will block forever or until TIMEOUT.
# For this case, I test isalive() before doing any reading.
# If isalive() is false, then I pretend that this is the same as EOF.
if not self.isalive():
# timeout of 0 means "poll"
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 0)
if not r:
self.flag_eof = True
raise EOF('End Of File (EOF). Braindead platform.')
elif self.__irix_hack:
# Irix takes a long time before it realizes a child was terminated.
# FIXME So does this mean Irix systems are forced to always have
# FIXME a 2 second delay when calling read_nonblocking? That sucks.
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 2)
if not r and not self.isalive():
self.flag_eof = True
raise EOF('End Of File (EOF). Slow platform.')
r, w, e = select_ignore_interrupts([self.child_fd], [], [], timeout)
if not r:
if not self.isalive():
# Some platforms, such as Irix, will claim that their
# processes are alive; timeout on the select; and
# then finally admit that they are not alive.
self.flag_eof = True
raise EOF('End of File (EOF). Very slow platform.')
else:
raise TIMEOUT('Timeout exceeded.')
if self.child_fd in r:
> return super(spawn, self).read_nonblocking(size)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/pty_spawn.py:469:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.pty_spawn.spawn object at 0x106e00048>, size = 2000, timeout = None
def read_nonblocking(self, size=1, timeout=None):
"""This reads data from the file descriptor.
This is a simple implementation suitable for a regular file. Subclasses using ptys or pipes should override it.
The timeout parameter is ignored.
"""
try:
s = os.read(self.child_fd, size)
except OSError as err:
if err.args[0] == errno.EIO:
# Linux-style EOF
self.flag_eof = True
raise EOF('End Of File (EOF). Exception style platform.')
raise
if s == b'':
# BSD-style EOF
self.flag_eof = True
> raise EOF('End Of File (EOF). Empty string style platform.')
E pexpect.exceptions.EOF: End Of File (EOF). Empty string style platform.
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:162: EOF
During handling of the above exception, another exception occurred:
self = <tests.acceptance.test_pre_answers.PreAnswersTest testMethod=test_minimal_input>
def test_minimal_input(self):
# user
> self.sut.expect("Please enter", timeout=1)
tests/acceptance/test_pre_answers.py:21:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:327: in expect
timeout, searchwindowsize, async_)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:355: in expect_list
return exp.expect_loop(timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:102: in expect_loop
return self.eof(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.expect.Expecter object at 0x106e005c0>, err = EOF('End Of File (EOF). Empty string style platform.',)
def eof(self, err=None):
spawn = self.spawn
spawn.before = spawn.buffer
spawn.buffer = spawn.string_type()
spawn.after = EOF
index = self.searcher.eof_index
if index >= 0:
spawn.match = EOF
spawn.match_index = index
return index
else:
spawn.match = None
spawn.match_index = None
msg = str(spawn)
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
> raise EOF(msg)
E pexpect.exceptions.EOF: End Of File (EOF). Empty string style platform.
E <pexpect.pty_spawn.spawn object at 0x106e00048>
E command: /Users/drews/.virtualenvs/python-inquirer/bin/python
E args: ['/Users/drews/.virtualenvs/python-inquirer/bin/python', 'examples/pre_answers.py']
E buffer (last 100 chars): b''
E before (last 100 chars): b'pre_answers.py", line 3, in <module>\r\n import inquirer\r\nImportError: No module named \'inquirer\'\r\n'
E after: <class 'pexpect.exceptions.EOF'>
E match: None
E match_index: None
E exitstatus: None
E flag_eof: True
E pid: 16237
E child_fd: 20
E closed: False
E timeout: 30
E delimiter: <class 'pexpect.exceptions.EOF'>
E logfile: None
E logfile_read: None
E logfile_send: None
E maxread: 2000
E ignorecase: False
E searchwindowsize: None
E delaybeforesend: 0.05
E delayafterclose: 0.1
E delayafterterminate: 0.1
E searcher: searcher_re:
E 0: re.compile("b'Please enter'")
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:49: EOF
_____________________________________________________ TextTest.test_default_input _____________________________________________________
self = <pexpect.expect.Expecter object at 0x106cd9160>, timeout = 0.9991650581359863
def expect_loop(self, timeout=-1):
"""Blocking expect"""
spawn = self.spawn
if timeout is not None:
end_time = time.time() + timeout
try:
incoming = spawn.buffer
spawn.buffer = spawn.string_type() # Treat buffer as new data
while True:
idx = self.new_data(incoming)
# Keep reading until exception or return.
if idx is not None:
return idx
# No match at this point
if (timeout is not None) and (timeout < 0):
return self.timeout()
# Still have time left, so read more data
> incoming = spawn.read_nonblocking(spawn.maxread, timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.pty_spawn.spawn object at 0x106cd91d0>, size = 2000, timeout = 0.9991650581359863
def read_nonblocking(self, size=1, timeout=-1):
'''This reads at most size characters from the child application. It
includes a timeout. If the read does not complete within the timeout
period then a TIMEOUT exception is raised. If the end of file is read
then an EOF exception will be raised. If a logfile is specified, a
copy is written to that log.
If timeout is None then the read may block indefinitely.
If timeout is -1 then the self.timeout value is used. If timeout is 0
then the child is polled and if there is no data immediately ready
then this will raise a TIMEOUT exception.
The timeout refers only to the amount of time to read at least one
character. This is not affected by the 'size' parameter, so if you call
read_nonblocking(size=100, timeout=30) and only one character is
available right away then one character will be returned immediately.
It will not wait for 30 seconds for another 99 characters to come in.
This is a wrapper around os.read(). It uses select.select() to
implement the timeout. '''
if self.closed:
raise ValueError('I/O operation on closed file.')
if timeout == -1:
timeout = self.timeout
# Note that some systems such as Solaris do not give an EOF when
# the child dies. In fact, you can still try to read
# from the child_fd -- it will block forever or until TIMEOUT.
# For this case, I test isalive() before doing any reading.
# If isalive() is false, then I pretend that this is the same as EOF.
if not self.isalive():
# timeout of 0 means "poll"
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 0)
if not r:
self.flag_eof = True
raise EOF('End Of File (EOF). Braindead platform.')
elif self.__irix_hack:
# Irix takes a long time before it realizes a child was terminated.
# FIXME So does this mean Irix systems are forced to always have
# FIXME a 2 second delay when calling read_nonblocking? That sucks.
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 2)
if not r and not self.isalive():
self.flag_eof = True
raise EOF('End Of File (EOF). Slow platform.')
r, w, e = select_ignore_interrupts([self.child_fd], [], [], timeout)
if not r:
if not self.isalive():
# Some platforms, such as Irix, will claim that their
# processes are alive; timeout on the select; and
# then finally admit that they are not alive.
self.flag_eof = True
raise EOF('End of File (EOF). Very slow platform.')
else:
> raise TIMEOUT('Timeout exceeded.')
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/pty_spawn.py:466: TIMEOUT
During handling of the above exception, another exception occurred:
self = <tests.acceptance.test_text.TextTest testMethod=test_default_input>
def test_default_input(self):
self.set_name()
self.set_surname()
self.set_phone()
self.sut.expect_list([re.compile(b"'name': 'foo'"),
re.compile(b"'surname': 'bar'"),
re.compile(b"'phone': '123456789'")],
> timeout=1)
tests/acceptance/test_text.py:30:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:355: in expect_list
return exp.expect_loop(timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:104: in expect_loop
return self.timeout(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.expect.Expecter object at 0x106cd9160>, err = TIMEOUT('Timeout exceeded.',)
def timeout(self, err=None):
spawn = self.spawn
spawn.before = spawn.buffer
spawn.after = TIMEOUT
index = self.searcher.timeout_index
if index >= 0:
spawn.match = TIMEOUT
spawn.match_index = index
return index
else:
spawn.match = None
spawn.match_index = None
msg = str(spawn)
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
> raise TIMEOUT(msg)
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
E <pexpect.pty_spawn.spawn object at 0x106cd91d0>
E command: /Users/drews/.virtualenvs/python-inquirer/bin/python
E args: ['/Users/drews/.virtualenvs/python-inquirer/bin/python', 'examples/text.py']
E buffer (last 100 chars): b"e?: foo123456789\r\n\r\n\x1b[J\r\x1b7\x1b[79;1H\x1b[J\x1b8\r\n\x1b[A\x1b[K\x1b(B\x1b[m[\x1b[33m?\x1b(B\x1b[m]\x1b(B\x1b[m What's your surname, foo?: "
E before (last 100 chars): b"e?: foo123456789\r\n\r\n\x1b[J\r\x1b7\x1b[79;1H\x1b[J\x1b8\r\n\x1b[A\x1b[K\x1b(B\x1b[m[\x1b[33m?\x1b(B\x1b[m]\x1b(B\x1b[m What's your surname, foo?: "
E after: <class 'pexpect.exceptions.TIMEOUT'>
E match: None
E match_index: None
E exitstatus: None
E flag_eof: False
E pid: 16238
E child_fd: 11
E closed: False
E timeout: 30
E delimiter: <class 'pexpect.exceptions.EOF'>
E logfile: None
E logfile_read: None
E logfile_send: None
E maxread: 2000
E ignorecase: False
E searchwindowsize: None
E delaybeforesend: 0.05
E delayafterclose: 0.1
E delayafterterminate: 0.1
E searcher: searcher_re:
E 0: re.compile("b"'name': 'foo'"")
E 1: re.compile("b"'surname': 'bar'"")
E 2: re.compile("b"'phone': '123456789'"")
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:68: TIMEOUT
_____________________________________________________ TextTest.test_invalid_phone _____________________________________________________
self = <pexpect.expect.Expecter object at 0x106cc0550>, timeout = 0.9994020462036133
def expect_loop(self, timeout=-1):
"""Blocking expect"""
spawn = self.spawn
if timeout is not None:
end_time = time.time() + timeout
try:
incoming = spawn.buffer
spawn.buffer = spawn.string_type() # Treat buffer as new data
while True:
idx = self.new_data(incoming)
# Keep reading until exception or return.
if idx is not None:
return idx
# No match at this point
if (timeout is not None) and (timeout < 0):
return self.timeout()
# Still have time left, so read more data
> incoming = spawn.read_nonblocking(spawn.maxread, timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:96:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.pty_spawn.spawn object at 0x106cc0128>, size = 2000, timeout = 0.9994020462036133
def read_nonblocking(self, size=1, timeout=-1):
'''This reads at most size characters from the child application. It
includes a timeout. If the read does not complete within the timeout
period then a TIMEOUT exception is raised. If the end of file is read
then an EOF exception will be raised. If a logfile is specified, a
copy is written to that log.
If timeout is None then the read may block indefinitely.
If timeout is -1 then the self.timeout value is used. If timeout is 0
then the child is polled and if there is no data immediately ready
then this will raise a TIMEOUT exception.
The timeout refers only to the amount of time to read at least one
character. This is not affected by the 'size' parameter, so if you call
read_nonblocking(size=100, timeout=30) and only one character is
available right away then one character will be returned immediately.
It will not wait for 30 seconds for another 99 characters to come in.
This is a wrapper around os.read(). It uses select.select() to
implement the timeout. '''
if self.closed:
raise ValueError('I/O operation on closed file.')
if timeout == -1:
timeout = self.timeout
# Note that some systems such as Solaris do not give an EOF when
# the child dies. In fact, you can still try to read
# from the child_fd -- it will block forever or until TIMEOUT.
# For this case, I test isalive() before doing any reading.
# If isalive() is false, then I pretend that this is the same as EOF.
if not self.isalive():
# timeout of 0 means "poll"
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 0)
if not r:
self.flag_eof = True
raise EOF('End Of File (EOF). Braindead platform.')
elif self.__irix_hack:
# Irix takes a long time before it realizes a child was terminated.
# FIXME So does this mean Irix systems are forced to always have
# FIXME a 2 second delay when calling read_nonblocking? That sucks.
r, w, e = select_ignore_interrupts([self.child_fd], [], [], 2)
if not r and not self.isalive():
self.flag_eof = True
raise EOF('End Of File (EOF). Slow platform.')
r, w, e = select_ignore_interrupts([self.child_fd], [], [], timeout)
if not r:
if not self.isalive():
# Some platforms, such as Irix, will claim that their
# processes are alive; timeout on the select; and
# then finally admit that they are not alive.
self.flag_eof = True
raise EOF('End of File (EOF). Very slow platform.')
else:
> raise TIMEOUT('Timeout exceeded.')
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/pty_spawn.py:466: TIMEOUT
During handling of the above exception, another exception occurred:
self = <tests.acceptance.test_text.TextTest testMethod=test_invalid_phone>
def test_invalid_phone(self):
self.set_name()
self.set_surname()
self.set_phone('abcde')
> self.sut.expect('"abcde" is not a valid phone', timeout=1)
tests/acceptance/test_text.py:36:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:327: in expect
timeout, searchwindowsize, async_)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/spawnbase.py:355: in expect_list
return exp.expect_loop(timeout)
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:104: in expect_loop
return self.timeout(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.expect.Expecter object at 0x106cc0550>, err = TIMEOUT('Timeout exceeded.',)
def timeout(self, err=None):
spawn = self.spawn
spawn.before = spawn.buffer
spawn.after = TIMEOUT
index = self.searcher.timeout_index
if index >= 0:
spawn.match = TIMEOUT
spawn.match_index = index
return index
else:
spawn.match = None
spawn.match_index = None
msg = str(spawn)
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
> raise TIMEOUT(msg)
E pexpect.exceptions.TIMEOUT: Timeout exceeded.
E <pexpect.pty_spawn.spawn object at 0x106cc0128>
E command: /Users/drews/.virtualenvs/python-inquirer/bin/python
E args: ['/Users/drews/.virtualenvs/python-inquirer/bin/python', 'examples/text.py']
E buffer (last 100 chars): b" name?: fooabcde\r\n\r\n\x1b[J\r\x1b7\x1b[79;1H\x1b[J\x1b8\r\n\x1b[A\x1b[K\x1b(B\x1b[m[\x1b[33m?\x1b(B\x1b[m]\x1b(B\x1b[m What's your surname, foo?: "
E before (last 100 chars): b" name?: fooabcde\r\n\r\n\x1b[J\r\x1b7\x1b[79;1H\x1b[J\x1b8\r\n\x1b[A\x1b[K\x1b(B\x1b[m[\x1b[33m?\x1b(B\x1b[m]\x1b(B\x1b[m What's your surname, foo?: "
E after: <class 'pexpect.exceptions.TIMEOUT'>
E match: None
E match_index: None
E exitstatus: None
E flag_eof: False
E pid: 16242
E child_fd: 12
E closed: False
E timeout: 30
E delimiter: <class 'pexpect.exceptions.EOF'>
E logfile: None
E logfile_read: None
E logfile_send: None
E maxread: 2000
E ignorecase: False
E searchwindowsize: None
E delaybeforesend: 0.05
E delayafterclose: 0.1
E delayafterterminate: 0.1
E searcher: searcher_re:
E 0: re.compile("b'"abcde" is not a valid phone'")
../../../.virtualenvs/python-inquirer/lib/python3.5/site-packages/pexpect/expect.py:68: TIMEOUT
================================================ 12 failed, 84 passed in 19.36 seconds ================================================
(python-inquirer) drews@mbp: ~/Development/python-inquirer
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment