Skip to content

⚡ [Feature]: Implement centralized pytest configuration via conftest.py #66

@PPeitsch

Description

@PPeitsch

Problem Description

Currently, the project's pytest configuration is managed primarily through pyproject.toml. While this is effective for basic settings, it lacks the flexibility to properly register custom command-line options or implement more advanced fixtures and hooks.

This was highlighted during a recent debugging session where an attempt to use a --timeout flag failed because it was not a registered option, complicating the process of diagnosing performance issues.

Proposed Solution

Establish a centralized conftest.py file in the tests/ directory to serve as the canonical location for advanced pytest configuration. This aligns with pytest best practices and provides a powerful mechanism for customizing test behavior.

This improvement will make the testing framework more robust, maintainable, and easier to debug. Key implementations would include:

  1. A pytest_addoption hook to formally register useful command-line options like --timeout.
  2. A central location for any fixtures that are shared across multiple test files.

Alternative Solutions

  1. Continue using only pyproject.toml: This is limiting. pyproject.toml is suitable for static configuration but cannot handle dynamic fixtures or programmatic hooks.
  2. Add conftest.py files to subdirectories: A single top-level conftest.py in the tests/ directory is cleaner for sharing fixtures and hooks across the entire project.

Additional Context

This is a non-breaking improvement to the development and testing workflow. It will make it easier to add features like test timeouts, custom markers, and complex fixtures in the future.

Implementation Details

This is a non-breaking improvement to the development and testing workflow. It will make it easier to add features like test timeouts, custom markers, and complex fixtures in the future.

Guidelines

  • I agree to follow this project's Contributing Guidelines
  • I have searched for similar feature requests
  • I understand that this is a request and implementation is not guaranteed

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions