mirror of
https://github.com/clearml/wexpect-venv
synced 2025-05-07 05:34:41 +00:00
[ADD] issues folder for active issues
This commit is contained in:
parent
c47974e799
commit
016a674bf7
1
issues/README.md
Normal file
1
issues/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
issues folder contains scripts to help to reproduce a given issue
|
11
issues/bla.py
Normal file
11
issues/bla.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import time
|
||||||
|
|
||||||
|
# Wait the given time
|
||||||
|
for i in range(2):
|
||||||
|
print('apple\tbanana\tmelone\tcherry')
|
||||||
|
print('pepper tomato\tcorn cabbage')
|
||||||
|
print('apple banana\tmelone\tcherry2')
|
||||||
|
print('pepper tomato\tcorn cabbage2')
|
||||||
|
print('prompt> ')
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
24
issues/bla2.py
Normal file
24
issues/bla2.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
'''
|
||||||
|
This is is a very basic stdio handler script. This is used by python.py example.
|
||||||
|
'''
|
||||||
|
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
print('Welcome!')
|
||||||
|
|
||||||
|
while True:
|
||||||
|
print('>', end='')
|
||||||
|
cmd = input()
|
||||||
|
|
||||||
|
# Wait the given time
|
||||||
|
if cmd == 'ls':
|
||||||
|
print('apple\tbanana\tmelone\tcherry')
|
||||||
|
print('pepper tomato\tcorn cabbage')
|
||||||
|
print('apple banana\tmelone\tcherry2')
|
||||||
|
print('pepper tomato\tcorn cabbage2')
|
||||||
|
continue
|
||||||
|
if cmd == 'exit':
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print('unknown command')
|
37
issues/i09_cmd_error.py
Normal file
37
issues/i09_cmd_error.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
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)
|
||||||
|
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()
|
||||||
|
|
33
issues/i09_py_sim_no_error.py
Normal file
33
issues/i09_py_sim_no_error.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
import wexpect
|
||||||
|
import time
|
||||||
|
|
||||||
|
print(wexpect.__version__)
|
||||||
|
|
||||||
|
|
||||||
|
def testPath():
|
||||||
|
# Path of cmd executable:
|
||||||
|
cmdPath = 'python bugfix\\bla.py'
|
||||||
|
cmdPrompt = '> '
|
||||||
|
referenceOut = None
|
||||||
|
|
||||||
|
while True:
|
||||||
|
# Start the child process
|
||||||
|
p = wexpect.spawn(cmdPath)
|
||||||
|
|
||||||
|
# Wait for prompt
|
||||||
|
p.expect(cmdPrompt)
|
||||||
|
# Wait for prompt
|
||||||
|
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()
|
||||||
|
|
37
issues/i09_py_sim_no_error2.py
Normal file
37
issues/i09_py_sim_no_error2.py
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
import wexpect
|
||||||
|
import time
|
||||||
|
|
||||||
|
print(wexpect.__version__)
|
||||||
|
|
||||||
|
|
||||||
|
def testPath():
|
||||||
|
# Path of cmd executable:
|
||||||
|
cmdPath = 'python bugfix\\bla2.py'
|
||||||
|
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)
|
||||||
|
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()
|
||||||
|
|
25
wexpect.py
25
wexpect.py
@ -110,12 +110,26 @@ except ImportError as e:
|
|||||||
screenbufferfillchar = '\4'
|
screenbufferfillchar = '\4'
|
||||||
maxconsoleY = 8000
|
maxconsoleY = 8000
|
||||||
|
|
||||||
|
|
||||||
|
# The version is handled by the package: pbr, which derives the version from the git tags.
|
||||||
|
try:
|
||||||
|
__version__ = pkg_resources.require("wexpect")[0].version
|
||||||
|
except:
|
||||||
|
__version__ = '0.0.1.unkowndev0'
|
||||||
|
__revision__ = '$Revision: 399 $'
|
||||||
|
|
||||||
|
__all__ = ['ExceptionPexpect', 'EOF', 'TIMEOUT', 'spawn', 'run', 'which',
|
||||||
|
'split_command_line', '__version__', '__revision__']
|
||||||
|
|
||||||
#
|
#
|
||||||
# Create logger: We write logs only to file. Printing out logs are dangerous, because of the deep
|
# Create logger: We write logs only to file. Printing out logs are dangerous, because of the deep
|
||||||
# console manipulation.
|
# console manipulation.
|
||||||
#
|
#
|
||||||
logger = logging.getLogger('wexpect')
|
logger = logging.getLogger('wexpect')
|
||||||
|
if 'dev' in __version__ :
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
|
else:
|
||||||
|
logger.setLevel(logging.INFO)
|
||||||
fh = logging.FileHandler('wexpect.log')
|
fh = logging.FileHandler('wexpect.log')
|
||||||
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||||
fh.setFormatter(formatter)
|
fh.setFormatter(formatter)
|
||||||
@ -124,17 +138,6 @@ logger.addHandler(fh)
|
|||||||
# Test the logger
|
# Test the logger
|
||||||
logger.info('wexpect imported; logger working')
|
logger.info('wexpect imported; logger working')
|
||||||
|
|
||||||
# The version is handled by the package: pbr, which derives the version from the git tags.
|
|
||||||
try:
|
|
||||||
__version__ = pkg_resources.require("wexpect")[0].version
|
|
||||||
except:
|
|
||||||
__version__ = '0.0.1.unkown0'
|
|
||||||
__revision__ = '$Revision: 399 $'
|
|
||||||
|
|
||||||
__all__ = ['ExceptionPexpect', 'EOF', 'TIMEOUT', 'spawn', 'run', 'which',
|
|
||||||
'split_command_line', '__version__', '__revision__']
|
|
||||||
|
|
||||||
|
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
#
|
#
|
||||||
# Exceptions
|
# Exceptions
|
||||||
|
Loading…
Reference in New Issue
Block a user