Python: Add example of top-level module shadowing stdlib (v2) #4693
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a test-case to show a specific kind of bad module resolution that happens when using
codeql database create
, since a locally defined module doesn't take precedence in module resolution. It turned out that we don't invoke the extractor in the same way when running our qltests, and that the way qltests behaves is more correct (compared with Python interpreter). Obvious fixes didn't work:sys.path[0]
.codeql database create
: I naively attempted this, but it turned out to be a much bigger tasks than I am ready to take on right now.So instead I changed the test manually to simulate what the result of
codeql database create
is (and even that was tricky). Reboot of #4655, but a bit more clear now that I've figured out what to do.Kind of a bonus test hiding within all of this is the
unique_name
, which just shows that we're not able to resolve it properly when it resides in non-package directory... but it's not the essential part I'm trying to tests here, I think I just included it as a safety check.