Repository: Qiskit/qiskit (python)

Issue:
Deprecate legacy pulse builder command.
### What should we add?

Pulse builder still supports following commands that inject circuit gate operation into the pulse context: 
- `qiskit.pulse.builder.call_gate`
- `qiskit.pulse.builder.cx`
- `qiskit.pulse.builder.u1`
- `qiskit.pulse.builder.u2`
- `qiskit.pulse.builder.u3`
- `qiskit.pulse.builder.x`

These are legacy workflow which we implemented before the pulse gate feature. These command introduce weird cyclic dependency between circuit and pulse program, and must be deprecated before the next release. 

In addition, following commands are nice to be deprecated as well.

- `qiskit.pulse.builder.active_transpiler_settings`
- `qiskit.pulse.builder.active_circuit_scheduler_settings`
- `qiskit.pulse.builder.transpiler_settings`

### Background
Note that the standard program representation in Qiskit is now `QuantumCircuit`, and pulse programs exist as a microcode (calibration) of the circuit. The pulse builder is a tool to define such microprograms, and circuit -> pulse conversion must be explicitly done with the circuit scheduler. Injecting circuit instruction in pulse program is indeed an opposite workflow.

Pull request:
deprecate legacy pulse builder command
<!--
⚠️ If you do not respect this template, your pull request will be closed.
⚠️ Your pull request title should be short detailed and understandable for all.
⚠️ Also, please add a release note file using reno if the change needs to be
  documented in the release notes.
⚠️ If your pull request fixes an open issue, please link to the issue.

- [ ] I have added the tests to cover my changes.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the CONTRIBUTING document.
-->

### Summary
This addresses issue #11152 

This PR 

Deprecates
- `qiskit.pulse.builder.call_gate`
- `qiskit.pulse.builder.cx`
- `qiskit.pulse.builder.u1`
- `qiskit.pulse.builder.u2`
- `qiskit.pulse.builder.u3`
- `qiskit.pulse.builder.x`

- `qiskit.pulse.builder.active_transpiler_settings`
- `qiskit.pulse.builder.active_circuit_scheduler_settings`
-  `qiskit.pulse.builder.transpiler_settings`
- arguments `default_transpiler_settings` ,
                and `default_circuit_scheduler_settings` of 
               `qiskit.pulse.builder.build` function.
- `QuantumCircuit` type of the `target` argument in `qiskit.pulse.builder.call` function

Modifies:
- Module doc of `qiskit.pulse.builder.py` (example code with circuit elements)
- The example code 3 of function doc for `qiskit.pulse.builder.call`

and, modifies related tests in
- test/python/pulse/test_builder.py
- test/python/pulse/test_block.py
- test/python/pulse/test_builder_v2.py
- test/python/transpiler/test_calibrationbuilder.py


### Details and comments
Refer to Issue: https://github.com/Qiskit/qiskit/issues/11152
fixes #11152 



Patch:
diff --git a/qiskit/pulse/builder.py b/qiskit/pulse/builder.py
index 913384a56..5ba542f24 100644
--- a/qiskit/pulse/builder.py
+++ b/qiskit/pulse/builder.py
@@ -116,6 +116,9 @@ automatically lowered to be run as a pulse program:
 
    decoupled_bell_prep_and_measure.draw()
 
+.. warning::
+    Calling gates directly within the pulse builder namespace is deprecated as of qiskit 0.46.0.
+
 With the pulse builder we are able to blend programming on qubits and channels.
 While the pulse schedule is based on instructions that operate on
 channels, the pulse builder automatically handles the mapping from qubits to
@@ -228,6 +231,9 @@ In the example below we demonstrate some more features of the pulse builder:
            with pulse.phase_offset(math.pi, d0):
                pulse.play(gaussian_pulse, d0)
 
+.. warning::
+    Calling gates directly within the pulse builder namespace is deprecated as of qiskit 0.46.0.
+
 The above is just a small taste of what is possible with the builder. See the rest of the module
 documentation for more information on its capabilities.
 
@@ -366,36 +372,6 @@ Macros help you add more complex functionality to your pulse program.
 .. autofunction:: delay_qubits
 
 
-Circuit Gates
-=============
-
-To use circuit level gates within your pulse program call a circuit
-with :func:`call`.
-
-.. warning::
-    These will be removed in future versions with the release of a circuit
-    builder interface in which it will be possible to calibrate a gate in
-    terms of pulses and use that gate in a circuit.
-
-.. code-block::
-
-    import math
-
-    from qiskit import pulse
-    from qiskit.providers.fake_provider import FakeArmonk
-
-    backend = FakeArmonk()
-
-    with pulse.build(backend) as u3_sched:
-        pulse.u3(math.pi, 0, math.pi, 0)
-
-.. autofunction:: cx
-.. autofunction:: u1
-.. autofunction:: u2
-.. autofunction:: u3
-.. autofunction:: x
-
-
 Utilities
 =========
 
@@ -477,7 +453,7 @@ from qiskit.providers.backend import BackendV2
 from qiskit.pulse.instructions import directives
 from qiskit.pulse.schedule import Schedule, ScheduleBlock
 from qiskit.pulse.transforms.alignments import AlignmentKind
-
+from qiskit.utils.deprecation import deprecate_func, deprecate_arg
 
 #: contextvars.ContextVar[BuilderContext]: active builder
 BUILDER_CONTEXTVAR = contextvars.ContextVar("backend")
@@ -942,6 +918,20 @@ class _PulseBuilder:
         return self.backend.configuration().dt
 
 
+@deprecate_arg(
+    name="default_transpiler_settings",
+    since="0.46.0",
+    additional_msg="setting parameter ``default_transpiler_settings`` in build() was used for gate "
+    "operations, which are deprecated. pulse schedules should only be used for gate calibrations "
+    "as part of a quantum circuit, and not vice versa",
+)
+@deprecate_arg(
+    name="default_circuit_scheduler_settings",
+    since="0.46.0",
+    additional_msg="setting parameter ``default_circuit_scheduler_settings`` in build() was used "
+    "for gate operations, which are deprecated. pulse schedules should only be used for gate "
+    "calibrations as part of a quantum circuit, and not vice versa",
+)
 def build(
     backend=None,
     schedule: Optional[ScheduleBlock] = None,
@@ -1197,6 +1187,12 @@ def _qubits_to_channels(*channels_or_qubits: Union[int, chans.Channel]) -> Set[c
     return channels
 
 
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="This function was used for gate operations, which are deprecated. pulse schedules "
+    "should only be used for gate calibrations as part of a quantum circuit, "
+    "and not vice versa",
+)
 def active_transpiler_settings() -> Dict[str, Any]:
     """Return the current active builder context's transpiler settings.
 
@@ -1223,6 +1219,12 @@ def active_transpiler_settings() -> Dict[str, Any]:
     return dict(_active_builder().transpiler_settings)
 
 
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="This function was used for gate operations, which are deprecated. pulse schedules "
+    "should only be used for gate calibrations as part of a quantum circuit, "
+    "and not vice versa",
+)
 def active_circuit_scheduler_settings() -> Dict[str, Any]:
     """Return the current active builder context's circuit scheduler settings.
 
@@ -1507,6 +1509,12 @@ def general_transforms(alignment_context: AlignmentKind) -> ContextManager[None]
         builder.append_subroutine(current)
 
 
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="This function was used for gate operations, which are deprecated. pulse schedules "
+    "should only be used for gate calibrations as part of a quantum circuit, "
+    "and not vice versa",
+)
 @contextmanager
 def transpiler_settings(**settings) -> ContextManager[None]:
     """Set the currently active transpiler settings for this context.
@@ -1540,6 +1548,12 @@ def transpiler_settings(**settings) -> ContextManager[None]:
 
 
 @contextmanager
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="This function was used for gate operations, which are deprecated. pulse schedules "
+    "should only be used for gate calibrations as part of a quantum circuit, "
+    "and not vice versa",
+)
 def circuit_scheduler_settings(**settings) -> ContextManager[None]:
     """Set the currently active circuit scheduler settings for this context.
 
@@ -1992,6 +2006,15 @@ def snapshot(label: str, snapshot_type: str = "statevector"):
     append_instruction(instructions.Snapshot(label, snapshot_type=snapshot_type))
 
 
+@deprecate_arg(
+    name="target",
+    since="0.46.0",
+    additional_msg="ScheduleBlock should only be used for gate calibrations in a quantum circuit. "
+    "Thus, the called quantum circuit should be added to the main circuit instead of to the "
+    "ScheduleBlock.",
+    deprecation_description="QuantumCircuit type for the argument target",
+    predicate=lambda qc_arg: isinstance(qc_arg, circuit.QuantumCircuit),
+)
 def call(
     target: Optional[Union[circuit.QuantumCircuit, Schedule, ScheduleBlock]],
     name: Optional[str] = None,
@@ -2167,52 +2190,12 @@ def call(
         The parameter assignment mechanism is available also for schedules.
         However, the called schedule is not treated as a reference.
 
-        3. Calling a quantum circuit
-
-        .. code-block::
-
-            backend = FakeBogotaV2()
-
-            qc = circuit.QuantumCircuit(1)
-            qc.x(0)
-
-            with pulse.build(backend) as pulse_prog:
-                pulse.call(qc)
-
-            print(pulse_prog)
-
-        .. parsed-literal::
-
-            ScheduleBlock(
-                Call(
-                    Schedule(
-                        (
-                            0,
-                            Play(
-                                Drag(
-                                    duration=160,
-                                    amp=(0.18989731546729305+0j),
-                                    sigma=40,
-                                    beta=-1.201258305015517,
-                                    name='drag_86a8'
-                                ),
-                                DriveChannel(0),
-                                name='drag_86a8'
-                            )
-                        ),
-                        name="circuit-87"
-                    ),
-                    name='circuit-87'
-                ),
-                name="block7",
-                transform=AlignLeft()
-            )
-
         .. warning::
 
-            Calling a circuit from a schedule is not encouraged. Currently, the Qiskit execution model
-            is migrating toward the pulse gate model, where schedules are attached to
-            circuits through the :meth:`.QuantumCircuit.add_calibration` method.
+            Calling a circuit from a schedule is deprecated as of qiskit 0.46.0. The Qiskit execution
+            model has migrating toward the pulse gate model, where schedules are attached to circuits
+            through the :meth:`.QuantumCircuit.add_calibration` method. Thus, instead of calling a
+            circuit into the schedule, it should instead be added to the main circuit.
 
     Args:
         target: Target circuit or pulse schedule to call.
@@ -2549,14 +2532,15 @@ def delay_qubits(duration: int, *qubits: Union[int, Iterable[int]]):
 
 
 # Gate instructions
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="Gate should be used with QuantumCircuit instead,"
+    " and attach the rest of non-circuit part(s) as pulse gate(s).",
+)
 def call_gate(gate: circuit.Gate, qubits: Tuple[int, ...], lazy: bool = True):
     """Call a gate and lazily schedule it to its corresponding
     pulse instruction.
 
-    .. note::
-        Calling gates directly within the pulse builder namespace will be
-        deprecated in the future in favor of tight integration with a circuit
-        builder interface which is under development.
 
     Examples:
 
@@ -2602,14 +2586,15 @@ def call_gate(gate: circuit.Gate, qubits: Tuple[int, ...], lazy: bool = True):
     _active_builder().call_gate(gate, qubits, lazy=lazy)
 
 
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="CXGate should be used with QuantumCircuit instead,"
+    " and attach the rest of non-circuit part(s) as pulse gate(s).",
+)
 def cx(control: int, target: int):  # pylint: disable=invalid-name
     """Call a :class:`~qiskit.circuit.library.standard_gates.CXGate` on the
     input physical qubits.
 
-    .. note::
-        Calling gates directly within the pulse builder namespace will be
-        deprecated in the future in favor of tight integration with a circuit
-        builder interface which is under development.
 
     Examples:
 
@@ -2627,14 +2612,15 @@ def cx(control: int, target: int):  # pylint: disable=invalid-name
     call_gate(gates.CXGate(), (control, target))
 
 
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="U1Gate should be used with QuantumCircuit instead,"
+    " and attach the rest of non-circuit part(s) as pulse gate(s).",
+)
 def u1(theta: float, qubit: int):  # pylint: disable=invalid-name
     """Call a :class:`~qiskit.circuit.library.standard_gates.U1Gate` on the
     input physical qubit.
 
-    .. note::
-        Calling gates directly within the pulse builder namespace will be
-        deprecated in the future in favor of tight integration with a circuit
-        builder interface which is under development.
 
     Examples:
 
@@ -2654,14 +2640,15 @@ def u1(theta: float, qubit: int):  # pylint: disable=invalid-name
     call_gate(gates.U1Gate(theta), qubit)
 
 
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="U2Gate should be used with QuantumCircuit instead,"
+    " and attach the rest of non-circuit part(s) as pulse gate(s).",
+)
 def u2(phi: float, lam: float, qubit: int):  # pylint: disable=invalid-name
     """Call a :class:`~qiskit.circuit.library.standard_gates.U2Gate` on the
     input physical qubit.
 
-    .. note::
-        Calling gates directly within the pulse builder namespace will be
-        deprecated in the future in favor of tight integration with a circuit
-        builder interface which is under development.
 
     Examples:
 
@@ -2681,14 +2668,15 @@ def u2(phi: float, lam: float, qubit: int):  # pylint: disable=invalid-name
     call_gate(gates.U2Gate(phi, lam), qubit)
 
 
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="U3Gate should be used with QuantumCircuit instead,"
+    " and attach the rest of non-circuit part(s) as pulse gate(s).",
+)
 def u3(theta: float, phi: float, lam: float, qubit: int):  # pylint: disable=invalid-name
     """Call a :class:`~qiskit.circuit.library.standard_gates.U3Gate` on the
     input physical qubit.
 
-    .. note::
-        Calling gates directly within the pulse builder namespace will be
-        deprecated in the future in favor of tight integration with a circuit
-        builder interface which is under development.
 
     Examples:
 
@@ -2708,14 +2696,15 @@ def u3(theta: float, phi: float, lam: float, qubit: int):  # pylint: disable=inv
     call_gate(gates.U3Gate(theta, phi, lam), qubit)
 
 
+@deprecate_func(
+    since="0.46.0",
+    additional_msg="XGate should be used with QuantumCircuit instead,"
+    " and attach the rest of non-circuit part(s) as pulse gate(s).",
+)
 def x(qubit: int):
     """Call a :class:`~qiskit.circuit.library.standard_gates.XGate` on the
     input physical qubit.
 
-    .. note::
-        Calling gates directly within the pulse builder namespace will be
-        deprecated in the future in favor of tight integration with a circuit
-        builder interface which is under development.
 
     Examples:
 
diff --git a/releasenotes/notes/Deprecate_legacy_pulse_builder_command-2a3c8dcbceae624e.yaml b/releasenotes/notes/Deprecate_legacy_pulse_builder_command-2a3c8dcbceae624e.yaml
new file mode 100644
index 000000000..01e86fabd
--- /dev/null
+++ b/releasenotes/notes/Deprecate_legacy_pulse_builder_command-2a3c8dcbceae624e.yaml
@@ -0,0 +1,65 @@
+---
+deprecations:
+  - |
+    Deprecated injecting circuit gate operation into the pulse builder context.
+    
+    Deprecated
+    :func:`~qiskit.pulse.builder.call_gate`,
+    :func:`~qiskit.pulse.builder.cx`,
+    :func:`~qiskit.pulse.builder.u1`,
+    :func:`~qiskit.pulse.builder.u2`,
+    :func:`~qiskit.pulse.builder.u3`,
+    :func:`~qiskit.pulse.builder.x`
+
+    If you still wish to inject backend calibrated schedules,
+    you can use following pattern instead of calling gate commands.
+
+    .. code-block:: python
+
+      from qiskit.providers.fake_provider import FakePerth
+      from qiskit import pulse
+
+      backend = FakePerth()
+      sched = backend.target['x'][(qubit,)].calibration
+
+      with pulse.build() as only_pulse_scheds:
+        pulse.call(sched)
+
+    Similarly, :class:`.QuantumCircuit` can be injected in the builder context
+    by manually transpiling and scheduling the object.
+
+    .. code-block:: python
+
+      from math import pi
+      from qiskit.compiler import schedule, transpile
+      qc = QuatumCircuit(2)
+      qc.rz(pi/2, 0)
+      qc.sx(0)
+      qc.rz(pi/2, 0)
+      qc.cx(0, 1)
+
+      qc_t = transpile(qc, backend)
+      sched = schedule(qc_t, backend)
+      with pulse.build() as only_pulse_scheds:
+          pulse.call(sched)
+
+    In any case we now recommend to write a minimum pulse program
+    with the builder and attach it to :class:`.QuantumCircuit` via the
+    :meth:`.QuantumCircuit.add_calibration` method as a microcode of a
+    gate instruction, rather than writing the entire program with the pulse model.
+    
+    Deprecated
+    :func:`~qiskit.pulse.builder.active_transpiler_settings`
+    :func:`~qiskit.pulse.builder.active_circuit_scheduler_settings`
+    :func:`~qiskit.pulse.builder.transpiler_settings`
+    :func:`~qiskit.pulse.builder.circuit_scheduler_settings`
+
+    Modified module doc of :mod:`qiskit.pulse.builder` related with example
+    code with circuit elements.
+
+    Deprecated arguments :code:`default_transpiler_settings`, :code:`default_circuit_scheduler_settings`
+    in :func:`~qiskit.pulse.builder.build`
+
+    Deprecated argument of :class:`.QuantumCircuit` type in :func:`~qiskit.pulse.builder.call`
+    
+


Test patch:
diff --git a/test/python/pulse/test_block.py b/test/python/pulse/test_block.py
index 37f94ff7f..16cec7099 100644
--- a/test/python/pulse/test_block.py
+++ b/test/python/pulse/test_block.py
@@ -777,7 +777,8 @@ class TestBlockFilter(BaseTestBlock):
                 pulse.delay(5, self.d0)
 
                 with pulse.build(self.backend) as cx_blk:
-                    pulse.cx(0, 1)
+                    with self.assertWarns(DeprecationWarning):
+                        pulse.cx(0, 1)
 
                 pulse.call(cx_blk)
 
diff --git a/test/python/pulse/test_builder.py b/test/python/pulse/test_builder.py
index d02bafa88..5f83f2e2d 100644
--- a/test/python/pulse/test_builder.py
+++ b/test/python/pulse/test_builder.py
@@ -194,13 +194,15 @@ class TestContexts(TestBuilder):
         twice_cx_qc.cx(0, 1)
 
         with pulse.build(self.backend) as schedule:
-            with pulse.transpiler_settings(optimization_level=0):
-                builder.call(twice_cx_qc)
+            with self.assertWarns(DeprecationWarning):
+                with pulse.transpiler_settings(optimization_level=0):
+                    builder.call(twice_cx_qc)
         self.assertNotEqual(len(schedule.instructions), 0)
 
         with pulse.build(self.backend) as schedule:
-            with pulse.transpiler_settings(optimization_level=3):
-                builder.call(twice_cx_qc)
+            with self.assertWarns(DeprecationWarning):
+                with pulse.transpiler_settings(optimization_level=3):
+                    builder.call(twice_cx_qc)
         self.assertEqual(len(schedule.instructions), 0)
 
     def test_scheduler_settings(self):
@@ -219,9 +221,10 @@ class TestContexts(TestBuilder):
         x_qc.x(0)
 
         with pulse.build(backend=self.backend) as schedule:
-            with pulse.transpiler_settings(basis_gates=["x"]):
-                with pulse.circuit_scheduler_settings(inst_map=inst_map):
-                    builder.call(x_qc)
+            with self.assertWarns(DeprecationWarning):
+                with pulse.transpiler_settings(basis_gates=["x"]):
+                    with pulse.circuit_scheduler_settings(inst_map=inst_map):
+                        builder.call(x_qc)
 
         self.assertScheduleEqual(schedule, ref_sched)
 
@@ -606,16 +609,18 @@ class TestUtilities(TestBuilder):
     def test_active_transpiler_settings(self):
         """Test setting settings of active builder's transpiler."""
         with pulse.build(self.backend):
-            self.assertFalse(pulse.active_transpiler_settings())
-            with pulse.transpiler_settings(test_setting=1):
-                self.assertEqual(pulse.active_transpiler_settings()["test_setting"], 1)
+            with self.assertWarns(DeprecationWarning):
+                self.assertFalse(pulse.active_transpiler_settings())
+                with pulse.transpiler_settings(test_setting=1):
+                    self.assertEqual(pulse.active_transpiler_settings()["test_setting"], 1)
 
     def test_active_circuit_scheduler_settings(self):
         """Test setting settings of active builder's circuit scheduler."""
         with pulse.build(self.backend):
-            self.assertFalse(pulse.active_circuit_scheduler_settings())
-            with pulse.circuit_scheduler_settings(test_setting=1):
-                self.assertEqual(pulse.active_circuit_scheduler_settings()["test_setting"], 1)
+            with self.assertWarns(DeprecationWarning):
+                self.assertFalse(pulse.active_circuit_scheduler_settings())
+                with pulse.circuit_scheduler_settings(test_setting=1):
+                    self.assertEqual(pulse.active_circuit_scheduler_settings()["test_setting"], 1)
 
     def test_num_qubits(self):
         """Test builder utility to get number of qubits."""
@@ -787,7 +792,8 @@ class TestGates(TestBuilder):
     def test_cx(self):
         """Test cx gate."""
         with pulse.build(self.backend) as schedule:
-            pulse.cx(0, 1)
+            with self.assertWarns(DeprecationWarning):
+                pulse.cx(0, 1)
 
         reference_qc = circuit.QuantumCircuit(2)
         reference_qc.cx(0, 1)
@@ -798,8 +804,9 @@ class TestGates(TestBuilder):
     def test_u1(self):
         """Test u1 gate."""
         with pulse.build(self.backend) as schedule:
-            with pulse.transpiler_settings(layout_method="trivial"):
-                pulse.u1(np.pi / 2, 0)
+            with self.assertWarns(DeprecationWarning):
+                with pulse.transpiler_settings(layout_method="trivial"):
+                    pulse.u1(np.pi / 2, 0)
 
         reference_qc = circuit.QuantumCircuit(1)
         reference_qc.append(circuit.library.U1Gate(np.pi / 2), [0])
@@ -810,7 +817,8 @@ class TestGates(TestBuilder):
     def test_u2(self):
         """Test u2 gate."""
         with pulse.build(self.backend) as schedule:
-            pulse.u2(np.pi / 2, 0, 0)
+            with self.assertWarns(DeprecationWarning):
+                pulse.u2(np.pi / 2, 0, 0)
 
         reference_qc = circuit.QuantumCircuit(1)
         reference_qc.append(circuit.library.U2Gate(np.pi / 2, 0), [0])
@@ -821,7 +829,8 @@ class TestGates(TestBuilder):
     def test_u3(self):
         """Test u3 gate."""
         with pulse.build(self.backend) as schedule:
-            pulse.u3(np.pi / 8, np.pi / 16, np.pi / 4, 0)
+            with self.assertWarns(DeprecationWarning):
+                pulse.u3(np.pi / 8, np.pi / 16, np.pi / 4, 0)
 
         reference_qc = circuit.QuantumCircuit(1)
         reference_qc.append(circuit.library.U3Gate(np.pi / 8, np.pi / 16, np.pi / 4), [0])
@@ -832,7 +841,8 @@ class TestGates(TestBuilder):
     def test_x(self):
         """Test x gate."""
         with pulse.build(self.backend) as schedule:
-            pulse.x(0)
+            with self.assertWarns(DeprecationWarning):
+                pulse.x(0)
 
         reference_qc = circuit.QuantumCircuit(1)
         reference_qc.x(0)
@@ -844,8 +854,9 @@ class TestGates(TestBuilder):
     def test_lazy_evaluation_with_transpiler(self):
         """Test that the two cx gates are optimizied away by the transpiler."""
         with pulse.build(self.backend) as schedule:
-            pulse.cx(0, 1)
-            pulse.cx(0, 1)
+            with self.assertWarns(DeprecationWarning):
+                pulse.cx(0, 1)
+                pulse.cx(0, 1)
 
         reference_qc = circuit.QuantumCircuit(2)
         reference = compiler.schedule(reference_qc, self.backend)
@@ -857,7 +868,8 @@ class TestGates(TestBuilder):
         ensure agreement."""
         with pulse.build(self.backend) as schedule:
             with pulse.align_sequential():
-                pulse.x(0)
+                with self.assertWarns(DeprecationWarning):
+                    pulse.x(0)
                 pulse.measure(0)
 
         reference_qc = circuit.QuantumCircuit(1, 1)
@@ -872,7 +884,8 @@ class TestGates(TestBuilder):
         """Test that a backend is required to use a gate."""
         with self.assertRaises(exceptions.BackendNotSet):
             with pulse.build():
-                pulse.x(0)
+                with self.assertWarns(DeprecationWarning):
+                    pulse.x(0)
 
 
 class TestBuilderComposition(TestBuilder):
@@ -891,15 +904,18 @@ class TestBuilderComposition(TestBuilder):
         with pulse.build(self.backend) as schedule:
             with pulse.align_sequential():
                 pulse.delay(delay_dur, d0)
-                pulse.u2(0, pi / 2, 1)
+                with self.assertWarns(DeprecationWarning):
+                    pulse.u2(0, pi / 2, 1)
             with pulse.align_right():
                 pulse.play(library.Constant(short_dur, 0.1), d1)
                 pulse.play(library.Constant(long_dur, 0.1), d2)
-                pulse.u2(0, pi / 2, 1)
+                with self.assertWarns(DeprecationWarning):
+                    pulse.u2(0, pi / 2, 1)
             with pulse.align_left():
-                pulse.u2(0, pi / 2, 0)
-                pulse.u2(0, pi / 2, 1)
-                pulse.u2(0, pi / 2, 0)
+                with self.assertWarns(DeprecationWarning):
+                    pulse.u2(0, pi / 2, 0)
+                    pulse.u2(0, pi / 2, 1)
+                    pulse.u2(0, pi / 2, 0)
             pulse.measure(0)
 
         # prepare and schedule circuits that will be used.
@@ -1027,7 +1043,8 @@ class TestSubroutineCall(TestBuilder):
                 # this is circuit, a subroutine stored as Call instruction
                 pulse.call(h_control)
                 # this is instruction, not subroutine
-                pulse.cx(0, 1)
+                with self.assertWarns(DeprecationWarning):
+                    pulse.cx(0, 1)
                 # this is macro, not subroutine
                 pulse.measure([0, 1])
 
diff --git a/test/python/pulse/test_builder_v2.py b/test/python/pulse/test_builder_v2.py
index 1f194a9d3..f741e2113 100644
--- a/test/python/pulse/test_builder_v2.py
+++ b/test/python/pulse/test_builder_v2.py
@@ -52,13 +52,15 @@ class TestContextsV2(TestBuilderV2):
         twice_cx_qc.cx(0, 1)
 
         with pulse.build(self.backend) as schedule:
-            with pulse.transpiler_settings(optimization_level=0):
-                builder.call(twice_cx_qc)
+            with self.assertWarns(DeprecationWarning):
+                with pulse.transpiler_settings(optimization_level=0):
+                    builder.call(twice_cx_qc)
         self.assertNotEqual(len(schedule.instructions), 0)
 
         with pulse.build(self.backend) as schedule:
-            with pulse.transpiler_settings(optimization_level=3):
-                builder.call(twice_cx_qc)
+            with self.assertWarns(DeprecationWarning):
+                with pulse.transpiler_settings(optimization_level=3):
+                    builder.call(twice_cx_qc)
         self.assertEqual(len(schedule.instructions), 0)
 
     def test_scheduler_settings(self):
@@ -76,9 +78,10 @@ class TestContextsV2(TestBuilderV2):
         x_qc.x(0)
 
         with pulse.build(backend=self.backend) as schedule:
-            with pulse.transpiler_settings(basis_gates=["x"]):
-                with pulse.circuit_scheduler_settings(inst_map=inst_map):
-                    builder.call(x_qc)
+            with self.assertWarns(DeprecationWarning):
+                with pulse.transpiler_settings(basis_gates=["x"]):
+                    with pulse.circuit_scheduler_settings(inst_map=inst_map):
+                        builder.call(x_qc)
 
         self.assertScheduleEqual(schedule, ref_sched)
 
@@ -182,16 +185,18 @@ class TestUtilitiesV2(TestBuilderV2):
     def test_active_transpiler_settings(self):
         """Test setting settings of active builder's transpiler."""
         with pulse.build(self.backend):
-            self.assertFalse(pulse.active_transpiler_settings())
-            with pulse.transpiler_settings(test_setting=1):
-                self.assertEqual(pulse.active_transpiler_settings()["test_setting"], 1)
+            with self.assertWarns(DeprecationWarning):
+                self.assertFalse(pulse.active_transpiler_settings())
+                with pulse.transpiler_settings(test_setting=1):
+                    self.assertEqual(pulse.active_transpiler_settings()["test_setting"], 1)
 
     def test_active_circuit_scheduler_settings(self):
         """Test setting settings of active builder's circuit scheduler."""
         with pulse.build(self.backend):
-            self.assertFalse(pulse.active_circuit_scheduler_settings())
-            with pulse.circuit_scheduler_settings(test_setting=1):
-                self.assertEqual(pulse.active_circuit_scheduler_settings()["test_setting"], 1)
+            with self.assertWarns(DeprecationWarning):
+                self.assertFalse(pulse.active_circuit_scheduler_settings())
+                with pulse.circuit_scheduler_settings(test_setting=1):
+                    self.assertEqual(pulse.active_circuit_scheduler_settings()["test_setting"], 1)
 
     def test_num_qubits(self):
         """Test builder utility to get number of qubits with backendV2."""
diff --git a/test/python/transpiler/test_calibrationbuilder.py b/test/python/transpiler/test_calibrationbuilder.py
index 45ada1789..4e56ebf1b 100644
--- a/test/python/transpiler/test_calibrationbuilder.py
+++ b/test/python/transpiler/test_calibrationbuilder.py
@@ -119,45 +119,46 @@ class TestRZXCalibrationBuilder(TestCalibrationBuilder):
         duration = self.compute_stretch_duration(u0p_play, theta)
         width = self.compute_stretch_width(u0p_play, theta)
 
-        with builder.build(
-            backend,
-            default_alignment="sequential",
-            default_transpiler_settings={"optimization_level": 0},
-        ) as ref_sched:
-            with builder.align_left():
-                # Positive CRs
-                u0p_params = u0p_play.pulse.parameters
-                u0p_params["duration"] = duration
-                u0p_params["width"] = width
-                builder.play(
-                    GaussianSquare(**u0p_params),
-                    ControlChannel(0),
-                )
-                d1p_params = d1p_play.pulse.parameters
-                d1p_params["duration"] = duration
-                d1p_params["width"] = width
-                builder.play(
-                    GaussianSquare(**d1p_params),
-                    DriveChannel(1),
-                )
-            builder.x(0)
-            with builder.align_left():
-                # Negative CRs
-                u0m_params = u0m_play.pulse.parameters
-                u0m_params["duration"] = duration
-                u0m_params["width"] = width
-                builder.play(
-                    GaussianSquare(**u0m_params),
-                    ControlChannel(0),
-                )
-                d1m_params = d1m_play.pulse.parameters
-                d1m_params["duration"] = duration
-                d1m_params["width"] = width
-                builder.play(
-                    GaussianSquare(**d1m_params),
-                    DriveChannel(1),
-                )
-            builder.x(0)
+        with self.assertWarns(DeprecationWarning):
+            with builder.build(
+                backend,
+                default_alignment="sequential",
+                default_transpiler_settings={"optimization_level": 0},
+            ) as ref_sched:
+                with builder.align_left():
+                    # Positive CRs
+                    u0p_params = u0p_play.pulse.parameters
+                    u0p_params["duration"] = duration
+                    u0p_params["width"] = width
+                    builder.play(
+                        GaussianSquare(**u0p_params),
+                        ControlChannel(0),
+                    )
+                    d1p_params = d1p_play.pulse.parameters
+                    d1p_params["duration"] = duration
+                    d1p_params["width"] = width
+                    builder.play(
+                        GaussianSquare(**d1p_params),
+                        DriveChannel(1),
+                    )
+                builder.x(0)
+                with builder.align_left():
+                    # Negative CRs
+                    u0m_params = u0m_play.pulse.parameters
+                    u0m_params["duration"] = duration
+                    u0m_params["width"] = width
+                    builder.play(
+                        GaussianSquare(**u0m_params),
+                        ControlChannel(0),
+                    )
+                    d1m_params = d1m_play.pulse.parameters
+                    d1m_params["duration"] = duration
+                    d1m_params["width"] = width
+                    builder.play(
+                        GaussianSquare(**d1m_params),
+                        DriveChannel(1),
+                    )
+                builder.x(0)
         return ref_sched
 
     def build_reverse(
@@ -173,60 +174,60 @@ class TestRZXCalibrationBuilder(TestCalibrationBuilder):
         duration = self.compute_stretch_duration(u0p_play, theta)
         width = self.compute_stretch_width(u0p_play, theta)
 
-        with builder.build(
-            backend,
-            default_alignment="sequential",
-            default_transpiler_settings={"optimization_level": 0},
-        ) as ref_sched:
-            # Hadamard gates
-            builder.call_gate(RZGate(np.pi / 2), qubits=(0,))
-            builder.call_gate(SXGate(), qubits=(0,))
-            builder.call_gate(RZGate(np.pi / 2), qubits=(0,))
-            builder.call_gate(RZGate(np.pi / 2), qubits=(1,))
-            builder.call_gate(SXGate(), qubits=(1,))
-            builder.call_gate(RZGate(np.pi / 2), qubits=(1,))
-            with builder.align_left():
-                # Positive CRs
-                u0p_params = u0p_play.pulse.parameters
-                u0p_params["duration"] = duration
-                u0p_params["width"] = width
-                builder.play(
-                    GaussianSquare(**u0p_params),
-                    ControlChannel(0),
-                )
-                d1p_params = d1p_play.pulse.parameters
-                d1p_params["duration"] = duration
-                d1p_params["width"] = width
-                builder.play(
-                    GaussianSquare(**d1p_params),
-                    DriveChannel(1),
-                )
-            builder.x(0)
-            with builder.align_left():
-                # Negative CRs
-                u0m_params = u0m_play.pulse.parameters
-                u0m_params["duration"] = duration
-                u0m_params["width"] = width
-                builder.play(
-                    GaussianSquare(**u0m_params),
-                    ControlChannel(0),
-                )
-                d1m_params = d1m_play.pulse.parameters
-                d1m_params["duration"] = duration
-                d1m_params["width"] = width
-                builder.play(
-                    GaussianSquare(**d1m_params),
-                    DriveChannel(1),
-                )
-            builder.x(0)
-            # Hadamard gates
-            builder.call_gate(RZGate(np.pi / 2), qubits=(0,))
-            builder.call_gate(SXGate(), qubits=(0,))
-            builder.call_gate(RZGate(np.pi / 2), qubits=(0,))
-            builder.call_gate(RZGate(np.pi / 2), qubits=(1,))
-            builder.call_gate(SXGate(), qubits=(1,))
-            builder.call_gate(RZGate(np.pi / 2), qubits=(1,))
-
+        with self.assertWarns(DeprecationWarning):
+            with builder.build(
+                backend,
+                default_alignment="sequential",
+                default_transpiler_settings={"optimization_level": 0},
+            ) as ref_sched:
+                # Hadamard gates
+                builder.call_gate(RZGate(np.pi / 2), qubits=(0,))
+                builder.call_gate(SXGate(), qubits=(0,))
+                builder.call_gate(RZGate(np.pi / 2), qubits=(0,))
+                builder.call_gate(RZGate(np.pi / 2), qubits=(1,))
+                builder.call_gate(SXGate(), qubits=(1,))
+                builder.call_gate(RZGate(np.pi / 2), qubits=(1,))
+                with builder.align_left():
+                    # Positive CRs
+                    u0p_params = u0p_play.pulse.parameters
+                    u0p_params["duration"] = duration
+                    u0p_params["width"] = width
+                    builder.play(
+                        GaussianSquare(**u0p_params),
+                        ControlChannel(0),
+                    )
+                    d1p_params = d1p_play.pulse.parameters
+                    d1p_params["duration"] = duration
+                    d1p_params["width"] = width
+                    builder.play(
+                        GaussianSquare(**d1p_params),
+                        DriveChannel(1),
+                    )
+                builder.x(0)
+                with builder.align_left():
+                    # Negative CRs
+                    u0m_params = u0m_play.pulse.parameters
+                    u0m_params["duration"] = duration
+                    u0m_params["width"] = width
+                    builder.play(
+                        GaussianSquare(**u0m_params),
+                        ControlChannel(0),
+                    )
+                    d1m_params = d1m_play.pulse.parameters
+                    d1m_params["duration"] = duration
+                    d1m_params["width"] = width
+                    builder.play(
+                        GaussianSquare(**d1m_params),
+                        DriveChannel(1),
+                    )
+                builder.x(0)
+                # Hadamard gates
+                builder.call_gate(RZGate(np.pi / 2), qubits=(0,))
+                builder.call_gate(SXGate(), qubits=(0,))
+                builder.call_gate(RZGate(np.pi / 2), qubits=(0,))
+                builder.call_gate(RZGate(np.pi / 2), qubits=(1,))
+                builder.call_gate(SXGate(), qubits=(1,))
+                builder.call_gate(RZGate(np.pi / 2), qubits=(1,))
         return ref_sched
 
     @data(-np.pi / 4, 0.1, np.pi / 4, np.pi / 2, np.pi)