Skip to content

Commit 553a9df

Browse files
committed
run-tests: Use better naming for openpty fds
This is the naming that was proposed in the (unfortunately not adopted) python/cpython#9100
1 parent 9dfd6f4 commit 553a9df

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/run-tests

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,28 +87,28 @@ def run_micropython(pyb, args, test_file, is_special=False):
8787
def get(required=False):
8888
rv = b''
8989
while True:
90-
ready = select.select([primary], [], [], 0.02)
91-
if ready[0] == [primary]:
92-
rv += os.read(primary, 1024)
90+
ready = select.select([parent_fd], [], [], 0.02)
91+
if ready[0] == [parent_fd]:
92+
rv += os.read(parent_fd, 1024)
9393
else:
9494
if not required or rv:
9595
return rv
9696

9797
def send_get(what):
98-
os.write(primary, what)
98+
os.write(parent_fd, what)
9999
return get()
100100

101101
with open(test_file, 'rb') as f:
102102
# instead of: output_mupy = subprocess.check_output(args, stdin=f)
103-
primary, secondary = pty.openpty()
104-
p = subprocess.Popen(args, stdin=secondary, stdout=secondary,
103+
parent_fd, child_fd = pty.openpty()
104+
p = subprocess.Popen(args, stdin=child_fd, stdout=child_fd,
105105
stderr=subprocess.STDOUT, bufsize=0)
106106
banner = get(True)
107107
output_mupy = banner + b''.join(send_get(line) for line in f)
108108
send_get(b'\x04') # exit the REPL, so coverage info is saved
109109
p.kill()
110-
os.close(primary)
111-
os.close(secondary)
110+
os.close(parent_fd)
111+
os.close(child_fd)
112112
else:
113113
output_mupy = subprocess.check_output(args + [test_file], stderr=subprocess.STDOUT)
114114
except subprocess.CalledProcessError:

0 commit comments

Comments
 (0)