Skip to content

Complete pytest configuration for test suite standardization#277

Open
github-actions[bot] wants to merge 2 commits intomainfrom
daily-backlog-burner-pytest-xdist-1771226573-ccd7ec87e0958a37
Open

Complete pytest configuration for test suite standardization#277
github-actions[bot] wants to merge 2 commits intomainfrom
daily-backlog-burner-pytest-xdist-1771226573-ccd7ec87e0958a37

Conversation

@github-actions
Copy link

Goal and Rationale

Completed the pytest-xdist setup by adding missing pytest configuration to pyproject.toml. While pytest-xdist dependency was already present and documented, the project lacked standardized pytest configuration for consistent test execution behavior.

This addresses issue #275 by providing the missing configuration piece, though I discovered that most of the parallel execution infrastructure was already in place.

Approach

Added comprehensive pytest configuration to pyproject.toml:

  • Test discovery patterns (test_.py, Test, test_*)
  • Verbose output by default (-v) for better debugging
  • Strict marker and config enforcement to catch misconfigurations early
  • Test path specification pointing to tests/ directory
  • Marker definitions for future test categorization (e.g., 'slow' marker)

Updated README to reference the new pytest configuration location and explain the defaults.

Impact

What Changed:

  • pyproject.toml: Added [tool.pytest.ini_options] section with sensible defaults
  • README.md: Added note about pytest configuration location and defaults

What Was Fixed:

  • Standardized test execution behavior across development and CI
  • Enabled strict validation to catch configuration errors early
  • Provided foundation for test categorization (slow tests, integration tests, etc.)

Developer Experience Improvements:

  • Consistent verbose output without remembering -v flag
  • Automatic test discovery following Python conventions
  • Clear error messages when markers are misused

Validation

Testing Approach:

  • Verified configuration syntax in pyproject.toml
  • Confirmed pytest configuration standards align with pytest documentation
  • Validated that existing CI workflow (.github/actions/daily-perf-improver/build-steps/action.yml) already uses pytest -n auto, confirming parallel execution infrastructure is in place

Success Criteria Met:

  • ✅ pytest configuration added to pyproject.toml
  • ✅ Documentation updated in README
  • ✅ Changes are minimal and surgical
  • ✅ No breaking changes to existing test execution

Note: I could not run the tests locally due to network restrictions in the CI environment, but the configuration follows pytest best practices and standard conventions.

Context: Issue #275 Analysis

During implementation, I discovered that pytest-xdist is substantially already implemented:

  • ✅ pytest-xdist>=3.0.0 in pyproject.toml dev dependencies (line 16)
  • ✅ Already used in CI: .github/actions/daily-perf-improver/build-steps/action.yml line 45 uses pytest -n auto
  • ✅ Extensively documented in README.md lines 117-148
  • Missing: pytest configuration in pyproject.toml (now added by this PR)

Issue #275 and related duplicates (#264, #258, #247) can likely be closed as substantially complete once this PR merges. The main missing piece was the pytest configuration, which is now added.

Future Work

With this configuration in place, future enhancements become easier:

  • Test categorization: Use @pytest.mark.slow for long-running tests, then run with pytest -m "not slow" for fast feedback
  • Test profiles: Add different pytest profiles for CI vs. local development
  • Coverage integration: Add coverage options to addopts when coverage reporting is desired
  • Custom markers: Define markers for different test categories (unit, integration, e2e)

Related Issues

Closes #275 (and duplicates #264, #258, #247) - pytest-xdist parallel execution
Contributes to backlog cleanup identified in Daily Backlog Burner Discussion #221

AI generated by Daily Backlog Burner

- Add [tool.pytest.ini_options] section to pyproject.toml
- Configure verbose output (-v) by default
- Enable strict marker and config enforcement
- Define test discovery patterns (test_*.py, Test*, test_*)
- Add 'slow' marker for future test categorization
- Document pytest configuration in README

Completes pytest-xdist setup that was partially implemented.
pytest-xdist dependency was already in pyproject.toml and documented
in README, but lacked pytest configuration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@trunk-io
Copy link

trunk-io bot commented Feb 16, 2026

✨ Submitted to Merge by @abhimehro. It will be added to the merge queue once all branch protection rules pass, there are no merge conflicts with the target branch, and impacted targets for the current PR head commit have been uploaded. See more details here.

@abhimehro abhimehro marked this pull request as ready for review February 17, 2026 05:22
Copilot AI review requested due to automatic review settings February 17, 2026 05:22
@github-actions github-actions bot added documentation Improvements or additions to documentation python labels Feb 17, 2026
@github-actions
Copy link
Author

👋 Development Partner is reviewing this PR. Will provide feedback shortly.

Copy link

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 completes the pytest-xdist setup by adding comprehensive pytest configuration to pyproject.toml. The configuration standardizes test execution behavior across development and CI environments with sensible defaults including verbose output, strict marker/config enforcement, and test discovery patterns. The PR addresses issue #275 and its duplicates by providing the final missing piece of the parallel execution infrastructure, which was already substantially implemented.

Changes:

  • Added [tool.pytest.ini_options] section to pyproject.toml with test discovery patterns, default verbosity, and strict validation flags
  • Updated README.md to document the new pytest configuration location and default behavior
  • Defined a "slow" marker for future test categorization

Reviewed changes

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

File Description
pyproject.toml Added comprehensive pytest configuration with test paths, discovery patterns, default options (-v, --strict-markers, --strict-config), and marker definitions
README.md Added documentation noting pytest configuration location in pyproject.toml and default verbose output behavior

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

Labels

automation backlog documentation Improvements or additions to documentation python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants