Skip to content

Commit 28c5c9f

Browse files
committed
test: isolate optional frontend dependency check
1 parent 5aa584b commit 28c5c9f

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

tests/test_frontends.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,20 @@ def test_explicit_optional_frontend_for_qiskit_raises_mismatch() -> None:
7272
detect_frontend(_qiskit_bell(), frontend="braket")
7373

7474

75-
def test_explicit_optional_frontend_missing_dependency_has_install_hint() -> None:
75+
def test_explicit_optional_frontend_missing_dependency_has_install_hint(
76+
monkeypatch: pytest.MonkeyPatch,
77+
) -> None:
7678
class UnknownCircuit:
7779
pass
7880

81+
def missing_braket(_frontend: Frontend) -> type:
82+
raise frontends.FrontendDependencyError(
83+
"frontend='braket' requires optional Braket support.\n"
84+
'Install with: pip install "emrg[braket]"'
85+
)
86+
87+
monkeypatch.setattr(frontends, "_load_frontend_type", missing_braket)
88+
7989
with pytest.raises(
8090
ImportError,
8191
match=(

0 commit comments

Comments
 (0)