-
-
Notifications
You must be signed in to change notification settings - Fork 668
feat(pypi): Use target_compatible_with in package aliases #3586
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| websockets ; python_full_version > "3.9.1" | ||
| websockets ; python_full_version > "3.11" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,7 @@ def _test_legacy_aliases(env): | |
| name = "foo", | ||
| actual = "repo", | ||
| native = struct( | ||
| alias = lambda name, actual: got.update({name: actual}), | ||
| alias = lambda name, actual, *, target_compatible_with = None: got.update({name: actual}), | ||
| ), | ||
| extra_aliases = ["my_special"], | ||
| ) | ||
|
|
@@ -69,7 +69,7 @@ def _test_config_setting_aliases(env): | |
| }, | ||
| extra_aliases = ["my_special"], | ||
| native = struct( | ||
| alias = lambda *, name, actual, visibility = None, tags = None: got.update({name: actual}), | ||
| alias = lambda *, name, actual, visibility = None, tags = None, target_compatible_with = None: got.update({name: actual}), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The tests should be updated to assert that You could modify the mock to store the # In _test_config_setting_aliases
got_compatible_with = {}
def mock_alias(*, name, actual, visibility = None, tags = None, target_compatible_with = None):
got.update({name: actual})
if target_compatible_with:
got_compatible_with[name] = target_compatible_with
# ... inside pkg_aliases call
native = struct(
alias = mock_alias
)
# ... after pkg_aliases call
# The result of selects.with_or is a dict for the select() statement.
# We can check its contents.
env.expect.that_dict(got_compatible_with["pkg"]).to_be({
"//:my_config_setting": [],
"//conditions:default": ["@platforms//:incompatible"],
})This would ensure the new logic is correctly tested across different scenarios (e.g., with single config settings, multiple, and with |
||
| ), | ||
| select = mock_select, | ||
| ) | ||
|
|
@@ -118,7 +118,7 @@ def _test_config_setting_aliases_many(env): | |
| }, | ||
| extra_aliases = ["my_special"], | ||
| native = struct( | ||
| alias = lambda *, name, actual, visibility = None, tags = None: got.update({name: actual}), | ||
| alias = lambda *, name, actual, visibility = None, tags = None, target_compatible_with = None: got.update({name: actual}), | ||
| config_setting = lambda **_: None, | ||
| ), | ||
| select = mock_select, | ||
|
|
@@ -170,7 +170,7 @@ def _test_multiplatform_whl_aliases(env): | |
| }, | ||
| extra_aliases = [], | ||
| native = struct( | ||
| alias = lambda *, name, actual, visibility = None, tags = None: got.update({name: actual}), | ||
| alias = lambda *, name, actual, visibility = None, tags = None, target_compatible_with = None: got.update({name: actual}), | ||
| ), | ||
| select = mock_select, | ||
| ) | ||
|
|
||
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.
For clarity and to follow Starlark's idiomatic style, it's better to compare the type string directly, i.e.,
type(actual) == "dict"instead oftype(actual) == type({}). This improves readability.