Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
CONNECTION_ATTEMPTS = 10
TIME_DELAY = 0.03
DEFAULT_PORT = "5577"

MICROPYTHON_LIBRARY_NAME = "micropython"
4 changes: 2 additions & 2 deletions src/common/debugger_communication_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Empty file added src/common/test/__init__.py
Empty file.
19 changes: 17 additions & 2 deletions src/common/test/test_debugger_communication_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines -7 to -8

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, if we used relative paths would the tests use the correct library?

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put this comment above the line it's referring to (or maybe remove the line break on line 20).
Now it seems as if it's referring to the next three lines where we calculate the 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


Expand Down