diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 253c99fd88..da877479ac 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -50,7 +50,7 @@ jobs: needs: [docs] strategy: matrix: - python-version: [3.7] + python-version: [3.8] steps: - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} diff --git a/qiskit_aer/primitives/sampler.py b/qiskit_aer/primitives/sampler.py index e1b75cef39..286d7df0fe 100644 --- a/qiskit_aer/primitives/sampler.py +++ b/qiskit_aer/primitives/sampler.py @@ -66,7 +66,6 @@ def __init__( skip_transpilation: if True, transpilation is skipped. """ super().__init__(options=run_options) - self._is_closed = False self._backend = AerSimulator() backend_options = {} if backend_options is None else backend_options self._backend.set_options(**backend_options) @@ -82,9 +81,6 @@ def _call( parameter_values: Sequence[Sequence[float]], **run_options, ) -> SamplerResult: - if self._is_closed: - raise QiskitError("The primitive has been closed.") - seed = run_options.pop("seed", None) if seed is not None: run_options.setdefault("seed_simulator", seed) @@ -158,9 +154,6 @@ def _run( job.submit() return job - def close(self): - self._is_closed = True - @staticmethod def _preprocess_circuit(circuit: QuantumCircuit): circuit = init_circuit(circuit) diff --git a/test/terra/primitives/test_estimator.py b/test/terra/primitives/test_estimator.py index d0b97a1688..1742cfa85a 100644 --- a/test/terra/primitives/test_estimator.py +++ b/test/terra/primitives/test_estimator.py @@ -53,15 +53,16 @@ def setUp(self): def test_estimator(self, abelian_grouping): """test for a simple use case""" lst = [("XX", 1), ("YY", 2), ("ZZ", 3)] - with self.subTest("PauliSumOp"): - observable = PauliSumOp.from_list(lst) - ansatz = RealAmplitudes(num_qubits=2, reps=2) - est = Estimator(abelian_grouping=abelian_grouping) - result = est.run( - ansatz, observable, parameter_values=[[0, 1, 1, 2, 3, 5]], seed=15 - ).result() - self.assertIsInstance(result, EstimatorResult) - np.testing.assert_allclose(result.values, [1.728515625]) + with self.assertWarns(DeprecationWarning): + with self.subTest("PauliSumOp"): + observable = PauliSumOp.from_list(lst) + ansatz = RealAmplitudes(num_qubits=2, reps=2) + est = Estimator(abelian_grouping=abelian_grouping) + result = est.run( + ansatz, observable, parameter_values=[[0, 1, 1, 2, 3, 5]], seed=15 + ).result() + self.assertIsInstance(result, EstimatorResult) + np.testing.assert_allclose(result.values, [1.728515625]) with self.subTest("SparsePauliOp"): observable = SparsePauliOp.from_list(lst)