Skip to content

Commit 2309369

Browse files
committed
tests: Allow to run tests on pyboard.
To run the tests on the pyboard you need to set the "test_on_pyboard" variable to "True", and also have tools/pyboard.py available for import (easiest is to symlink to it).
1 parent d71fc37 commit 2309369

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

tests/run-tests

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,22 @@ if not sys.argv[1:]:
2727
else:
2828
tests = sys.argv[1:]
2929

30+
test_on_pyboard = False
31+
if test_on_pyboard:
32+
import pyboard
33+
pyb = pyboard.Pyboard('/dev/ttyACM0')
34+
pyb.enter_raw_repl()
35+
3036
for test_file in tests:
3137
test_name = os.path.splitext(os.path.basename(test_file))[0]
3238

3339
output_expected = subprocess.check_output([CPYTHON3, '-B', test_file])
3440
try:
35-
output_mupy = subprocess.check_output([MP_PY, test_file])
41+
if test_on_pyboard:
42+
pyb.enter_raw_repl()
43+
output_mupy = pyb.execfile(test_file).replace(b'\r\n', b'\n')
44+
else:
45+
output_mupy = subprocess.check_output([MP_PY, test_file])
3646
except subprocess.CalledProcessError:
3747
output_mupy = b'CRASH'
3848

0 commit comments

Comments
 (0)