Skip to content

chore: Add JUnit XML output to pytest and publish test results to PRs#566

Merged
Aaron ("AJ") Steers (aaronsteers) merged 7 commits into
mainfrom
devin/1748296708-junit-test-results
Jun 5, 2025
Merged

chore: Add JUnit XML output to pytest and publish test results to PRs#566
Aaron ("AJ") Steers (aaronsteers) merged 7 commits into
mainfrom
devin/1748296708-junit-test-results

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot commented May 26, 2025

Note from AJ (Aaron ("AJ") Steers (@aaronsteers))

Maxime Carbonneau-Leclerc (@maxi297) and Ben Church (@bnchrch) - This follows from the similar changes made for Airbyte connectors recently.

I wanted to carry this pattern also to PyAirbyte and CDK. PyAirbyte PR implementing the same is here:

Note:

  • I found that the exisitng pytest ini settings in pyproject.toml were being ignored because of the presence of the pytest.ini file. So, I've removed this section from pyproject.toml, with a comment noting that the settings are moved to pytest.ini.

Add JUnit XML output to pytest and publish test results to PRs

Description

This PR adds JUnit XML output to the pytest configuration in airbyte-python-cdk and adds a post-run step in the GitHub Actions workflow to publish test results back to PRs, similar to the implementation in the PyAirbyte repository.

Changes

  • Added --junit-xml=build/test-results/test-results.xml to the pytest configuration in pyproject.toml
  • Added the EnricoMi/publish-unit-test-result-action@v2 step to publish test results in the following workflows:
    • pytest_fast.yml
    • pytest_matrix.yml
    • test-command.yml
  • Added conditional logic to ensure test result publishing continues even if it fails
  • Used consistent naming pattern for test results

Testing

  • Verified that the JUnit XML output path is correctly configured
  • Verified that the GitHub Actions workflows are correctly updated

Link to Devin run

https://app.devin.ai/sessions/8c3fcd54a4e2406fa92ab027c447da9b

Requested by

Aaron ("AJ") Steers (aj@airbyte.io)

Important

Auto-merge enabled.

This PR is set to merge automatically when all requirements are met.

Co-Authored-By: Aaron <AJ> Steers <aj@airbyte.io>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

Original prompt from Aaron:

@Devin - take a look at the new connnector CI workflow in the main repo. You should find (1) a deterministic output path for pytest invocations, and (2) a post-run step in our CI test workflow that calls a junit report action in github actions. That action posts readable test results back to the PR. Can you please repeat this solution for the PyAirbyte repo?

@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Comment thread .github/workflows/pytest_matrix.yml Outdated
…y check name

Co-Authored-By: Aaron <AJ> Steers <aj@airbyte.io>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 26, 2025

PyTest Results (Fast)

3 655 tests   3 645 ✅  5m 42s ⏱️
    1 suites     10 💤
    1 files        0 ❌

Results for commit 1439d1f.

♻️ This comment has been updated with latest results.

Co-Authored-By: Aaron <AJ> Steers <aj@airbyte.io>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 26, 2025

PyTest Results (Full)

3 658 tests   3 648 ✅  17m 6s ⏱️
    1 suites     10 💤
    1 files        0 ❌

Results for commit 1439d1f.

♻️ This comment has been updated with latest results.

Comment thread pytest.ini Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes sense to me so I'll approve!

On another note and outside of scope, I did learn when reviewing that we had CI for fast tests and all tests. Is this really necessary? It feels like when tests are executed in the CI, we probably always want to run everything. If we agree on this, I'm wondering if we can simplify workflow stuff.

Comment thread .github/workflows/test-command.yml Outdated
Comment thread pytest.ini Outdated
@aaronsteers
Copy link
Copy Markdown
Member

Aaron ("AJ") Steers (aaronsteers) commented Jun 5, 2025

This change makes sense to me so I'll approve!

On another note and outside of scope, I did learn when reviewing that we had CI for fast tests and all tests. Is this really necessary? It feels like when tests are executed in the CI, we probably always want to run everything. If we agree on this, I'm wondering if we can simplify workflow stuff.

Maxime Carbonneau-Leclerc (@maxi297) - The benefit of the fast-test being separate is that it returns results much faster than the full test suite. 90% of failures can be found within 2-5 minutes, saving the 18-20 minutes wait to catch the other 10%. Also, fast-tests return immediately if any tests fail, speeding up iteration loops a lot.

The problem I have with relying just on the standard "full" tests is that even when there's a failure in one of the early tests, the report doesn't report back until the full 18+ minutes-long suite has completed. The fast version not only skips 'slow' tests, but it also fast-fails. So "compile-type" issues and many other types of failures return immediately if any fail.

If fast-tests fail, they fail fast so you can quickly fix the issue. If fast-tests succeed, it is very likely that the "full" tests will also succeed, so you have early high confidence after 5 minutes that the rest is fine. Without that, we really know nothing for 15-20 minutes unless we carefully trail the logs. 🙈

That said - I don't feel very strongly about having them both create comments or both creating check status. We can clearly see a failure in the PR checks status if needed, and in most cases, the results will be same/similar between the two. 🤷 If two comments is too much, we can remove one and probably still have it create a check status. If anything, I might lean towards the fast tests being "primary", since the extra fifteen minutes runtime only gives 3 more test results (if the above summaries are correct).

@aaronsteers Aaron ("AJ") Steers (aaronsteers) merged commit ad1184f into main Jun 5, 2025
28 of 29 checks passed
@aaronsteers Aaron ("AJ") Steers (aaronsteers) deleted the devin/1748296708-junit-test-results branch June 5, 2025 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants