From e7e094a14c818dd79a74519a5dc8cf01c89026fd Mon Sep 17 00:00:00 2001 From: Mike Kinney Date: Wed, 1 Dec 2021 10:17:39 -0800 Subject: [PATCH 1/4] add requirements.txt; update ci --- .github/workflows/ci.yml | 5 ++-- README.md | 6 +++++ requirements.txt | 53 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 requirements.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0860cba..7e679cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Run Python Tests +name: Linting and Tests on: push: branches: @@ -19,7 +19,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install markdown pdoc3 webencodings pyparsing twine autopep8 pylint pytest + pip install -r requirements.txt + pip install . - name: Run pylint run: pylint --exit-zero meshtastic - name: Run tests with pytest diff --git a/README.md b/README.md index 17a2f3f..c62a582 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,12 @@ apt install pandoc sudo pip3 install markdown pdoc3 webencodings pyparsing twine autopep8 pylint pytest ``` +For development, you will probably want to run: +``` +pip3 install -r requirements.txt +``` + + To lint, run: ``` pylint meshtastic diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e13ac07 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,53 @@ +astroid==2.9.0 +attrs==21.2.0 +autopep8==1.6.0 +bleach==4.1.0 +certifi==2021.10.8 +charset-normalizer==2.0.8 +colorama==0.4.4 +docutils==0.18.1 +dotmap==1.3.25 +enum-compat==0.0.3 +idna==3.3 +importlib-metadata==4.8.2 +iniconfig==1.1.1 +isort==5.10.1 +keyring==23.4.0 +lazy-object-proxy==1.6.0 +Mako==1.1.6 +Markdown==3.3.6 +MarkupSafe==2.0.1 +mccabe==0.6.1 +packaging==21.3 +pdoc3==0.10.0 +pexpect==4.8.0 +pkginfo==1.8.1 +platformdirs==2.4.0 +pluggy==1.0.0 +protobuf==3.19.1 +ptyprocess==0.7.0 +py==1.11.0 +pycodestyle==2.8.0 +pygatt==4.0.5 +Pygments==2.10.0 +pylint==2.12.1 +pyparsing==3.0.6 +Pypubsub==4.0.3 +PyQRCode==1.2.1 +pyserial==3.5 +pytest==6.2.5 +readme-renderer==30.0 +requests==2.26.0 +requests-toolbelt==0.9.1 +rfc3986==1.5.0 +six==1.16.0 +tabulate==0.8.9 +timeago==1.0.15 +toml==0.10.2 +tqdm==4.62.3 +twine==3.7.0 +typing_extensions==4.0.1 +urllib3==1.26.7 +webencodings==0.5.1 +wrapt==1.13.3 +zipp==3.6.0 From ef811b5f7b033f62317d39f26b21d21e790e5679 Mon Sep 17 00:00:00 2001 From: Mike Kinney Date: Wed, 1 Dec 2021 10:34:48 -0800 Subject: [PATCH 2/4] add coverage --- .github/workflows/ci.yml | 2 +- .gitignore | 1 + README.md | 3 ++- requirements.txt | 3 +++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e679cc..d363008 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,4 +24,4 @@ jobs: - name: Run pylint run: pylint --exit-zero meshtastic - name: Run tests with pytest - run: pytest + run: pytest --cov=meshtastic diff --git a/.gitignore b/.gitignore index f414903..35fef00 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ log_* .eggs nanopb-0.4.4 .*swp +.coverage diff --git a/README.md b/README.md index c62a582..ccde356 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,7 @@ If you need to build a new release you'll need: ``` apt install pandoc -sudo pip3 install markdown pdoc3 webencodings pyparsing twine autopep8 pylint pytest +sudo pip3 install markdown pdoc3 webencodings pyparsing twine autopep8 pylint pytest pytest-cov ``` For development, you will probably want to run: @@ -182,3 +182,4 @@ Possible options for testing: * to run just unit tests: pytest -munit * to run just integration tests: pytest -mint * if you want to add another classification of tests, then look in pytest.ini +* if you want to see the unit test code coverage: pytest --cov=meshtastic diff --git a/requirements.txt b/requirements.txt index e13ac07..e9e0f8f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,7 @@ bleach==4.1.0 certifi==2021.10.8 charset-normalizer==2.0.8 colorama==0.4.4 +coverage==6.2 docutils==0.18.1 dotmap==1.3.25 enum-compat==0.0.3 @@ -36,6 +37,7 @@ Pypubsub==4.0.3 PyQRCode==1.2.1 pyserial==3.5 pytest==6.2.5 +pytest-cov==3.0.0 readme-renderer==30.0 requests==2.26.0 requests-toolbelt==0.9.1 @@ -44,6 +46,7 @@ six==1.16.0 tabulate==0.8.9 timeago==1.0.15 toml==0.10.2 +tomli==1.2.2 tqdm==4.62.3 twine==3.7.0 typing_extensions==4.0.1 From 1874b0ce348ea7fdb1c73e6ebc18384136cd631d Mon Sep 17 00:00:00 2001 From: Mike Kinney Date: Wed, 1 Dec 2021 10:57:43 -0800 Subject: [PATCH 3/4] ignore some files during code coverage --- .coveragerc | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..731da94 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,2 @@ +[run] +omit = meshtastic/*_pb2.py,meshtastic/test/*,meshtastic/test.py From 2225ba35d78f99c7740bd949a2fb0660af70ee65 Mon Sep 17 00:00:00 2001 From: Mike Kinney Date: Wed, 1 Dec 2021 11:00:10 -0800 Subject: [PATCH 4/4] oops. need to add test dir back for coverage --- .coveragerc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.coveragerc b/.coveragerc index 731da94..5c70a1a 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,2 +1,2 @@ [run] -omit = meshtastic/*_pb2.py,meshtastic/test/*,meshtastic/test.py +omit = meshtastic/*_pb2.py,meshtastic/test.py