Skip to content

Commit

Permalink
👷 Update order of pytest coverage comment (#1231)
Browse files Browse the repository at this point in the history
* 👷 Rearrange pytest report after comments

Because pytest reports fail on errors, preventing comments of test failures being posted (we only ever see comments of successful test results)

* 🎨

* 🙈 Update .dockerignore to also copy pyproject.toml

* 🔧 Remove pytest.ini_options config from main pyproject.toml

* 🎨 Change workdir name, since it clashes with omitting /tests/ dir in coverage report
  • Loading branch information
ff137 authored Dec 12, 2024
1 parent d452218 commit 07a2ca7
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
**

# Except the following
!pyproject.toml
!app/
!shared/
!endorser/
!trustregistry/
!waypoint/
!scripts/
!configuration/

!LICENSE

**/__pycache__/
40 changes: 20 additions & 20 deletions .github/workflows/continuous-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -932,26 +932,6 @@ jobs:
OUTPUT_FILE: test_output.xml
COVERAGE_FILE: test_coverage.txt

- name: Publish Pytest Report
uses: mikepenz/action-junit-report@v5
if: steps.pytest.outcome == 'success'
with:
check_name: JUnit Test Report
report_paths: "./pytest/test_output.xml"
fail_on_failure: true
detailed_summary: true
require_passed_tests: true

- name: Publish Pytest Regression Report
uses: mikepenz/action-junit-report@v5
if: steps.pytest-init-regression.outcome == 'success' || steps.pytest-run-regression.outcome == 'success'
with:
check_name: JUnit Test Report Regression
report_paths: "./pytest-regression/test_output.xml"
fail_on_failure: true
detailed_summary: true
require_passed_tests: true

- name: Pytest coverage comment
if: steps.pytest.outcome == 'success'
uses: MishaKav/[email protected]
Expand All @@ -976,6 +956,26 @@ jobs:
hide-report: ${{ github.event_name != 'pull_request' }}
hide-comment: ${{ github.event_name != 'pull_request' }}

- name: Publish Pytest Report
uses: mikepenz/action-junit-report@v5
if: steps.pytest.outcome == 'success'
with:
check_name: JUnit Test Report
report_paths: "./pytest/test_output.xml"
fail_on_failure: true
detailed_summary: true
require_passed_tests: true

- name: Publish Pytest Regression Report
uses: mikepenz/action-junit-report@v5
if: steps.pytest-init-regression.outcome == 'success' || steps.pytest-run-regression.outcome == 'success'
with:
check_name: JUnit Test Report Regression
report_paths: "./pytest-regression/test_output.xml"
fail_on_failure: true
detailed_summary: true
require_passed_tests: true

- name: Helmfile destroy pytest
uses: helmfile/[email protected]
if: always()
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"isort",
"jetstream",
"jsonld",
"junitxml",
"keyevent",
"Lago",
"levelname",
Expand All @@ -68,7 +69,9 @@
"proposalsattach",
"prover",
"psubscribe",
"pycache",
"pydantic",
"pyproject",
"pytest",
"PYTHONPATH",
"reqs",
Expand Down
6 changes: 3 additions & 3 deletions dockerfiles/tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:3.12-slim

WORKDIR /tests
WORKDIR /cloudapi-tests

# Copy the pyproject.toml for each submodule
COPY app/pyproject.toml app/
Expand All @@ -14,14 +14,14 @@ COPY endorser/poetry.lock endorser/
COPY trustregistry/poetry.lock trustregistry/
COPY waypoint/poetry.lock waypoint/

# Install all depedencies
# Install all dependencies
ARG POETRY_VERSION=1.8.4
RUN pip install --no-cache-dir poetry==${POETRY_VERSION}

ENV POETRY_VIRTUALENVS_CREATE=false
ARG MODULES="app endorser trustregistry waypoint"
RUN for module in ${MODULES}; do \
cd /tests/$module && poetry install; \
cd /cloudapi-tests/$module && poetry install; \
done

COPY . .
Expand Down
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,3 @@ omit = ["*/tests/*"]

[tool.isort]
profile = "black"

[tool.pytest.ini_options]
addopts = "--junitxml=junit.xml -p no:cacheprovider --cov-report=xml --cov-report=term"
junit_family = "xunit2"

0 comments on commit 07a2ca7

Please sign in to comment.