feat(deps): add pytest-xdist for parallel test execution#216
feat(deps): add pytest-xdist for parallel test execution#216ayeshakhalid192007-dev wants to merge 1 commit intonirtal85:mainfrom
Conversation
Adds pytest-xdist==3.8.0 to project dependencies and configures CI to run tests with -n 2 workers, enabling parallel test execution. Closes nirtal85#1
📝 WalkthroughWalkthroughThis pull request enables parallel test execution by adding the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/devRun.yml (1)
44-44: Make xdist worker count configurable instead of hardcoding2.Line 44 works, but parameterizing workers makes CI tuning easier without editing workflow code.
Proposed refactor
env: FLAKINESS_PROJECT: nirtal85/Playwright-Python-Example + PYTEST_XDIST_WORKERS: "2" @@ - - name: Test with pytest - run: xvfb-run .venv/bin/python -m pytest -m devRun -n 2 --base-url ${{ vars.BASE_URL }} + - name: Test with pytest + run: xvfb-run .venv/bin/python -m pytest -m devRun -n "${PYTEST_XDIST_WORKERS}" --base-url ${{ vars.BASE_URL }}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/devRun.yml at line 44, Replace the hardcoded xdist worker count "-n 2" with a configurable workflow variable: define a job- or workflow-level env like TEST_WORKERS defaulting to "2" and update the pytest command (the line containing "xvfb-run .venv/bin/python -m pytest -m devRun -n 2 --base-url ${{ vars.BASE_URL }}") to use "-n ${{ env.TEST_WORKERS }}" (or use ${{ vars.TEST_WORKERS }} if you prefer repo-level vars) so CI tuning can change worker count without editing the workflow file.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/devRun.yml:
- Line 44: Replace the hardcoded xdist worker count "-n 2" with a configurable
workflow variable: define a job- or workflow-level env like TEST_WORKERS
defaulting to "2" and update the pytest command (the line containing "xvfb-run
.venv/bin/python -m pytest -m devRun -n 2 --base-url ${{ vars.BASE_URL }}") to
use "-n ${{ env.TEST_WORKERS }}" (or use ${{ vars.TEST_WORKERS }} if you prefer
repo-level vars) so CI tuning can change worker count without editing the
workflow file.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 10b687ec-f2e1-4427-bc21-28d542946c52
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (2)
.github/workflows/devRun.ymlpyproject.toml
What does this PR do?
Adds
pytest-xdistsupport to enable parallel test execution across multiple worker processes, as requested in #1.Root Cause
Tests were running sequentially in CI, causing slow feedback loops. There was no parallelisation mechanism in place despite
pytest-playwrighthaving built-in support forpytest-xdistworkers.Changes
pyproject.toml: Addedpytest-xdist==3.8.0to project dependencies.github/workflows/devRun.yml: Added-n 2flag to the pytest CI commandpyproject.toml: Addedasyncio_mode = "auto"under[tool.pytest.ini_options]to ensure async compatibility with xdist workersExpected Impact
pytest-playwright's built-in xdist support — no changes to fixtures or test files requiredType of Change
Checklist
pytest -n 2)-n 2flagCloses #1