Skip to content

Add code coverage for backend tests #2056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jul 6, 2025
Merged

Add code coverage for backend tests #2056

merged 12 commits into from
Jul 6, 2025

Conversation

gantoine
Copy link
Member

@gantoine gantoine commented Jul 6, 2025

Description
Explain the changes or enhancements you are proposing with this pull request.

Checklist
Please check all that apply.

  • I've tested the changes locally
  • I've updated relevant comments
  • I've assigned reviewers for this PR
  • I've added unit tests that cover the changes

Screenshots

Copy link

trunk-io bot commented Jul 6, 2025

Running Code Quality on PRs by uploading data to Trunk will soon be removed. You can still run checks on your PRs using trunk-action - see the migration guide for more information.

Copy link

github-actions bot commented Jul 6, 2025

Test Results

168 tests   168 ✅  38s ⏱️
  1 suites    0 💤
  1 files      0 ❌

Results for commit 2e047e4.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 6, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
7715 4913 64% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
backend/endpoints/sockets/scan.py 24% 🟢
backend/tasks/update_launchbox_metadata.py 98% 🟢
backend/tasks/update_switch_titledb.py 100% 🟢
TOTAL 74% 🟢

updated for commit: 2e047e4 by action🐍

@gantoine gantoine requested review from adamantike and Copilot July 6, 2025 13:46
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR integrates code coverage into the backend test suite, updates CI to generate and publish coverage reports, and adds robustness improvements in task pipelines and logging.

  • Add pytest-cov and configure .coveragerc to collect coverage
  • Update GitHub Actions workflow to produce and publish coverage reports
  • Enhance task code with stricter batching, better logging, and corrected comparison logic

Reviewed Changes

Copilot reviewed 13 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pytest.ini Enable LAUNCHBOX_API_ENABLED in test environment
pyproject.toml Add pytest-cov dependency
.coveragerc Omit migrations and tests from coverage
.github/workflows/pytest.yml Run pytest with coverage flags and publish reports
backend/tasks/update_switch_titledb.py Use strict=False in batch calls
backend/tasks/update_launchbox_metadata.py Add warning for missing content, annotate image lists, store last game images
backend/endpoints/sockets/scan.py Change __add__ handling and fix rom.id string comparison
Comments suppressed due to low confidence (2)

backend/endpoints/sockets/scan.py:113

  • The docstring mentions metadata_sources, but this parameter is not in the signature; update or remove this entry for accuracy.
        metadata_sources (list[str], optional): List of metadata sources to be used

backend/tasks/update_switch_titledb.py:42

  • The comprehension maps v['id'] without verifying its presence, which may raise a KeyError; consider filtering with if v.get('id') as in the index mapping.
                product_map = {

@gantoine gantoine marked this pull request as ready for review July 6, 2025 15:29
@gantoine gantoine merged commit 4345e38 into master Jul 6, 2025
9 checks passed
@gantoine gantoine deleted the code-coverage branch July 6, 2025 15:33
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.

2 participants