Skip to content
Merged
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
21 changes: 21 additions & 0 deletions tests/e2e/require_ep.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,24 @@ def require_ep(ep: str) -> str:
pytest.skip(f"EP not available on this host: {provider}")

return provider


def require_not_ep(ep: str) -> None:
"""Skip the current test unless the requested EP is NOT available.

Mirror of :func:`require_ep` for tests that exercise the
"EP not registered" rejection path (e.g. ``winml compile --ep qnn``
on a host without QNN).
"""
from winml.modelkit.session import WinMLEPRegistry
from winml.modelkit.utils import normalize_ep_name

provider = normalize_ep_name(ep)
if provider is None:
pytest.skip(f"Unknown EP: {ep!r}")

if provider == "CPUExecutionProvider":
pytest.skip("CPU is always available on this host")

if WinMLEPRegistry.get_instance().is_ep_available(provider):
pytest.skip(f"EP is available on this host (test requires it absent): {provider}")
Loading
Loading