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

Additional builtin testing and fixes #85

Merged
merged 3 commits into from
Apr 28, 2023

Conversation

jgberry
Copy link
Collaborator

@jgberry jgberry commented Apr 26, 2023

Adds additional builtin tests and provides a simpler, albeit dumber, implementation of #82.

In addition to supporting the __path__ builtin, as done in #82, the tests introduced by this PR showed a lack of support for the following builtins:

  • __annotations__
  • __builtins__
  • __cached__

Support for these builtins has also been added as part of this PR.

Rationale for this approach over the approach in #82:
The _builtins.py file already contains an extraordinary number of builtins which are conditionally defined. For instance, WindowsError is only defined on Windows systems, __annotations__ is only defined in the __main__ scope, __file__ may or may not be defined depending on if the source is defined in a file or not, etc... Since may of these conditions are complex and possibly not even know to us since they depend on the runtime, we are simply assuming they exist. I see no reason to treat __path__ any different.

@jgberry jgberry requested a review from bwhmather April 26, 2023 21:20

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 4813503185

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 98.225%

Totals Coverage Status
Change from base Build 4802506014: 0.0%
Covered Lines: 1273
Relevant Lines: 1296

💛 - Coveralls

@jgberry
Copy link
Collaborator Author

jgberry commented Apr 27, 2023

By the way, sorry if I stole your thunder on this @cgahr. I was originally going to just include the additional tests in this PR to address @bwhmather's concern in #82 of our current failure to detect these missing builtins as part of our test suite, but then this solution presented itself to me 🤷‍♂️

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@@ -0,0 +1 @@
print(dir())
Copy link
Owner

Choose a reason for hiding this comment

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

This one I particularly like.

@jgberry jgberry merged commit 73322e8 into bwhmather:master Apr 28, 2023
@jgberry jgberry deleted the jgberry/more-builtins branch April 28, 2023 06:05
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.

Bug: unresolved dependency '__path__' in __init__.py
3 participants