Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -543,12 +543,14 @@ jobs:
.\eng\release\python\test_generated_python_long_paths.ps1 `
-Python .\bindings\py\.venv\Scripts\python.exe `
-Codegen $env:DYNWINRT_CODEGEN
- name: Test generated implementation symbol identities
- name: Test generated implementation and overload identities
shell: pwsh
run: |
$env:DYNWINRT_TEST_PYTHON = (Resolve-Path .\bindings\py\.venv\Scripts\python.exe).Path
$env:DYNWINRT_REQUIRE_IMPLEMENTATION_RUNTIME = '1'
cargo test -p dynwinrt-codegen --test implementation_naming_test
cargo test -p dynwinrt-codegen `
--test implementation_naming_test `
--test python_overload_legacy_compat_test
- name: Run E2E tests
run: .\tests\e2e\e2e_test.ps1 -SkipBuild -Codegen $env:DYNWINRT_CODEGEN
# This optional-SDK behavioral smoke is separate from generated coverage
Expand Down
8 changes: 8 additions & 0 deletions bindings/py/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ unsubscribe function. `once_*` subscribes for at most one callback invocation.

WinRT flags enums are projected as `enum.IntFlag`. Overloaded methods share one
Python name with runtime type/arity dispatch and `typing.overload` declarations.
That name is the documented (CLR) method name, so `StorageFile.CopyAsync`
overloads are all `copy_async(...)`. The unique `[Overload]` ABI names emitted by
earlier releases, such as `copy_overload` or `launch_file_with_options_async`,
remain available as compatibility aliases that keep calling the same overload.
A method keeps its earlier name when the documented name would clash with
another member, such as a property or the generated `close()`. Interface
parameters of overloads accept any object that implements the interface, such
as a runtime class instance or a `DynWinRTValue`.
Activatable runtime classes use normal constructors, for example
`Uri("https://example.com")`. Constructor overloads come only from WinMD
`ActivatableAttribute` and public `ComposableAttribute` declarations. Classes
Expand Down
4 changes: 3 additions & 1 deletion eng/ci/test_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,9 @@ def test_current_run_artifacts_and_no_consumer_rebuilds(self):
"npm run test:borrowed-copy"):
self.assertNotIn(forbidden, commands)
runtime = "\n".join(step.get("run", "") for step in JOBS["e2e-runtime"]["steps"])
self.assertIn("cargo test -p dynwinrt-codegen --test implementation_naming_test", runtime)
self.assertIn("cargo test -p dynwinrt-codegen `", runtime)
self.assertIn("--test implementation_naming_test", runtime)
self.assertIn("--test python_overload_legacy_compat_test", runtime)

def test_release_notes_validated_in_lightweight_lane(self):
steps = [
Expand Down
44 changes: 40 additions & 4 deletions tests/e2e/e2e_specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@
"args": ["en-US"]
},
"checks": [
{ "kind": "property_equals", "member": "language_tag", "expected": "en-US" }
{ "kind": "property_equals", "member": "language_tag", "expected": "en-US" },
{ "kind": "language_comprehensive", "member": "self", "langs": ["py"] }
]
},
{
Expand Down Expand Up @@ -326,7 +327,8 @@
"checks": [
{ "kind": "sequence_protocol", "member": "languages", "expected_size": 1 },
{ "kind": "datetime_roundtrip", "member": "date_time", "langs": ["py"] },
{ "kind": "calendar_comprehensive", "member": "self" }
{ "kind": "calendar_comprehensive", "member": "self" },
{ "kind": "calendar_documented_overloads", "member": "month_as_string", "langs": ["py"] }
]
},
{
Expand Down Expand Up @@ -429,7 +431,9 @@
"instantiate": { "kind": "none" },
"checks": [
{ "kind": "async_memory_roundtrip", "member": "roundtrip", "write_value": 42 },
{ "kind": "data_stream_scalar_roundtrip", "member": "roundtrip", "langs": ["py"] }
{ "kind": "data_stream_scalar_roundtrip", "member": "roundtrip", "langs": ["py"] },
{ "kind": "data_stream_constructor_roundtrip", "member": "__init__", "langs": ["py"] },
{ "kind": "can_cast_non_object", "member": "_dynwinrt_can_cast", "langs": ["py"] }
]
},
{
Expand All @@ -452,6 +456,37 @@
{ "kind": "storage_query_temp_folder", "member": "query" }
]
},
{
"id": "python_storage_file_copy_overloads",
"namespace": "Windows.Storage",
"class": "StorageFile",
"langs": ["py"],
"instantiate": { "kind": "none" },
"checks": [
{ "kind": "storage_file_copy_overloads", "member": "copy_async" }
]
},
{
"id": "python_stream_copy_overloads",
"namespace": "Windows.Storage.Streams",
"class": "RandomAccessStream",
"langs": ["py"],
"extra_classes": ["InMemoryRandomAccessStream", "DataWriter", "DataReader"],
"instantiate": { "kind": "none" },
"checks": [
{ "kind": "random_access_stream_copy_overloads", "member": "copy_async" }
]
},
{
"id": "python_decimal_formatter_overloads",
"namespace": "Windows.Globalization.NumberFormatting",
"class": "DecimalFormatter",
"langs": ["py"],
"instantiate": { "kind": "none" },
"checks": [
{ "kind": "decimal_formatter_overloads", "member": "format" }
]
},
{
"id": "issue_69_device_information_async_collection",
"namespace": "Windows.Devices.Enumeration",
Expand Down Expand Up @@ -569,7 +604,8 @@
"args": ["<root><child /></root>"],
"property_path": ["document_element", "tag_name"],
"expected": "root"
}
},
{ "kind": "xml_document_load_overloads", "member": "load_xml", "langs": ["py"] }
]
},
{
Expand Down
8 changes: 8 additions & 0 deletions tests/e2e/e2e_specs.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"kind": {
"enum": [
"property_equals",
"language_comprehensive",
"property_exists",
"property_in_range",
"method_equals",
Expand Down Expand Up @@ -97,8 +98,15 @@
"constructor_overload_dispatch",
"value_set_mapping",
"data_stream_scalar_roundtrip",
"data_stream_constructor_roundtrip",
"can_cast_non_object",
"calendar_comprehensive",
"storage_query_temp_folder",
"storage_file_copy_overloads",
"random_access_stream_copy_overloads",
"decimal_formatter_overloads",
"xml_document_load_overloads",
"calendar_documented_overloads",
"value_set_event_lifecycle",
"nested_struct_runtime",
"generated_helper_matrix"
Expand Down
Loading
Loading