Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 12, 2025

Plan: Reduce xdist worker count on Windows ✅ COMPLETE

The goal is to improve test reliability on Windows GitHub Runners by reducing the pytest-xdist worker count from auto to 2.

  • Understand current xdist configuration (currently -n=auto in pyproject.toml files)
  • Modify GitHub Actions workflow to override -n parameter for Windows platforms
  • Verify the changes are correct
  • Validate YAML syntax
  • Test conditional logic
  • Refactor to use step output variable to avoid command duplication

Changes Made

Modified .github/workflows/test.yml to conditionally set -n 2 for Windows platforms using a cleaner approach:

  • Added a "Set pytest worker count" step that sets an output variable based on platform
  • Updated both test_quick and test_all jobs
  • Test commands now reference ${{ steps.pytest-workers.outputs.count }} instead of duplicating the conditional

Implementation Details

- name: "Set pytest worker count"
  id: pytest-workers
  run: |
    if [ "$RUNNER_OS" == "Windows" ]; then
      echo "count=2" >> $GITHUB_OUTPUT
    else
      echo "count=auto" >> $GITHUB_OUTPUT
    fi
  shell: bash

- name: "Test with latest dependencies"
  run: uv run pytest tests . -vv -n ${{ steps.pytest-workers.outputs.count }}
  working-directory: ${{ matrix.project }}

Behavior

  • Windows (windows-2022, windows-latest): Uses 2 workers (-n 2)
  • Linux (ubuntu-22.04, ubuntu-latest): Uses auto workers (-n auto)
  • macOS (macos-14, macos-latest): Uses auto workers (-n auto)
  • Local development: Unchanged, uses pyproject.toml settings

Benefits

✅ Cleaner implementation with no command duplication
✅ Single source of truth for worker count per platform
✅ Easier to maintain and modify in the future
✅ No impact on local development workflow
✅ Maintains optimal performance on Linux/macOS with auto worker count
✅ Improves Windows test reliability by reducing resource contention

Original prompt

This section details on the original issue you should resolve

<issue_title>Reduce xdist worker count on Windows</issue_title>
<issue_description>GitHub Runners on Windows are extremely slow, we should reduce the worker count to 2 for xdist to improve test reliability</issue_description>

Comments on the Issue (you are @copilot in this section)

@strawgate @claude please make a pull request for this

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 12, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI changed the title [WIP] Reduce xdist worker count on Windows Reduce xdist worker count to 2 on Windows Nov 12, 2025
Copilot AI requested a review from strawgate November 12, 2025 16:53
Copilot finished work on behalf of strawgate November 12, 2025 16:53
Repository owner deleted a comment from claude bot Nov 12, 2025
@strawgate
Copy link
Owner

@copilot i think we can do -n=auto and -n=2 for the cli, should we just have a pre-step which sets a variable to either 2 or auto depending on the platform so we dont need to duplicate the whole pytest cli command?

Copy link
Contributor Author

Copilot AI commented Nov 12, 2025

@copilot i think we can do -n=auto and -n=2 for the cli, should we just have a pre-step which sets a variable to either 2 or auto depending on the platform so we dont need to duplicate the whole pytes...

Refactored to use a step output variable. The "Set pytest worker count" step now sets the worker count to either "2" or "auto" based on platform, and both test commands reference ${{ steps.pytest-workers.outputs.count }}. This eliminates the duplication. (d3c84d7)

@sonarqubecloud
Copy link

1 similar comment
@sonarqubecloud
Copy link

Copilot finished work on behalf of strawgate November 12, 2025 17:09
@strawgate strawgate marked this pull request as ready for review November 12, 2025 17:21
@strawgate strawgate merged commit d595cd2 into main Nov 12, 2025
156 checks passed
@strawgate strawgate deleted the copilot/reduce-xdist-worker-count branch November 12, 2025 18:51
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.

Reduce xdist worker count on Windows

2 participants