diff --git a/tests/run-tests b/tests/run-tests
index 6d5752e68ae356e44c500937eb014cd00dbacbd3..20fe1a541aac5482c97d5e434ad3938d9acbcb47 100755
--- a/tests/run-tests
+++ b/tests/run-tests
@@ -139,6 +139,7 @@ def run_tests(pyb, tests, args):
 def main():
     cmd_parser = argparse.ArgumentParser(description='Run tests for Micro Python.')
     cmd_parser.add_argument('--pyboard', action='store_true', help='run the tests on the pyboard')
+    cmd_parser.add_argument('--device', default='/dev/ttyACM0', help='the serial device of the pyboard')
     cmd_parser.add_argument('-d', '--test-dirs', nargs='*', help='input test directories (if no files given)')
     cmd_parser.add_argument('--write-exp', action='store_true', help='save .exp files to run tests w/o CPython')
     cmd_parser.add_argument('--emit', default='bytecode', help='Micro Python emitter to use (bytecode or native)')
@@ -147,7 +148,7 @@ def main():
 
     if args.pyboard:
         import pyboard
-        pyb = pyboard.Pyboard('/dev/ttyACM0')
+        pyb = pyboard.Pyboard(args.device)
         pyb.enter_raw_repl()
     else:
         pyb = None
diff --git a/tools/pyboard.py b/tools/pyboard.py
index dce60350d0527cd0bf75119d0c9258c760de7048..f7bd92b262e8392653ee224e01b8500cbe023f5d 100644
--- a/tools/pyboard.py
+++ b/tools/pyboard.py
@@ -105,12 +105,12 @@ def execfile(filename, device='/dev/ttyACM0'):
     pyb.exit_raw_repl()
     pyb.close()
 
-def run_test():
-    device = '/dev/ttyACM0'
+def run_test(device):
     pyb = Pyboard(device)
     pyb.enter_raw_repl()
     print('opened device {}'.format(device))
 
+    pyb.exec('import pyb')  # module pyb no longer imported by default, required for pyboard tests
     print('seconds since boot:', pyb.get_time())
 
     pyb.exec('def apply(l, f):\r\n for item in l:\r\n  f(item)\r\n')
@@ -170,7 +170,7 @@ def main():
     args = cmd_parser.parse_args()
 
     if args.test:
-        run_test()
+        run_test(device=args.device)
 
     for file in args.files:
         execfile(file, device=args.device)