I need to write my own testing system, that got file with input() data reading. I have test.py file that run some code and tester.py that run test.py file.
This is for macOS 10.14.2 with Python 3.7.0
test.py
a = []
n = int(input())
for i in range(n):
a.append(input())
print(*a)
tester.py
import pexpect
import sys
child = pexpect.spawn('python3 test.py', encoding='utf-8')
child.logfile = sys.stdout
n = 5
child.sendline(str(n))
for i in range(n):
child.sendline(str(i))
Problem in logfile, it return only what input in script. How i can normally got one print value, or all prints in script?
Aucun commentaire:
Enregistrer un commentaire