mirror of
https://github.com/clearml/wexpect-venv
synced 2025-02-12 07:38:23 +00:00
[ADD] stop_interact test; [ADD] failure warnings around setecho
This commit is contained in:
parent
0b3a4979c4
commit
e04ee4f175
@ -50,6 +50,8 @@ class InteractTestCase(PexpectTestCase.PexpectTestCase):
|
|||||||
# Send a command
|
# Send a command
|
||||||
p.sendline('echo hello')
|
p.sendline('echo hello')
|
||||||
p.expect(cmdPrompt)
|
p.expect(cmdPrompt)
|
||||||
|
|
||||||
|
p.stop_interact()
|
||||||
|
|
||||||
self.assertEqual('hello', p.before.splitlines()[1])
|
self.assertEqual('hello', p.before.splitlines()[1])
|
||||||
|
|
||||||
|
43
wexpect.py
43
wexpect.py
@ -630,14 +630,31 @@ class spawn_windows ():
|
|||||||
timeout = end_time - time.time()
|
timeout = end_time - time.time()
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
def getecho (self):
|
def getecho (self): # pragma: no cover
|
||||||
|
faulty_method_warning = '''
|
||||||
|
################################## WARNING ##################################
|
||||||
|
setecho() is faulty!
|
||||||
|
Please contact me and report it at
|
||||||
|
https://github.com/raczben/wexpect/issues/18 if you use it.
|
||||||
|
################################## WARNING ##################################
|
||||||
|
'''
|
||||||
|
warnings.warn(faulty_method_warning, DeprecationWarning)
|
||||||
"""This returns the terminal echo mode. This returns True if echo is
|
"""This returns the terminal echo mode. This returns True if echo is
|
||||||
on or False if echo is off. Child applications that are expecting you
|
on or False if echo is off. Child applications that are expecting you
|
||||||
to enter a password often set ECHO False. See waitnoecho()."""
|
to enter a password often set ECHO False. See waitnoecho()."""
|
||||||
|
|
||||||
return self.wtty.getecho()
|
return self.wtty.getecho()
|
||||||
|
|
||||||
def setecho (self, state):
|
def setecho (self, state): # pragma: no cover
|
||||||
|
faulty_method_warning = '''
|
||||||
|
################################## WARNING ##################################
|
||||||
|
setecho() is faulty!
|
||||||
|
Please contact me and report it at
|
||||||
|
https://github.com/raczben/wexpect/issues/18 if you use it.
|
||||||
|
################################## WARNING ##################################
|
||||||
|
'''
|
||||||
|
warnings.warn(faulty_method_warning, DeprecationWarning)
|
||||||
|
|
||||||
"""This sets the terminal echo mode on or off."""
|
"""This sets the terminal echo mode on or off."""
|
||||||
|
|
||||||
self.wtty.setecho(state)
|
self.wtty.setecho(state)
|
||||||
@ -1684,7 +1701,16 @@ class Wtty:
|
|||||||
#log('refreshConsole: cursorPos %s' % cursorPos)
|
#log('refreshConsole: cursorPos %s' % cursorPos)
|
||||||
|
|
||||||
|
|
||||||
def setecho(self, state):
|
def setecho(self, state): # pragma: no cover
|
||||||
|
faulty_method_warning = '''
|
||||||
|
################################## WARNING ##################################
|
||||||
|
setecho() is faulty!
|
||||||
|
Please contact me and report it at
|
||||||
|
https://github.com/raczben/wexpect/issues/18 if you use it.
|
||||||
|
################################## WARNING ##################################
|
||||||
|
'''
|
||||||
|
warnings.warn(faulty_method_warning, DeprecationWarning)
|
||||||
|
|
||||||
"""Sets the echo mode of the child console."""
|
"""Sets the echo mode of the child console."""
|
||||||
|
|
||||||
self.switchTo()
|
self.switchTo()
|
||||||
@ -1700,7 +1726,16 @@ class Wtty:
|
|||||||
raise
|
raise
|
||||||
self.switchBack()
|
self.switchBack()
|
||||||
|
|
||||||
def getecho(self):
|
def getecho(self): # pragma: no cover
|
||||||
|
faulty_method_warning = '''
|
||||||
|
################################## WARNING ##################################
|
||||||
|
getecho() is faulty!
|
||||||
|
Please contact me and report it at
|
||||||
|
https://github.com/raczben/wexpect/issues/18 if you use it.
|
||||||
|
################################## WARNING ##################################
|
||||||
|
'''
|
||||||
|
warnings.warn(faulty_method_warning, DeprecationWarning)
|
||||||
|
|
||||||
"""Returns the echo mode of the child console."""
|
"""Returns the echo mode of the child console."""
|
||||||
|
|
||||||
self.switchTo()
|
self.switchTo()
|
||||||
|
Loading…
Reference in New Issue
Block a user