Skip to content

Add support for the different pytest files#418

Merged
nathanjmcdougall merged 3 commits intomainfrom
185-all-pytest-configuration-methods-should-be-supported
Mar 28, 2025
Merged

Add support for the different pytest files#418
nathanjmcdougall merged 3 commits intomainfrom
185-all-pytest-configuration-methods-should-be-supported

Conversation

@nathanjmcdougall
Copy link
Collaborator

No description provided.

@nathanjmcdougall nathanjmcdougall linked an issue Mar 28, 2025 that may be closed by this pull request
Copy link
Contributor

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 introduces support for handling different pytest configuration files by updating test cases and file resolution logic in the tool. Key changes include:

  • Updating tests to use a unified files_manager() instead of PyprojectTOMLManager() where appropriate.
  • Enhancing configuration file resolution in the core tool with a new "bespoke" resolution mode and expanded file manager options.
  • Introducing DotPytestINIManager and PytestINIManager classes to manage .pytest.ini and pytest.ini files respectively.

Reviewed Changes

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

File Description
tests/usethis/_core/test_core_tool.py Updated tests to use files_manager() and added new test cases for pytest configuration file priority.
src/usethis/_tool.py Modified configuration resolution logic, added new file managers (including SetupCFGManager reference), and redefined get_active_config_file_managers for bespoke resolution.
src/usethis/_config_file.py Added classes DotPytestINIManager and PytestINIManager to support new pytest configuration files.
Comments suppressed due to low confidence (1)

src/usethis/_tool.py:940

  • There appears to be a duplicate definition of get_active_config_file_managers in the class. Consolidate the function implementations into a single, clear definition to avoid confusion and potential runtime issues.
def get_active_config_file_managers(self) -> set[KeyValueFileManager]:

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 28, 2025

CodSpeed Performance Report

Merging #418 will not alter performance

Comparing 185-all-pytest-configuration-methods-should-be-supported (ba79967) with main (57e3bd8)

Summary

✅ 1 untouched benchmarks

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.94%. Comparing base (d15467a) to head (ba79967).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #418      +/-   ##
==========================================
- Coverage   98.07%   97.94%   -0.13%     
==========================================
  Files          73       73              
  Lines        3420     3458      +38     
==========================================
+ Hits         3354     3387      +33     
- Misses         66       71       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nathanjmcdougall nathanjmcdougall merged commit 6c7e944 into main Mar 28, 2025
15 checks passed
@nathanjmcdougall nathanjmcdougall deleted the 185-all-pytest-configuration-methods-should-be-supported branch March 28, 2025 09:44
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.

All pytest configuration methods should be supported

3 participants