Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update remaining unit tests to use FakeGeneric #10918

Merged
merged 28 commits into from
Jan 31, 2024

Conversation

ElePT
Copy link
Contributor

@ElePT ElePT commented Sep 29, 2023

Summary

(2/4) --> This is the second PR of the FakeBackends refactoring epic.

#10266 introduces the FakeGeneric and GenericTarget classes. This PR is a follow-up that replaces all uses of V2 FakeBackends in unit tests with the new FakeGeneric class.

Details and comments

Files not covered by this PR that still use fake V2 backends:

Visualization tests will most likely be left for a follow up (joint V1 and V2 changes):

  • test/python/visualization/test_gate_map.py
  • test/python/visualization/test_circuit_text_drawer.py
  • test/visual/mpl/circuit/test_circuit_matplotlib_drawer.py

TO-DOs:

  • test/python/providers/test_backend_v2.py

@ElePT ElePT changed the title Decouple provider-specific features from fake backends Update unit tests to use FakeGeneric Oct 3, 2023
@ElePT ElePT changed the title Update unit tests to use FakeGeneric Update remaining unit tests to use FakeGeneric Oct 3, 2023
@ElePT ElePT added this to the 0.45.0 milestone Oct 3, 2023
@1ucian0 1ucian0 modified the milestones: 0.45.0, 0.46.0 Oct 5, 2023
@ElePT ElePT marked this pull request as ready for review October 10, 2023 14:25
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core
  • @ajavadia
  • @ikkoham
  • @levbishop
  • @mtreinish
  • @nkanazawa1989
  • @t-imamichi

@ElePT ElePT modified the milestones: 0.46.0, 0.45.0 Oct 11, 2023
@jakelishman jakelishman self-assigned this Oct 17, 2023
@mtreinish mtreinish modified the milestones: 0.45.0, 1.0.0 Oct 18, 2023
@coveralls
Copy link

coveralls commented Nov 28, 2023

Pull Request Test Coverage Report for Build 7729421822

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 95 unchanged lines in 6 files lost coverage.
  • Overall coverage decreased (-0.07%) to 89.507%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 1 92.44%
qiskit/primitives/backend_estimator.py 1 96.14%
qiskit/transpiler/target.py 1 93.9%
qiskit/qpy/binary_io/circuits.py 9 91.34%
qiskit/providers/fake_provider/fake_backend.py 23 81.42%
qiskit/providers/fake_provider/fake_backend_v2.py 60 39.81%
Totals Coverage Status
Change from base Build 7728099338: -0.07%
Covered Lines: 59268
Relevant Lines: 66216

💛 - Coveralls

Fix backend estimator test

Fix lint, backend estimator test

Include missing tests
Initial fix

Fix calibrations

Fix remaining tests
@ElePT ElePT requested a review from a team as a code owner January 30, 2024 13:53
test/python/__init__.py Outdated Show resolved Hide resolved
test/python/primitives/test_backend_estimator.py Outdated Show resolved Hide resolved
test/python/primitives/test_backend_estimator.py Outdated Show resolved Hide resolved
test/python/primitives/test_backend_sampler.py Outdated Show resolved Hide resolved
test/python/primitives/test_backend_sampler.py Outdated Show resolved Hide resolved
test/python/primitives/test_backend_sampler.py Outdated Show resolved Hide resolved
test/python/providers/test_backend_v2.py Outdated Show resolved Hide resolved
Copy link
Contributor

@kevinhartman kevinhartman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks almost ready. The primary change I'd request is that the coupling maps be placed in their own file 🙂.

test/python/qpy/test_circuit_load_from_qpy.py Outdated Show resolved Hide resolved
test/python/transpiler/test_sabre_layout.py Outdated Show resolved Hide resolved
test/python/providers/test_backend_v2.py Show resolved Hide resolved
test/python/scheduler/test_basic_scheduler.py Show resolved Hide resolved
@@ -1145,29 +1086,33 @@ def test_inst_sched_map_get_measure_0(self):
is actually Schedule for just qubit_0"""
sched_from_backend = self.backend.instruction_schedule_map.get("measure", [0])
expected_sched = Schedule(
(0, Acquire(1472, AcquireChannel(0), MemorySlot(0))),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mtreinish can you take a look at these tests? I don't have enough exposure to pulse scheduling to do a proper review

Copy link
Contributor

@kevinhartman kevinhartman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, we can always update the tests further if there are any issues.

@kevinhartman kevinhartman added this pull request to the merge queue Jan 31, 2024
@ElePT ElePT added the Changelog: None Do not include in changelog label Jan 31, 2024
Merged via the queue into Qiskit:main with commit d9b90de Jan 31, 2024
12 checks passed
@1ucian0 1ucian0 mentioned this pull request Mar 24, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add generic Fake Backends and update use in Qiskit unit tests
7 participants