Skip to content

refactor: simplify find_executable using shutil.which - #1329

Open
Dor-bl wants to merge 1 commit into
appium:masterfrom
Dor-bl:refactor/simplify-find-executable-14895471279632432151
Open

Dor-bl wants to merge 1 commit into
appium:masterfrom
Dor-bl:refactor/simplify-find-executable-14895471279632432151

Conversation

@Dor-bl

@Dor-bl Dor-bl commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Changes

appium/webdriver/appium_service.py: replace the hand-rolled PATH search in find_executable with shutil.which.
test/unit/webdriver/appium_service_test.py: add a unit test for it.

Testing

pytest test/unit/webdriver/appium_service_test.py: 5 passed.

@Dor-bl
Dor-bl force-pushed the refactor/simplify-find-executable-14895471279632432151 branch from bcdd669 to e31fd1c Compare October 24, 2026 19:48
@mykola-mokhnach

Copy link
Copy Markdown
Contributor

find_executable is now a one-line wrapper over shutil.which, so get_node() and get_npm() could call shutil.which directly. That would let us drop the wrapper, along with the find_executable asserts around line 333. It's optional, since keeping the wrapper is also fine. On Windows, get_npm() can also pass plain 'npm' instead of 'npm.cmd', because which resolves it via PATHEXT.

Replace manual PATH lookup logic in find_executable with direct shutil.which calls in get_node and get_npm, and add unit test coverage.
@Dor-bl
Dor-bl force-pushed the refactor/simplify-find-executable-14895471279632432151 branch from e31fd1c to 490c954 Compare October 24, 2026 19:58
@Dor-bl

Dor-bl commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor Author

Updated: dropped find_executable and called shutil.which('node') / shutil.which('npm') directly in get_node() and get_npm().

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