Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@karlicoss
Copy link
Owner

No description provided.

remove the madness with tmp dir hacking; just cd into tmp dir and use relative paths
@karlicoss karlicoss requested a review from Copilot August 14, 2025 00:07
Copy link

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 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_files to 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_path fixture
  • 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.

def test_explicit_glob() -> None:
def test_sort(tmp_path_cwd: Path) -> None:
"""
Checkes that sorting only applies to globbed files.
Copy link

Copilot AI Aug 14, 2025

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'.

Suggested change
Checkes that sorting only applies to globbed files.
Checks that sorting only applies to globbed files.

Copilot uses AI. Check for mistakes.
def test_implicit_glob() -> None:
def test_implicit_glob(tmp_path_cwd: Path) -> None:
'''
Asterisc in the path results in globing too.
Copy link

Copilot AI Aug 14, 2025

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'.

Suggested change
Asterisc in the path results in globing too.
Asterisk in the path results in globbing too.

Copilot uses AI. Check for mistakes.


def test_no_files() -> None:
def test_no_files(tmp_path_cwd) -> None:
Copy link

Copilot AI Aug 14, 2025

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.

Suggested change
def test_no_files(tmp_path_cwd) -> None:
def test_no_files(tmp_path_cwd: Path) -> None:

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Aug 14, 2025

Codecov Report

❌ Patch coverage is 98.43750% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 78.05%. Comparing base (5e33113) to head (131a2b8).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/my/core/tests/test_get_files.py 98.21% 1 Missing ⚠️
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              
Flag Coverage Δ
mypy-3.10 77.96% <98.43%> (+0.05%) ⬆️
mypy-3.11 77.98% <98.43%> (+0.05%) ⬆️
mypy-3.12 78.01% <98.43%> (+0.05%) ⬆️
mypy-3.13 78.00% <98.43%> (+0.05%) ⬆️
mypy-3.9 77.91% <98.43%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.
@karlicoss karlicoss merged commit 6272cf5 into master Aug 15, 2025
22 checks passed
@karlicoss karlicoss deleted the get-files branch August 15, 2025 21: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.

2 participants