Skip to content

Commit df3c95e

Browse files
Merge 1a9e020 into c45d6cc
2 parents c45d6cc + 1a9e020 commit df3c95e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4377
-985
lines changed

.flake8

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ ignore = D107, D400, E501, W504, D204
2020
# Specify a list of mappings of files and the codes that should be ignored for the entirety of the file.
2121
per-file-ignores =
2222
tests/*:D101,D102,D104
23+
umodbus/const.py:F821
2324

2425
# Provide a comma-separated list of glob patterns to exclude from checks.
2526
exclude =
@@ -32,7 +33,7 @@ exclude =
3233
# There's no value in checking cache directories
3334
__pycache__,
3435
# The conf file is mostly autogenerated, ignore it
35-
docs/source/conf.py,
36+
docs/conf.py,
3637
# This contains our built documentation
3738
build,
3839
# This contains builds that we don't want to check
@@ -42,6 +43,7 @@ exclude =
4243
# example testing folder before going live
4344
thinking
4445
.idea
46+
.bak
4547
# custom scripts, not being part of the distribution
4648
libs_external
4749
modules

.github/workflows/test.yml

+9
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ jobs:
3333
run: |
3434
python -m pip install --upgrade pip
3535
if [ -f requirements-deploy.txt ]; then pip install -r requirements-deploy.txt; fi
36+
- name: Execute tests
37+
run: |
38+
docker build --tag micropython-test --file Dockerfile.tests .
39+
- name: Run Client/Host TCP example
40+
run: |
41+
docker compose up --build --exit-code-from micropython-host
42+
- name: Run Client/Host TCP test
43+
run: |
44+
docker compose -f docker-compose-tcp-test.yaml up --build --exit-code-from micropython-host
3645
- name: Build package
3746
run: |
3847
changelog2version \

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
.DS_Store
33
.DS_Store?
44
pymakr.conf
5-
tests/
65
config/config*.py
76
thinking/
87
*.bin

.gitmodules

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "modules"]
22
path = modules
3-
url = [email protected]:brainelectronics/python-modules.git
3+
# changed to https due to RTD build issue
4+
# see https://github.com/readthedocs/readthedocs.org/issues/4043
5+
# url = [email protected]:brainelectronics/python-modules.git
6+
url = https://github.com/brainelectronics/python-modules.git

.readthedocs.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
# Required
5+
version: 2
6+
7+
# Set the version of Python and other tools you might need
8+
build:
9+
os: ubuntu-22.04
10+
tools:
11+
python: "3.9"
12+
13+
# Build documentation in the docs/ directory with Sphinx
14+
sphinx:
15+
configuration: docs/conf.py
16+
17+
# Optionally declare the Python requirements required to build your docs
18+
python:
19+
install:
20+
- requirements: docs/requirements.txt

Dockerfile.client

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Build image
2+
# $ docker build -t micropython-client -f Dockerfile.client .
3+
#
4+
# Run image
5+
# $ docker run -it --rm --name micropython-client micropython-client
6+
7+
FROM micropython/unix:v1.18
8+
9+
# use "volumes" in docker-compose file to remove need of rebuilding
10+
# COPY ./ /home
11+
# COPY umodbus /root/.micropython/lib/umodbus
12+
13+
RUN micropython-dev -m upip install micropython-ulogging
14+
RUN micropython-dev -m upip install micropython-urequests
15+
16+
CMD [ "micropython-dev", "-m", "examples/tcp_client_example.py" ]

Dockerfile.host

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Build image
2+
# $ docker build -t micropython-host -f Dockerfile.host .
3+
#
4+
# Run image
5+
# $ docker run -it --rm --name micropython-host micropython-host
6+
7+
FROM micropython/unix:v1.18
8+
9+
# use "volumes" in docker-compose file to remove need of rebuilding
10+
# COPY ./ /home
11+
# COPY umodbus /root/.micropython/lib/umodbus
12+
13+
RUN micropython-dev -m upip install micropython-ulogging
14+
RUN micropython-dev -m upip install micropython-urequests
15+
16+
CMD [ "micropython-dev", "-m", "examples/tcp_host_example.py" ]

Dockerfile.test_tcp_example

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Build image
2+
# $ docker build -t micropython-tcp-example -f Dockerfile.test_tcp_example .
3+
# if a command fails, it will exit with non-zero code
4+
#
5+
# Run image, only possible if all tests passed
6+
# $ docker run -it --rm --name micropython-tcp-example micropython-tcp-example
7+
8+
FROM micropython/unix:v1.18
9+
10+
# use "volumes" in docker-compose file to remove need of rebuilding
11+
# COPY ./ /home
12+
# COPY umodbus /root/.micropython/lib/umodbus
13+
# COPY mpy_unittest.py /root/.micropython/lib/mpy_unittest.py
14+
15+
RUN micropython-dev -m upip install micropython-ulogging
16+
RUN micropython-dev -m upip install micropython-urequests

Dockerfile.tests

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Build image
2+
# $ docker build -t micropython-test -f Dockerfile.tests .
3+
# if a unittest fails, it will exit with non-zero code
4+
#
5+
# Run image, only possible if all tests passed
6+
# $ docker run -it --rm --name micropython-test micropython-test
7+
8+
FROM micropython/unix:v1.18
9+
10+
COPY ./ /home
11+
# keep examples and tests registers JSON file easily in sync
12+
COPY registers/example.json /home/tests/test-registers.json
13+
COPY umodbus /root/.micropython/lib/umodbus
14+
COPY mpy_unittest.py /root/.micropython/lib/mpy_unittest.py
15+
16+
RUN micropython-dev -m upip install micropython-ulogging
17+
RUN micropython-dev -m upip install micropython-urequests
18+
RUN micropython-dev -c "import mpy_unittest as unittest; unittest.main('tests')"
19+
20+
ENTRYPOINT ["/bin/bash"]

0 commit comments

Comments
 (0)