From 2cd35701ff77c0237ab9a79b6f4eb9fe18157d43 Mon Sep 17 00:00:00 2001 From: Dennis van Gils <37263907+Dennis-van-Gils@users.noreply.github.com> Date: Mon, 27 Feb 2023 20:56:08 +0100 Subject: [PATCH] Added coverage results --- .github/workflows/python-package.yml | 22 +++++++- README.rst | 2 + tests/test_dvg_qdeviceio.py | 78 +++++++--------------------- 3 files changed, 42 insertions(+), 60 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index c5fb6e2..adbcd78 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -28,7 +28,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install flake8 pytest pytest-cov + python -m pip install flake8 pytest coverage coveralls python -m pip install ${{ matrix.qt-lib }} python -m pip install -e . if [ -f requirements.txt ]; then pip install -r requirements.txt; fi @@ -40,4 +40,22 @@ jobs: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - pytest --cov src -s + coverage run ./tests/test_dvg_qdeviceio.py -vv --source=. -m + - name: Upload coverage data to coveralls.io + run: coveralls --service=github + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_FLAG_NAME: ${{ matrix.python-version }} ${{ matrix.qt-lib }} + COVERALLS_PARALLEL: true + coveralls: + name: Indicate completion to coveralls.io + needs: build + runs-on: ubuntu-latest + container: python:3-slim + steps: + - name: Finished + run: | + pip3 install --upgrade coveralls + coveralls --service=github --finish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.rst b/README.rst index a3b3a13..db1a1fe 100644 --- a/README.rst +++ b/README.rst @@ -4,6 +4,8 @@ :target: https://pypi.org/project/dvg-qdeviceio .. image:: https://github.com/Dennis-van-Gils/python-dvg-qdeviceio/actions/workflows/python-package.yml/badge.svg :target: https://github.com/Dennis-van-Gils/python-dvg-qdeviceio/actions/workflows/python-package.yml +.. image:: https://coveralls.io/repos/github/Dennis-van-Gils/python-dvg-qdeviceio/badge.svg + :target: https://coveralls.io/github/Dennis-van-Gils/python-dvg-qdeviceio .. image:: https://readthedocs.org/projects/python-dvg-qdeviceio/badge/?version=latest :target: https://python-dvg-qdeviceio.readthedocs.io/en/latest/?badge=latest .. image:: https://img.shields.io/badge/code%20style-black-000000.svg diff --git a/tests/test_dvg_qdeviceio.py b/tests/test_dvg_qdeviceio.py index b9628d9..be916af 100644 --- a/tests/test_dvg_qdeviceio.py +++ b/tests/test_dvg_qdeviceio.py @@ -701,61 +701,23 @@ def DAQ_function(): if __name__ == "__main__": - ALL = True - if ALL: - test_Worker_DAQ___INTERNAL_TIMER() - test_Worker_DAQ___INTERNAL_TIMER__start_dead() - test_Worker_DAQ___SINGLE_SHOT_WAKE_UP() - test_Worker_DAQ___SINGLE_SHOT_WAKE_UP__start_dead() - test_Worker_DAQ___CONTINUOUS() - test_Worker_DAQ___CONTINUOUS__start_dead() - test_Worker_jobs() - test_Worker_jobs__start_dead() - test_Worker_jobs__jobs_function() - test_attach_device_twice() - test_Worker_DAQ___no_device_attached() - test_Worker_jobs__no_device_attached() - test_Worker_DAQ___start_without_create() - test_Worker_jobs__start_without_create() - test_Worker_DAQ___quit_without_start() - test_Worker_jobs__quit_without_start() - test_Worker_DAQ___rate() - test_Worker_DAQ___lose_connection() - test_Worker_DAQ___INTERNAL_TIMER__subclassed() - test_Worker_DAQ___ILLEGAL_DAQ_FUNCTION() - else: - # test_Worker_DAQ___INTERNAL_TIMER() - # test_Worker_DAQ___INTERNAL_TIMER__start_dead() - # test_Worker_DAQ___SINGLE_SHOT_WAKE_UP() - # test_Worker_DAQ___SINGLE_SHOT_WAKE_UP__start_dead() - - """ - import msvcrt - while True: - test_Worker_DAQ___CONTINUOUS() - if msvcrt.kbhit() and msvcrt.getch() == chr(27).encode(): - break - """ - - test_Worker_DAQ___CONTINUOUS() - # test_Worker_DAQ___CONTINUOUS__start_dead() - - # test_Worker_DAQ___rate() - # test_Worker_DAQ___lose_connection() - # test_Worker_DAQ___no_device_attached() - # test_Worker_DAQ___start_without_create() - - # test_Worker_jobs() - # test_Worker_jobs__start_dead() - # test_Worker_jobs__jobs_function() - # test_Worker_jobs__no_device_attached() - # test_Worker_jobs__start_without_create() - - # test_Worker_DAQ___quit_without_start() - # test_Worker_jobs__quit_without_start() - - # test_attach_device_twice() - - # test_Worker_DAQ___INTERNAL_TIMER__subclassed() - # test_Worker_DAQ___lose_connection() - # test_Worker_DAQ___ILLEGAL_DAQ_FUNCTION() + test_Worker_DAQ___INTERNAL_TIMER() + test_Worker_DAQ___INTERNAL_TIMER__start_dead() + test_Worker_DAQ___SINGLE_SHOT_WAKE_UP() + test_Worker_DAQ___SINGLE_SHOT_WAKE_UP__start_dead() + test_Worker_DAQ___CONTINUOUS() + test_Worker_DAQ___CONTINUOUS__start_dead() + test_Worker_jobs() + test_Worker_jobs__start_dead() + test_Worker_jobs__jobs_function() + test_attach_device_twice() + test_Worker_DAQ___no_device_attached() + test_Worker_jobs__no_device_attached() + test_Worker_DAQ___start_without_create() + test_Worker_jobs__start_without_create() + test_Worker_DAQ___quit_without_start() + test_Worker_jobs__quit_without_start() + test_Worker_DAQ___rate() + test_Worker_DAQ___lose_connection() + test_Worker_DAQ___INTERNAL_TIMER__subclassed() + test_Worker_DAQ___ILLEGAL_DAQ_FUNCTION()