diff --git a/.github/workflows/ibmq_tests.yml b/.github/workflows/ibmq_tests.yml index a094d1b0f..edbf3e7f8 100644 --- a/.github/workflows/ibmq_tests.yml +++ b/.github/workflows/ibmq_tests.yml @@ -1,7 +1,7 @@ -name: IBMQ integration tests +name: IBMQ integration tests with Qiskit 1.0 on: schedule: - - cron: '0 0 * * 0,4' # At 00:00 on Sunday and Thursday. + - cron: '1 0 * * 0,4' # At 01:00 on Sunday and Thursday. workflow_dispatch: jobs: @@ -28,7 +28,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements-ci-legacy.txt + pip install -r requirements-ci.txt pip install wheel pytest pytest-cov pytest-mock flaky --upgrade pip freeze diff --git a/.github/workflows/ibmq_tests_1.yml b/.github/workflows/ibmq_tests_1.yml deleted file mode 100644 index edbf3e7f8..000000000 --- a/.github/workflows/ibmq_tests_1.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: IBMQ integration tests with Qiskit 1.0 -on: - schedule: - - cron: '1 0 * * 0,4' # At 01:00 on Sunday and Thursday. - workflow_dispatch: - -jobs: - tests: - runs-on: ubuntu-latest - - strategy: - matrix: - python-version: [3.9] - - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.4.1 - with: - access_token: ${{ github.token }} - - - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements-ci.txt - pip install wheel pytest pytest-cov pytest-mock flaky --upgrade - pip freeze - - - name: Install Plugin - run: | - pip install git+https://github.com/PennyLaneAI/pennylane-qiskit.git@${{ github.ref }} - pip freeze - - - name: Run tests - # Only run IBMQ and Runtime tests (skipped otherwise) - run: python -m pytest tests -k 'test_ibmq.py or test_runtime.py' --cov=pennylane_qiskit --cov-report=term-missing --cov-report=xml -p no:warnings --tb=native - env: - IBMQX_TOKEN: ${{ secrets.IBMQX_TOKEN_TEST }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3703508a6..1ad3c3b53 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: Tests +name: Tests for 1.0 on: push: branches: @@ -30,7 +30,7 @@ jobs: run: | python -m pip install --upgrade pip pip install git+https://github.com/PennyLaneAI/pennylane.git - pip install -r requirements-ci-legacy.txt + pip install -r requirements-ci.txt pip install wheel pytest pytest-cov pytest-mock flaky --upgrade pip freeze @@ -39,12 +39,9 @@ jobs: pip install git+https://github.com/PennyLaneAI/pennylane-qiskit.git@${{ github.ref }} pip freeze - - name: Run tests - # Skip IBMQ and Runtime tests as they depend on IBMQ's availability and - # easily result in timeouts + - name: Run standard Qiskit plugin tests + # Run the standard tests with the most recent version of Qiskit run: python -m pytest tests -k 'not test_ibmq.py and not test_runtime.py' --cov=pennylane_qiskit --cov-report=term-missing --cov-report=xml -p no:warnings --tb=native - env: - IBMQX_TOKEN: ${{ secrets.IBMQX_TOKEN_TEST }} - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 @@ -72,19 +69,17 @@ jobs: run: | python -m pip install --upgrade pip pip install git+https://github.com/PennyLaneAI/pennylane.git - pip install -r requirements-ci-legacy.txt + pip install -r requirements-ci.txt pip install wheel pytest pytest-cov pytest-mock pytest-benchmark flaky --upgrade - pip freeze - name: Install Plugin run: | python setup.py bdist_wheel pip install dist/PennyLane*.whl - pip freeze - name: Run tests run: | - pl-device-test --device=qiskit.basicaer --tb=short --skip-ops --shots=20000 --device-kwargs backend=qasm_simulator + pl-device-test --device=qiskit.basicsim --tb=short --skip-ops --shots=20000 --device-kwargs backend=basic_simulator pl-device-test --device=qiskit.aer --tb=short --skip-ops --shots=20000 --device-kwargs backend=qasm_simulator pl-device-test --device=qiskit.aer --tb=short --skip-ops --shots=None --device-kwargs backend=statevector_simulator pl-device-test --device=qiskit.aer --tb=short --skip-ops --shots=None --device-kwargs backend=unitary_simulator diff --git a/.github/workflows/tests_qiskit_1.yml b/.github/workflows/tests_qiskit_1.yml deleted file mode 100644 index 1ad3c3b53..000000000 --- a/.github/workflows/tests_qiskit_1.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: Tests for 1.0 -on: - push: - branches: - - master - pull_request: - -jobs: - tests: - runs-on: ubuntu-latest - - strategy: - matrix: - python-version: [3.9, '3.10', '3.11'] - - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.4.1 - with: - access_token: ${{ github.token }} - - - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install git+https://github.com/PennyLaneAI/pennylane.git - pip install -r requirements-ci.txt - pip install wheel pytest pytest-cov pytest-mock flaky --upgrade - pip freeze - - - name: Install Plugin - run: | - pip install git+https://github.com/PennyLaneAI/pennylane-qiskit.git@${{ github.ref }} - pip freeze - - - name: Run standard Qiskit plugin tests - # Run the standard tests with the most recent version of Qiskit - run: python -m pytest tests -k 'not test_ibmq.py and not test_runtime.py' --cov=pennylane_qiskit --cov-report=term-missing --cov-report=xml -p no:warnings --tb=native - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.codecov_token }} - file: ./coverage.xml - - integration-tests: - runs-on: ubuntu-latest - - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.4.1 - with: - access_token: ${{ github.token }} - - - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install git+https://github.com/PennyLaneAI/pennylane.git - pip install -r requirements-ci.txt - pip install wheel pytest pytest-cov pytest-mock pytest-benchmark flaky --upgrade - - - name: Install Plugin - run: | - python setup.py bdist_wheel - pip install dist/PennyLane*.whl - - - name: Run tests - run: | - pl-device-test --device=qiskit.basicsim --tb=short --skip-ops --shots=20000 --device-kwargs backend=basic_simulator - pl-device-test --device=qiskit.aer --tb=short --skip-ops --shots=20000 --device-kwargs backend=qasm_simulator - pl-device-test --device=qiskit.aer --tb=short --skip-ops --shots=None --device-kwargs backend=statevector_simulator - pl-device-test --device=qiskit.aer --tb=short --skip-ops --shots=None --device-kwargs backend=unitary_simulator - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.codecov_token }} - file: ./coverage.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 624711b2d..8de4f43dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ ### Improvements 🛠 ### Breaking changes 💔 +* Support has been removed for Qiskit versions below 0.46. The minimum required version for Qiskit is now 1.0. + If you want to continue to use older versions of Qiskit with the plugin, please use version 0.36 of + the Pennylane-Qiskit plugin. + [(#536)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/536) + +* The test suite no longer runs for Qiskit versions below 0.46. + [(#536)](https://github.com/PennyLaneAI/pennylane-qiskit/pull/536) ### Deprecations 👋 @@ -15,6 +22,7 @@ ### Contributors ✍️ This release contains contributions from (in alphabetical order): +Austin Huang --- # Release 0.36.0 diff --git a/requirements-ci-legacy.txt b/requirements-ci-legacy.txt deleted file mode 100644 index f33b309b7..000000000 --- a/requirements-ci-legacy.txt +++ /dev/null @@ -1,5 +0,0 @@ -pennylane>=0.32 -qiskit<0.46 -qiskit-ibm-runtime<0.21 -numpy -sympy diff --git a/tests/test_qiskit_device.py b/tests/test_qiskit_device.py index 57b4d2aa9..34b958b1f 100644 --- a/tests/test_qiskit_device.py +++ b/tests/test_qiskit_device.py @@ -174,16 +174,16 @@ def test_warning_raised_for_hardware_backend_analytic_expval(self, recorder): with pytest.warns(UserWarning) as record: dev = qml.device("qiskit.aer", backend="aer_simulator", wires=2, shots=None) - # check that only one warning was raised - assert len(record) == 1 - # check that the message matches assert ( - record[0].message.args[0] == "The analytic calculation of " + record[1].message.args[0] == "The analytic calculation of " "expectations, variances and probabilities is only supported on " f"statevector backends, not on the {dev.backend.name}. Such statistics obtained from this " "device are estimates based on samples." ) + # Two warnings are being raised: one about analytic calculations and another about deprecation. + assert len(record) == 2 + @pytest.mark.parametrize("method", ["unitary", "statevector"]) def test_no_warning_raised_for_software_backend_analytic_expval( self, method, recorder, recwarn @@ -193,8 +193,10 @@ def test_no_warning_raised_for_software_backend_analytic_expval( _ = qml.device("qiskit.aer", backend="aer_simulator", method=method, wires=2, shots=None) - # check that no warnings were raised - assert len(recwarn) == 0 + # These simulators are being deprecated. Warning is raised in Qiskit 1.0 + # Migrate to AerSimulator with AerSimulator(method=method) and append + # run circuits with the `save_state` instruction. + assert len(recwarn) == 1 class TestAerBackendOptions: