Skip to content

Commit ad1184f

Browse files
chore: Add JUnit XML output to pytest and publish test results to PRs (#566)
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Aaron <AJ> Steers <[email protected]>
1 parent c64ff62 commit ad1184f

File tree

5 files changed

+30
-8
lines changed

5 files changed

+30
-8
lines changed

.github/workflows/pytest_fast.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ jobs:
7070
poetry run coverage html -d htmlcov
7171
poetry run coverage xml -o htmlcov/coverage.xml
7272
73+
- name: Publish Test Results
74+
uses: EnricoMi/publish-unit-test-result-action@v2
75+
if: always() && !cancelled()
76+
continue-on-error: true
77+
with:
78+
check_name: "PyTest Results (Fast)"
79+
large_files: true
80+
files: |
81+
build/test-results/**/*.xml
7382
- name: Upload coverage to GitHub Artifacts
7483
if: always()
7584
uses: actions/upload-artifact@v4

.github/workflows/pytest_matrix.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ jobs:
9393
poetry run coverage html -d htmlcov
9494
poetry run coverage xml -o htmlcov/coverage.xml
9595
96+
- name: Publish Test Results
97+
uses: EnricoMi/publish-unit-test-result-action@v2
98+
if: always() && !cancelled() && steps.changes.outputs.src == 'true' && matrix.python-version == '3.11'
99+
continue-on-error: true
100+
with:
101+
check_name: "PyTest Results (Full)"
102+
large_files: true
103+
files: |
104+
build/test-results/**/*.xml
96105
- name: Upload coverage to GitHub Artifacts
97106
if: always() && steps.changes.outputs.src == 'true'
98107
uses: actions/upload-artifact@v4

.github/workflows/test-command.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ jobs:
113113
--verbose
114114
-m "flaky and not super_slow"
115115
116+
- name: Publish Test Results
117+
uses: EnricoMi/publish-unit-test-result-action@v2
118+
if: always() && !cancelled() && matrix.python-version == '3.11'
119+
continue-on-error: true
120+
with:
121+
check_name: "PyTest Results (On-Demand)"
122+
large_files: true
123+
files: |
124+
build/test-results/**/*.xml
116125
- name: Post CI Success to GitHub
117126
run: |
118127
curl --request POST \

pyproject.toml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,8 @@ ignore = [
193193
"W002" # Duplicate files. (TODO: Fix the few duplicate files, mostly `__init__.py` files that have only copyright text.)
194194
]
195195

196-
[tool.pytest.ini_options]
197-
log_cli = true
198-
log_cli_level = "INFO"
199-
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"
200-
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
201-
filterwarnings = [
202-
"ignore::airbyte_cdk.sources.source.ExperimentalClassWarning"
203-
]
196+
# [tool.pytest.ini_options]
197+
# NOTE: PyTest options moved to dedicated `pytest.ini`
204198

205199
[tool.airbyte_ci]
206200
python_versions = ["3.10", "3.11"]

pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ log_cli = 1
33
log_cli_level = INFO
44
log_cli_format = %(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)
55
log_cli_date_format=%Y-%m-%d %H:%M:%S
6+
addopts = --junit-xml=build/test-results/pytest-results.xml
67
filterwarnings =
78
ignore::airbyte_cdk.sources.source.ExperimentalClassWarning
89
markers =

0 commit comments

Comments
 (0)