mirror of
https://github.com/clearml/wexpect-venv
synced 2025-01-30 18:36:57 +00:00
[ADD] reproduce script for #9
This commit is contained in:
parent
86fcf06410
commit
28dd5a7c64
34
issues/i09_confused_string.py
Normal file
34
issues/i09_confused_string.py
Normal file
@ -0,0 +1,34 @@
|
||||
import wexpect
|
||||
import time
|
||||
|
||||
print(wexpect.__version__)
|
||||
|
||||
|
||||
def testPath():
|
||||
# Path of cmd executable:
|
||||
cmdPath = 'cmd'
|
||||
cmdPrompt = '>'
|
||||
referenceOut = None
|
||||
|
||||
while True:
|
||||
# Start the child process
|
||||
p = wexpect.spawn(cmdPath)
|
||||
|
||||
# Wait for prompt
|
||||
p.expect(cmdPrompt)
|
||||
|
||||
# Send a command
|
||||
p.sendline('ls')
|
||||
# time.sleep(0.6) <= this sleep solve...
|
||||
p.expect(cmdPrompt)
|
||||
|
||||
print(cmdPath + " >>" + p.before + '<<')
|
||||
if referenceOut:
|
||||
if referenceOut != p.before:
|
||||
p.interact()
|
||||
time.sleep(5)
|
||||
raise Exception()
|
||||
else:
|
||||
referenceOut = p.before
|
||||
|
||||
testPath()
|
Loading…
Reference in New Issue
Block a user