Skip to content

Add pytest configuration to pyproject.toml #1231

@kunal-10-cloud

Description

@kunal-10-cloud

Problem Statement

The project currently has no centralized pytest configuration. There is no [tool.pytest.ini_options] section in pyproject.toml, no pytest.ini file, and no pytest-specific configuration in setup.cfg. This forces every developer to memorize and manually specify pytest options when running tests.

Current Situation

Required "Magic Incantation"

Developers must run tests with explicit flags:

poetry run pytest -v tests --ignore tests/integration

Without these flags:

  • Integration tests attempt to run and fail with GCS authentication errors (confusing new contributors)
  • testpaths is not automatically discovered
  • Warning suppression must be manually managed
  • No standardized output format

Evidence of the Problem

  1. CONTRIBUTING.md (line 54) documents the exact command, implying developers shouldn't need to memorize it
  2. No pytest.ini or setup.cfg — configuration is scattered or implicit
  3. Integration tests auto-run — causes friction on first-time developer setup
  4. Pytest warnings not managed — dependencies generate ~451 warnings per test run
  5. No pattern standardization — python_files, python_classes, python_functions patterns undefined

Impact

Developer Experience (Negative)

  • Knowledge barrier: New contributors must read CONTRIBUTING.md instead of running intuitive commands
  • Onboarding friction: First-time poetry run pytest fails with cryptic GCS errors
  • Maintenance burden: Each developer needs to know/remember the exact incantation
  • Inconsistent behavior: Different developers may run tests differently, leading to missed failures

Test Execution (Negative)

  • Noisy output: 451+ pytest warnings pollute test output and mask real issues
  • Unclear defaults: No explicit test discovery paths, pattern rules, or behaviors
  • Integration tests enabled by default: Causes failures for developers without GCS credentials
  • No traceback standardization: Different developers may see different output formats

Code Quality (Negative)

  • Missed failures: Warning noise can hide genuine problems
  • Inconsistent test runs: Different commands = different results
  • CI/local mismatch: Developers might run different commands than CI, causing surprises

Root Cause

Modern Python projects use pyproject.toml as the single source of truth for tool configuration. This project:

  • Has [tool.ruff] and [tool.mypy] configuration
  • Has pytest installed as a dev dependency with plugins
  • Missing [tool.pytest.ini_options] section

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions