Skip to content

Parallelize tests for faster PR turnaround time#372

Merged
dphuang2 merged 4 commits intomainfrom
dhuang/pro-437-parallelize-tests-for-faster-pr-turnaround-time
Dec 14, 2025
Merged

Parallelize tests for faster PR turnaround time#372
dphuang2 merged 4 commits intomainfrom
dhuang/pro-437-parallelize-tests-for-faster-pr-turnaround-time

Conversation

@dphuang2
Copy link
Collaborator

@dphuang2 dphuang2 commented Dec 14, 2025

Enhance CI workflow to support sharded testing for core tests. Update test names to include shard information and streamline test execution by replacing inline pytest commands with a dedicated script for sharded tests. Remove coverage upload steps for batch evaluation and MCP end-to-end tests.


name: Pull Request
about: Propose changes to the codebase
title: "Brief description of changes"
labels: ''
assignees: ''


Description

Please include a summary of the change and which issue is fixed or feature is implemented. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)
Implements # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Refactoring/Code cleanup
  • Build/CI/CD related changes
  • Other (please describe):

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.

  • Test A
  • Test B

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • My code follows the style guidelines of this project (ran black ., isort ., flake8 .)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Screenshots (if applicable)

If applicable, add screenshots to help showcase your changes.

Additional context

Add any other context about the PR here.


Note

Shard core tests via a new test runner script, remove coverage uploads, and harden tests (JSON parsing, CLI test isolation).

  • CI
    • Sharded Core Tests: Add matrix sharding (shard 1–4) and run via scripts/run_sharded_tests.sh; job names include shard info.
    • Sharded Runner Script: New scripts/run_sharded_tests.sh to split test files, support --dry-run, and run pytest -n auto while excluding slow/remote tests.
    • Coverage Simplification: Remove coverage collection/artifact uploads and Codecov upload; streamline batch-evaluation and MCP E2E steps.
  • Tests
    • Robust JSON parsing: tests/pytest/test_pytest_klavis_mcp.py now safely parses JSON and defaults score=0.0 on errors with logging.
    • CLI test isolation: test_cli_full_command_style_evaluator_and_dataset_flags now uses tmp_path and changes CWD to avoid running real project tests.
  • Repo
    • Remove /.github/PULL_REQUEST_TEMPLATE.md.

Written by Cursor Bugbot for commit 61a4db6. This will update automatically on new commits. Configure here.

Dylan Huang added 2 commits December 13, 2025 19:28
… test names to include shard information and streamline test execution by replacing inline pytest commands with a dedicated script for sharded tests. Remove coverage upload steps for batch evaluation and MCP end-to-end tests.
@dphuang2 dphuang2 enabled auto-merge (squash) December 14, 2025 03:54
score = parsed.get("score", 0.0)
except (json.JSONDecodeError, TypeError):
logger.warning("Failed to parse response as JSON: %s", response_text)
score = 0.0
Copy link

Choose a reason for hiding this comment

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

Bug: Exception handler misses AttributeError from dict method

The try/except block catches json.JSONDecodeError and TypeError, but if the API returns valid JSON that isn't a dictionary (like an integer "123" or a list "[]"), calling .get() on the parsed value raises AttributeError, which escapes the handler. Adding AttributeError to the except clause would make the error handling complete.

Fix in Cursor Fix in Web

@dphuang2 dphuang2 merged commit 948961b into main Dec 14, 2025
16 of 17 checks passed
@dphuang2 dphuang2 deleted the dhuang/pro-437-parallelize-tests-for-faster-pr-turnaround-time branch December 14, 2025 04:12
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.

1 participant