-
Notifications
You must be signed in to change notification settings - Fork 65
core: change get_files handling for sort argument + clean up tests #452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
remove the madness with tmp dir hacking; just cd into tmp dir and use relative paths
There was a problem hiding this 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 improves the get_files function's handling of the sort argument to only apply sorting to glob/recursive file discovery while preserving the order of explicitly specified paths. It also modernizes the test suite by removing complex temporary directory handling in favor of pytest's built-in fixtures.
- Modified
get_filesto apply sorting only to globbed/recursive results, preserving input order for explicit paths - Simplified test infrastructure by replacing custom temp directory logic with pytest's
tmp_pathfixture - Added comprehensive test coverage for the new sorting behavior
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/my/core/common.py | Updates sorting logic to only sort glob/recursive results, not all paths |
| src/my/core/tests/test_get_files.py | Removes complex temp dir handling, adds new sort test, modernizes with pytest fixtures |
| src/my/bluemaestro.py | Removes outdated comment about sorting behavior |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/my/core/tests/test_get_files.py
Outdated
| def test_explicit_glob() -> None: | ||
| def test_sort(tmp_path_cwd: Path) -> None: | ||
| """ | ||
| Checkes that sorting only applies to globbed files. |
Copilot
AI
Aug 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in docstring: 'Checkes' should be 'Checks'.
| Checkes that sorting only applies to globbed files. | |
| Checks that sorting only applies to globbed files. |
src/my/core/tests/test_get_files.py
Outdated
| def test_implicit_glob() -> None: | ||
| def test_implicit_glob(tmp_path_cwd: Path) -> None: | ||
| ''' | ||
| Asterisc in the path results in globing too. |
Copilot
AI
Aug 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two typos in docstring: 'Asterisc' should be 'Asterisk' and 'globing' should be 'globbing'.
| Asterisc in the path results in globing too. | |
| Asterisk in the path results in globbing too. |
src/my/core/tests/test_get_files.py
Outdated
|
|
||
|
|
||
| def test_no_files() -> None: | ||
| def test_no_files(tmp_path_cwd) -> None: |
Copilot
AI
Aug 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing type annotation for tmp_path_cwd parameter. Should be tmp_path_cwd: Path for consistency with other test functions.
| def test_no_files(tmp_path_cwd) -> None: | |
| def test_no_files(tmp_path_cwd: Path) -> None: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #452 +/- ##
==========================================
+ Coverage 78.00% 78.05% +0.05%
==========================================
Files 188 188
Lines 12234 12214 -20
Branches 747 747
==========================================
- Hits 9543 9534 -9
+ Misses 1949 1938 -11
Partials 742 742
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
It makes more sense to only sort globbed/recursively discovered paths. Otherwise you might be in situation where your files historic order doesn't match the lexicographic order (e.g. if they are on different filesystems etc.), and this is impossible to workaround without modifying the module source code. Technically it's a breaking change, but expecting that for 99% usecases people pass a single directory to get_files. For the remaining usecases, the new behaviour probably makes more sense anyway.
No description provided.