diff options
author | stijn <stijn@ignitron.net> | 2015-08-06 12:34:48 +0200 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-08-08 12:35:27 +0100 |
commit | dbfba6a20e252a2c8daa145099299283d98564de (patch) | |
tree | cc8384c3e1f991ddf457593da546de2244ee99c2 /tests | |
parent | 7ede3ec4b1ab4b77aac0dea0322a93b53f5df18a (diff) | |
download | micropython-dbfba6a20e252a2c8daa145099299283d98564de.tar.gz micropython-dbfba6a20e252a2c8daa145099299283d98564de.zip |
tests: Fix exceptions when running cmdline tests on windows
- subprocess.check_output can only handle strings on windows, not bytes,
so convert the arguments as such
- the pty module is for posix systems only so skip the tests needing it
in case it is not available
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/run-tests | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/run-tests b/tests/run-tests index e9587e3de3..28857249ee 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -37,13 +37,18 @@ def run_micropython(pyb, args, test_file): with open(test_file, 'rb') as f: line = f.readline() if line.startswith(b'# cmdline:'): - args += line[10:].strip().split() + # subprocess.check_output on Windows only accepts strings, not bytes + args += [str(c, 'utf-8') for c in line[10:].strip().split()] # run the test, possibly with redirected input try: if test_file.startswith('cmdline/repl_'): # Need to use a PTY to test command line editing - import pty + try: + import pty + except ImportError: + # in case pty module is not available, like on Windows + return b'SKIP\n' import select def get(): |