From 167a64dbea717688f604baed3852e5ff486ea962 Mon Sep 17 00:00:00 2001 From: andreamah Date: Wed, 1 Apr 2020 19:50:18 -0700 Subject: [PATCH 1/2] changed debugger to use correct mb instance --- src/common/debugger_communication_client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/debugger_communication_client.py b/src/common/debugger_communication_client.py index 49f2381b7..23035c6f9 100644 --- a/src/common/debugger_communication_client.py +++ b/src/common/debugger_communication_client.py @@ -14,8 +14,8 @@ from adafruit_circuitplayground.express import cpx from adafruit_circuitplayground.constants import CPX -from micropython.microbit.__model.microbit_model import __mb as mb -from micropython.microbit.__model.constants import MICROBIT +from microbit.__model.microbit_model import __mb as mb +from microbit.__model.constants import MICROBIT device_dict = {CPX: cpx, MICROBIT: mb} From 81a661ecd086dc6119b9eee4a248869b76d08fc7 Mon Sep 17 00:00:00 2001 From: andreamah Date: Thu, 2 Apr 2020 09:47:24 -0700 Subject: [PATCH 2/2] make tests pass --- src/common/constants.py | 2 ++ src/common/test/__init__.py | 0 .../test_debugger_communication_client.py | 19 +++++++++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 src/common/test/__init__.py diff --git a/src/common/constants.py b/src/common/constants.py index 73984933a..c0592c7db 100644 --- a/src/common/constants.py +++ b/src/common/constants.py @@ -8,3 +8,5 @@ CONNECTION_ATTEMPTS = 10 TIME_DELAY = 0.03 DEFAULT_PORT = "5577" + +MICROPYTHON_LIBRARY_NAME = "micropython" diff --git a/src/common/test/__init__.py b/src/common/test/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/src/common/test/test_debugger_communication_client.py b/src/common/test/test_debugger_communication_client.py index 0706ad149..fea21211e 100644 --- a/src/common/test/test_debugger_communication_client.py +++ b/src/common/test/test_debugger_communication_client.py @@ -3,10 +3,25 @@ from unittest import mock import socketio import threading +import os +import sys -from adafruit_circuitplayground import express -from common import debugger_communication_client from common import constants as CONSTANTS + +abs_path_to_parent_dir = os.path.join( + os.path.dirname(os.path.abspath(__file__)), "..", ".." +) + +sys.path.insert(0, abs_path_to_parent_dir) +# Insert absolute path to Micropython libraries for micro:bit into sys.path +abs_path_to_micropython_lib = os.path.join( + abs_path_to_parent_dir, CONSTANTS.MICROPYTHON_LIBRARY_NAME +) + +sys.path.insert(0, abs_path_to_micropython_lib) + +from common import debugger_communication_client +from adafruit_circuitplayground import express from adafruit_circuitplayground.constants import CPX