Repository: pi-top/pi-top-Python-SDK (language: python)

Issue:
Add test coverage report
- [x] Implement automated Python testing
- [x] Wrap testing in `coverage` check
- [x] Configure [CodeCov GitHub Action](https://github.com/codecov/codecov-action) to automatically upload to CodeCov
- [x] Add coverage badge to README


Discussion / hints:

Fix patch:
diff --git a/README.rst b/README.rst
index 914dc6c89..240465053 100644
--- a/README.rst
+++ b/README.rst
@@ -49,6 +49,9 @@ Build Status: Latest
 .. image:: https://img.shields.io/pypi/v/pitop
    :alt: PyPI release
 
+.. image:: https://img.shields.io/codecov/c/gh/pi-top/pi-top-Python-SDK?token=hfbgB9Got4
+   :alt: Codecov
+
 .. image:: https://readthedocs.com/projects/pi-top-pi-top-python-sdk/badge/?version=latest&token=13589f150cf192dcfc6ebfd53aae33164450aafd181c5e49018a21fd93149127
     :target: https://docs.pi-top.com/python-sdk/latest/?badge=latest
     :alt: Documentation Status
diff --git a/setup.py b/setup.py
index 33d16fe45..c3eaf749d 100644
--- a/setup.py
+++ b/setup.py
@@ -128,7 +128,7 @@
 __extra_requires__ = {
     "computer_vision": ["opencv"],
     "doc": ["sphinx"],
-    "test": ["pytest", "coverage", "mock"],
+    "test": ["pytest", "coverage", "mock", "pytest-cov", "pytest-mock"],
 }
 
 __entry_points__ = {


Test patch:
diff --git a/.github/workflows/test-and-build-on-all-commits.yml b/.github/workflows/test-and-build-on-all-commits.yml
index 23bff506e..3c5eb3451 100644
--- a/.github/workflows/test-and-build-on-all-commits.yml
+++ b/.github/workflows/test-and-build-on-all-commits.yml
@@ -8,7 +8,7 @@ on:
       - "ci-test-*"
 
 jobs:
-  test-pre-commit:
+  pre-commit-checks:
     runs-on: ubuntu-20.04
     steps:
       - name: Checkout code
@@ -20,37 +20,7 @@ jobs:
       - name: Run all pre-commit checks against all files
         uses: pre-commit/action@v2.0.0
 
-  test-python-linting:
-    runs-on: ubuntu-20.04
-    steps:
-      - name: Checkout code
-        uses: actions/checkout@v2.2.0
-        with:
-          fetch-depth: 0
-
-      - name: Lint code
-        uses: ricardochaves/python-lint@v1.3.0
-        with:
-          python-root-list: "pitop pitopcli"
-          use-flake8: true
-          extra-flake8-options: "--max-line-length=150"
-
-          use-pylint: false
-          # extra-pylint-options: ""
-
-          use-pycodestyle: false
-          # extra-pycodestyle-options: ""
-
-          use-black: false
-          # extra-black-options: ""
-
-          use-mypy: false
-          # extra-mypy-options: ""
-
-          use-isort: false
-          # extra-isort-options: ""
-
-  test-python-pytest:
+  python-test-coverage:
     runs-on: ubuntu-20.04
     steps:
       - name: Set up Python
@@ -76,26 +46,30 @@ jobs:
 
       - name: Checkout code
         uses: actions/checkout@v2.2.0
-        with:
-          fetch-depth: 0
-          path: main
 
       - name: Install dependencies
         run: |
           sudo apt-get install libv4l-dev # for building PyV4L2Camera
-          pip install "./main[test]"
+          pip install .[test]
 
-      - name: Run pytest
+      - name: Run tests
         run: |
-          python -m pytest main
+          PYTHONPATH=pitop python -m pytest --cov=pitop --cov-report=xml
+
+      - name: Upload test coverage report to Codecov
+        uses: codecov/codecov-action@v1
+        with:
+          files: ./coverage.xml
+          flags: unittests
+          env_vars: OS,PYTHON
+          fail_ci_if_error: true
+          verbose: true
 
   test-readme-render:
     runs-on: ubuntu-20.04
     steps:
       - name: Checkout code
         uses: actions/checkout@v2.2.0
-        with:
-          fetch-depth: 0
 
       - name: Set up Python
         uses: actions/setup-python@v2
@@ -112,7 +86,7 @@ jobs:
           python -m readme_renderer README.rst -o /dev/null
 
   build-debian-packages:
-    needs: [ test-pre-commit, test-python-linting, test-python-pytest, test-readme-render ]
+    needs: [ pre-commit-checks, python-test-coverage, test-readme-render ]
     runs-on: ubuntu-20.04
     steps:
       - name: GitHub Environment Variables Action
@@ -120,8 +94,6 @@ jobs:
 
       - name: Checkout code
         uses: actions/checkout@v2.2.0
-        with:
-          fetch-depth: 0
 
       - name: Patch changelog (snapshot)
         run: |