Skip to content

Handle pytest “no tests collected” in Python application workflow - #2

Merged
fidel147 merged 1 commit into
mainfrom
copilot/fix-github-actions-build
Aug 14, 2026
Merged

fidel147 merged 1 commit into
mainfrom
copilot/fix-github-actions-build

Conversation

Copilot AI commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

The Python application / build workflow was failing on repositories with no Python tests because pytest exits with code 5 when nothing is collected. This change keeps that case non-fatal while preserving failure behavior for real test errors.

  • Problem scope

    • CI failure was caused by pytest exit semantics, not by application/runtime errors.
  • Workflow adjustment

    • Updated the test step in .github/workflows/python-app.yml to explicitly allow exit code 5.
    • Any other non-zero pytest exit code still fails the job.
  • Behavioral impact

    • Prevents false-negative CI failures when test files are absent.
    • Does not weaken failure signaling for actual test failures.
- name: Test with pytest
  run: |
    pytest || test $? -eq 5

Co-authored-by: fidel147 <196988566+fidel147@users.noreply.github.com>
@fidel147
fidel147 marked this pull request as ready for review August 14, 2026 22:19
Copilot AI lite review requested due to automatic review settings August 14, 2026 22:19
@fidel147
fidel147 merged commit e9d6cc4 into main Aug 14, 2026
2 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request updates the Python CI workflow to treat pytest exit code 5 (“no tests collected”) as a non-failing outcome, preventing CI failures in repositories that don’t include Python tests.

Changes:

  • Updated the pytest step to allow exit code 5 while still failing on any other non-zero exit code.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants