diff --git a/tests/capture/test_templates.py b/tests/capture/test_templates.py index afc66e6c5ab..14b15a46415 100644 --- a/tests/capture/test_templates.py +++ b/tests/capture/test_templates.py @@ -189,6 +189,13 @@ def enable_disable_plxpr(): ), ] +@pytest.fixture(scope="function", autouse=True) +def capture_warnings(recwarn): + yield + if len(recwarn) > 0: + for w in recwarn: + assert isinstance(w.message, qml.PennyLaneDeprecationWarning) + assert "BasisStatePreparation is deprecated" in str(w.message) @pytest.mark.parametrize("template, args, kwargs", unmodified_templates_cases) def test_unmodified_templates(template, args, kwargs):