Skip to content

Commit ea332e9

Browse files
Bernd VerstCopilot
andcommitted
Skip the azuremanaged lazy-import test when the provider is absent
`test_importing_azuremanaged_client_does_not_import_worker` failed on all five Python versions in the `run-tests` job of `.github/workflows/durabletask.yml` with `ModuleNotFoundError: No module named 'durabletask.azuremanaged'`. The cause is a missing package, not lazy initialization. That job installs `requirements.txt`, `.[azure-blob-payloads]` and `aiohttp`, and never installs `durabletask-azuremanaged` -- so the test's subprocess could never import the provider there. It passes locally only because a development environment has both distributions installed. Guard the test with `pytest.importorskip("durabletask.azuremanaged")` so it skips cleanly where the provider is not installed. The assertion itself is unchanged, and the test still runs (and still has teeth) wherever the provider is present. Widening the workflow's install scope would be a broader change than this fix needs. Verified by blocking the provider behind a `sys.meta_path` hook to simulate the CI environment: 42 passed, 1 skipped without the provider, 43 passed with it. Also rewrap the CHANGELOG entry to the 100-character md013 limit using non-indented continuation lines. The file has 16 pre-existing md013 violations on `main`; this keeps that count unchanged rather than adding to it. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b6ec6f9e-f919-4874-b146-fa764b5c5617
1 parent 89f56c1 commit ea332e9

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@ ADDED
1313

1414
CHANGED
1515

16-
- Importing `durabletask` no longer eagerly imports the worker implementation and its dependencies (gRPC, protobuf, entities, serialization, OpenTelemetry). The public names re-exported from the package — `ActivityWorkItemFilter`, `ConcurrencyOptions`, `EntityWorkItemFilter`, `GrpcChannelOptions`, `GrpcRetryPolicyOptions`, `LargePayloadStorageOptions`, `OrchestrationWorkItemFilter`, `PayloadStore`, `VersioningOptions`, and `WorkItemFilters` — are now resolved on first use, so `import durabletask` is substantially faster and loads far fewer modules. This measurably reduces cold-start time for client-only applications, including those using `durabletask.azuremanaged`, which shares the same `durabletask` namespace. All existing import paths, `__all__`, `dir()`, and star-imports behave exactly as before.
16+
- Importing `durabletask` no longer eagerly imports the worker implementation and its
17+
dependencies (gRPC, protobuf, entities, serialization, OpenTelemetry). The public names
18+
re-exported from the package — `ActivityWorkItemFilter`, `ConcurrencyOptions`,
19+
`EntityWorkItemFilter`, `GrpcChannelOptions`, `GrpcRetryPolicyOptions`,
20+
`LargePayloadStorageOptions`, `OrchestrationWorkItemFilter`, `PayloadStore`,
21+
`VersioningOptions`, and `WorkItemFilters` — are now resolved on first use, so
22+
`import durabletask` is substantially faster and loads far fewer modules. This
23+
measurably reduces cold-start time for client-only applications, including those using
24+
`durabletask.azuremanaged`, which shares the same `durabletask` namespace. All existing
25+
import paths, `__all__`, `dir()`, and star-imports behave exactly as before.
1726
- **Breaking:** `FailureDetails.error_type` — and the `errorType` value sent over the wire — is now the fully-qualified type name (`module.ClassName`, e.g. `builtins.ValueError`, `durabletask.task.TaskFailedError`) instead of the bare class name, matching the .NET and Java SDKs. Code that compared `error_type` against a bare name (for example `== "ValueError"`) must be updated to the qualified name or, preferably, switched to `FailureDetails.is_caused_by()`. Because this value is persisted and crosses the orchestration boundary, failures produced by older workers may still carry a bare name; `is_caused_by()` accepts both.
1827

1928
## v1.8.0

tests/durabletask/test_lazy_exports.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ def test_importing_package_does_not_import_grpc_or_protobuf():
115115

116116
def test_importing_azuremanaged_client_does_not_import_worker():
117117
"""The Azure managed client shares the namespace but is client-only."""
118+
# The provider is distributed separately and is not installed in every CI
119+
# job that runs this suite, so skip rather than fail where it is absent.
120+
pytest.importorskip("durabletask.azuremanaged")
118121
result = _run_python(
119122
"import sys\n"
120123
"import durabletask.azuremanaged.client\n"

0 commit comments

Comments
 (0)