-
-
Notifications
You must be signed in to change notification settings - Fork 665
[WIP] [Call-by-name] migrate src/python/pants/engine/internals/build_files.py
#22353
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
base: main
Are you sure you want to change the base?
Conversation
Note: This PR is stacked on top of #22352 which refactors environments-related code to avoid an import cycle which this PR would encounter otherwise. |
eab71af
to
73bfd2e
Compare
@@ -66,6 +66,23 @@ | |||
|
|||
def test_parse_address_family_empty() -> None: | |||
"""Test that parsing an empty BUILD file results in an empty AddressFamily.""" | |||
|
|||
def mock_get_digest_contents(digest) -> DigestContents: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mock fails with:
E TypeError: test_extend_synthetic_target.<locals>.mock_get_digest_contents() missing 1 required positional argument: 'digest'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(As does its counterpart in the other test.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benjyw: Does run_rule_with_mocks
properly handle a rule that calls itself recursively?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue goes away if I move the heterogeneous await
's inside a concurrently
out of the concurrently
and have them be standalone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The local frame for the Coroutine
shows the args
parameters to be empty but the __implicitly
value to have the parameter:
ipdb> res.cr_frame.f_locals
{'__implicitly': (AddressFamilyDir(path='/dev'),), 'args': (), 'kwargs': {}, 'output_type': <class 'pants.engine.internals.build_files.OptionalAddressFamily'>, 'rule_id': 'pants.engine.internals.build_files.parse_address_family'}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did some work in RuleRunner
to extract the args from __implicitly
which seemed to have helped but still need a way to deal with the dict syntax and matching values in the dict to the mock functions parameters.
src/python/pants/engine/internals/build_files.py
src/python/pants/engine/internals/build_files.py
Was looking at potential rust port opportunities and got derailed and changed this. Side note: porting target adapters and build file stuff seems like a good candidate to use rust and not cache every intermediate. Duplicates #22353, sorry!
Refactor
src/python/pants/engine/internals/build_files.py
to call-by-name syntax.