Skip to content

Move WinML EP init mock to root conftest for global coverage#24

Merged
timenick merged 1 commit into
mainfrom
zhiwang/mock-winml-init
Mar 31, 2026
Merged

Move WinML EP init mock to root conftest for global coverage#24
timenick merged 1 commit into
mainfrom
zhiwang/mock-winml-init

Conversation

@timenick
Copy link
Copy Markdown
Collaborator

Summary

  • Move autouse fixture _skip_winml_ep_init from tests/session/conftest.py to root tests/conftest.py
  • winml.modelkit.models.winml.base imports WinMLSession at module level, which triggers WinMLEPRegistry._discover_eps() → WinML SDK runtime initialization on any winml.modelkit import
  • This causes ALL test groups (unit, models, commands, etc.) to potentially hang on CI environments without the SDK installed — not just tests/session
  • The fixture mocks WinMLSession._init_winml_eps_once for non-e2e tests; e2e tests (marked @pytest.mark.e2e) bypass the mock and use real SDK initialization

Import chain

winml.modelkit.__init__
  → winml.modelkit.models
    → winml.modelkit.models.winml
      → winml.modelkit.models.winml.base
        → winml.modelkit.session.session (WinMLSession)
          → winml.modelkit.session.ep_registry (WinMLEPRegistry)

winml.modelkit.models.winml.base imports WinMLSession at module
level, triggering WinML SDK initialization on any winml.modelkit
import. This affects ALL test groups, not just tests/session.

Move the autouse fixture from tests/session/conftest.py to the
root tests/conftest.py so all test groups are protected from
SDK initialization hangs on CI.
@timenick timenick requested a review from a team as a code owner March 30, 2026 09:50
@timenick timenick merged commit 2e5af47 into main Mar 31, 2026
9 checks passed
@timenick timenick deleted the zhiwang/mock-winml-init branch March 31, 2026 02:02
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.

2 participants