Skip to content

Fix Issues Related to Path.parent with no Parent Directory#1434

Merged
hmstepanek merged 3 commits intomainfrom
fix-pathlib-issues
Jul 30, 2025
Merged

Fix Issues Related to Path.parent with no Parent Directory#1434
hmstepanek merged 3 commits intomainfrom
fix-pathlib-issues

Conversation

@TimPansino
Copy link
Copy Markdown
Contributor

@TimPansino TimPansino commented Jul 28, 2025

Overview

  • Fix instances of calling pathlib.Path.parent on a command line path, that may have no parent directory listed.
    • In these cases, this should search the PATH to find an executable of this name. Instead, the current change is interpreting no parent as ./, producing incorrect results.
    • Fix this by reverting to os.path.dirname for this specific use case, and ignore PTH linter.

Testing

  • Tested locally with newrelic-admin run-program flask run and newrelic-admin run-python main.py.
  • Can't find a decent way to test the sys.argv[0] being an executable with no path, but there's probably not a lot of risk. The comments indicate this is generally a Heroku only thing as well.

@TimPansino TimPansino requested a review from a team as a code owner July 28, 2025 19:43
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 28, 2025

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 6 0 0 0.68s
✅ MARKDOWN markdownlint 7 0 0 0 1.21s
✅ MARKDOWN markdown-link-check 7 0 0 25.14s
✅ PYTHON ruff 922 0 0 0 0.83s
✅ PYTHON ruff-format 922 0 0 0 0.36s
✅ YAML prettier 13 0 0 0 1.34s
✅ YAML v8r 13 0 0 6.0s
✅ YAML yamllint 13 0 0 0.63s

See detailed report in MegaLinter reports

MegaLinter is graciously provided by OX Security

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.34%. Comparing base (ac38993) to head (6d4818d).
⚠️ Report is 273 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1434      +/-   ##
==========================================
- Coverage   81.37%   81.34%   -0.03%     
==========================================
  Files         208      208              
  Lines       23563    23563              
  Branches     3716     3716              
==========================================
- Hits        19174    19168       -6     
- Misses       3132     3137       +5     
- Partials     1257     1258       +1     

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

@hmstepanek hmstepanek merged commit 4073419 into main Jul 30, 2025
60 checks passed
@hmstepanek hmstepanek deleted the fix-pathlib-issues branch July 30, 2025 04:08
@TimPansino TimPansino added this to the v10.16.0 milestone Aug 14, 2025
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.

3 participants