Skip to content

Add pythonpath config to pytest if necessary#534

Merged
nathanjmcdougall merged 3 commits intomainfrom
347-add-pytest-pythonpath
Apr 21, 2025
Merged

Add pythonpath config to pytest if necessary#534
nathanjmcdougall merged 3 commits intomainfrom
347-add-pytest-pythonpath

Conversation

@nathanjmcdougall
Copy link
Copy Markdown
Collaborator

No description provided.

@nathanjmcdougall nathanjmcdougall changed the title Add failing test Add pythonpath config to pytest if necessary Apr 20, 2025
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 21, 2025

CodSpeed Performance Report

Merging #534 will not alter performance

Comparing 347-add-pytest-pythonpath (47267b3) with main (9e41c33)

Summary

✅ 1 untouched benchmarks

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.26%. Comparing base (2984165) to head (47267b3).
Report is 4 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #534   +/-   ##
=======================================
  Coverage   97.25%   97.26%           
=======================================
  Files          85       86    +1     
  Lines        4120     4130   +10     
=======================================
+ Hits         4007     4017   +10     
  Misses        113      113           

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

@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review April 21, 2025 03:27
Copy link
Copy Markdown
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 enhances pytest configuration by conditionally setting the pythonpath based on the project configuration and source directory structure.

  • Introduces a new test (test_pythonpath_needed) in tests/usethis/_core/test_core_tool.py to validate the pythonpath behavior.
  • Updates src/usethis/_tool.py to set the pythonpath if the project lacks a declared build system.
  • Adds a new utility function in src/usethis/_integrations/project/build.py to detect a declared build system in pyproject.toml.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/usethis/_core/test_core_tool.py Added new test for validating pythonpath configuration.
src/usethis/_tool.py Added conditional logic to set pythonpath based on source directory.
src/usethis/_integrations/project/build.py New function to check for declared build system in pyproject.toml.

@nathanjmcdougall nathanjmcdougall merged commit 43566dc into main Apr 21, 2025
17 checks passed
@nathanjmcdougall nathanjmcdougall deleted the 347-add-pytest-pythonpath branch April 21, 2025 03:28
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.

pytest test discovery doesn't work well with a src layout without a build backend

2 participants