Skip to content
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

Re-work colcon_core.command.get_prog_name #617

Merged
merged 6 commits into from
Jun 3, 2024
Merged

Conversation

cottsay
Copy link
Member

@cottsay cottsay commented Feb 18, 2024

This function's purpose is to handle these special cases of argv[0]:

  • Invoked using python -m ...
  • Invoked using a path to the executable even though the executable is on the PATH

This change enhances the path comparison to support normalization of the paths, Windows long path prefixes, and also the easy-install behavior on Windows where argv[0] has no extension.

Yet to be properly handled is invocation using python -c ...

This function's purpose is to handle these special cases of argv[0]:
* Invoked using python -m ...
* Invoked using a path to the executable even though the executable is
   on the PATH

This change enhances the path comparison to support normalization of
that path, Windows long path prefixes, and also the easy-install
behavior on Windows where argv[0] has no extension.

Yet to be properly handled is invocation using python -c ...
@cottsay cottsay self-assigned this Feb 18, 2024
Copy link

codecov bot commented Feb 18, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 83.33%. Comparing base (37dc1dd) to head (f5cb3c9).
Report is 1 commits behind head on master.

Files Patch % Lines
colcon_core/command.py 80.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #617      +/-   ##
==========================================
+ Coverage   83.27%   83.33%   +0.06%     
==========================================
  Files          66       66              
  Lines        3857     3865       +8     
  Branches      762      763       +1     
==========================================
+ Hits         3212     3221       +9     
+ Misses        556      555       -1     
  Partials       89       89              

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

@cottsay cottsay added the bug Something isn't working label Apr 26, 2024
@cottsay cottsay marked this pull request as ready for review April 26, 2024 14:46
Copy link
Contributor

@nuclearsandwich nuclearsandwich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think there's any value in unit-testing this with a bunch of mocks as a future enhancement or is this something that will only ever be proved out empirically?

@cottsay
Copy link
Member Author

cottsay commented May 31, 2024

Do you think there's any value in unit-testing this...?

I think we could test at least some of it. Much of the behavior we're working around is specific to easy-install and Windows, but I might be able to specifically test the mechanics in some tests.

I'll add something to this PR.

@cottsay
Copy link
Member Author

cottsay commented May 31, 2024

Do you think there's any value in unit-testing this...?

I'll add something to this PR.

Added a bunch of tests, and found a bug 🙃

@cottsay
Copy link
Member Author

cottsay commented Jun 3, 2024

I had this at 100% test coverage locally, but it doesn't appear that codecov is correctly merging the results and reports a single missed line that is covered only on the Windows builds. I confirmed that the data that codecov is getting indicates coverage of the line, but the dashboard still reports it missing.

Obnoxious but not a problem.

@cottsay cottsay merged commit 1aa845d into master Jun 3, 2024
36 checks passed
@delete-merged-branch delete-merged-branch bot deleted the cottsay/get_prog_name branch June 3, 2024 19:04
@cottsay cottsay added this to the 0.16.2 milestone Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

2 participants