From e575b256873b2b3dad5d6fc4e2eed6c653e425a0 Mon Sep 17 00:00:00 2001 From: JLBegin Date: Sat, 19 Apr 2025 21:32:43 -0400 Subject: [PATCH 1/3] Create test-coverage.yaml --- .github/workflows/test-coverage.yaml | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/test-coverage.yaml diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml new file mode 100644 index 00000000..55e2763d --- /dev/null +++ b/.github/workflows/test-coverage.yaml @@ -0,0 +1,41 @@ +name: Test Coverage + +on: [ pull_request, workflow_dispatch ] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Linux packages for Qt5/Qt6 support and start Xvfb + uses: pyvista/setup-headless-display-action@v3 + with: + qt: true + + - name: Linux OpenCL support + run: | + sudo apt-get update + sudo apt-get install -y pocl-opencl-icd ocl-icd-opencl-dev gcc clinfo + clinfo + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 + with: + python-version: 3.11 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e .[dev] + + - name: Run tests with coverage + env: + PTO_CI_MODE: 1 + run: | + coverage run -m pytest -v --cov=pytissueoptics --cov-report=xml --cov-report=html + + - name: Upload coverage report + uses: codecov/codecov-action@v4 From 0fbdaf536f7b007b362f195b1acb87049ba39cd4 Mon Sep 17 00:00:00 2001 From: JLBegin Date: Sat, 19 Apr 2025 21:44:03 -0400 Subject: [PATCH 2/3] Update tests.yaml --- .github/workflows/tests.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index b5dba491..2316f228 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -42,8 +42,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install setuptools>=40.8.0 wheel pytest - python -m pip install . + python -m pip install -e .[dev] python -m pip freeze --all - name: Validate OpenCL From 479f875bfc19c4c8b1a935c23dfb53dd07aed8ba Mon Sep 17 00:00:00 2001 From: JLBegin Date: Sat, 19 Apr 2025 21:55:34 -0400 Subject: [PATCH 3/3] use pytest-cov --- .github/workflows/test-coverage.yaml | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 55e2763d..f1e00a75 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -35,7 +35,7 @@ jobs: env: PTO_CI_MODE: 1 run: | - coverage run -m pytest -v --cov=pytissueoptics --cov-report=xml --cov-report=html + pytest -v --cov=pytissueoptics --cov-report=xml --cov-report=html - name: Upload coverage report uses: codecov/codecov-action@v4 diff --git a/pyproject.toml b/pyproject.toml index 06f218ad..f10bfa97 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,8 +35,8 @@ dependencies = [ [project.optional-dependencies] dev = [ "mockito", - "coverage", "pytest", + "pytest-cov", "ruff", ]