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

Improve handling of missing interpreters during discovery #4218

Merged
merged 2 commits into from
Jun 10, 2024
Merged

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Jun 10, 2024

Cherry-picked from #4214

The first commit gets us some context on an IO error during queries:

Previously:

failed to canonicalize path `[VENV]/bin/python3`
    Caused by: No such file or directory (os error 2)

Now:

Failed to query Python interpreter
    Caused by: failed to canonicalize path `[VENV]/bin/python3`
    Caused by: No such file or directory (os error 2)

but really we shouldn't attempt to query a missing interpreter during discovery anyway, so we improve handling of that too.

@zanieb zanieb added the bug Something isn't working label Jun 10, 2024
Comment on lines -141 to -142
error: failed to canonicalize path `[VENV]/Scripts/python.exe`
Caused by: The system cannot find the path specified. (os error 3)
Copy link
Member Author

Choose a reason for hiding this comment

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

Oh hey this is way better, why would we fail here anyway?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I'm actually not sure.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well I know why we did but yeah there's no reason to

error: failed to canonicalize path `[VENV]/bin/python3`
Caused by: No such file or directory (os error 2)
error: No Python interpreters found in virtual environments
Copy link
Member Author

Choose a reason for hiding this comment

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

Now this isn't amazing, I guess with -v you'd see why your VIRTUAL_ENV was ignored. We could add some sort of hint in the future?

Copy link
Member Author

Choose a reason for hiding this comment

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

Since it literally doesn't exist this seems okay for now though

This feels kind of obvious, but the query code never checked if the requested interpreter exists so we would fail with an IO error and stop discovery which does not feel quite right
@zanieb zanieb merged commit 98d1ea6 into main Jun 10, 2024
47 checks passed
@zanieb zanieb deleted the zb/interp-io branch June 10, 2024 22:26
zanieb added a commit that referenced this pull request Jun 10, 2024
A merge kerfuffle from #4222  and #4218 

Now we fail because we genuinely can't find any interpreters since tests
contexts are isolated by default. I'll improve the error message and
maybe add another test case once `main` is fixed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants