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

Fix fake backend v2 dtm unit #8019

Merged
merged 9 commits into from
May 4, 2022
Merged

Fix fake backend v2 dtm unit #8019

merged 9 commits into from
May 4, 2022

Conversation

HuangJunye
Copy link
Collaborator

Summary

Fixed an issue where FakeBackendV2.dtm is reading from configuration file, expecting it to be in seconds, when it's actually in nanoseconds.

Related to a similar issue for dt: #8000

Details and comments

Fixes #8018

@HuangJunye HuangJunye requested review from a team and jyu00 as code owners May 3, 2022 15:57
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

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

  • @Qiskit/terra-core

Comment on lines +112 to +116
@data(*FAKE_PROVIDER_FOR_BACKEND_V2.backends())
def test_backend_v2_dtm(self, backend):
if backend.dtm:
self.assertLess(backend.dtm, 1e-6)

Copy link
Collaborator Author

@HuangJunye HuangJunye May 3, 2022

Choose a reason for hiding this comment

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

The test for dtm cannot be combined with dt (like test_to_dict_configuration) because dtm is not part of the target. But I am not sure creating a specific test just for dtm is a good practice or not.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mtreinish What do you think about the test? Is the function name too specific? Does this test belong to this file or should it be in the test_fake_backend_v2.py?

Copy link
Member

Choose a reason for hiding this comment

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

This is fine here and is a reasonable test to make sure we've got the unit conversion right.

@coveralls
Copy link

coveralls commented May 3, 2022

Pull Request Test Coverage Report for Build 2271900780

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.002%) to 84.358%

Totals Coverage Status
Change from base Build 2271856830: 0.002%
Covered Lines: 54485
Relevant Lines: 64588

💛 - Coveralls

Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

LGTM, just one tiny inline suggestion

qiskit/test/mock/fake_backend.py Outdated Show resolved Hide resolved
@mtreinish mtreinish added stable backport potential The bug might be minimal and/or import enough to be port to stable Changelog: Bugfix Include in the "Fixed" section of the changelog labels May 4, 2022
@mergify mergify bot merged commit cffbb84 into Qiskit:main May 4, 2022
mergify bot pushed a commit that referenced this pull request May 4, 2022
* convert dtm from nanoseconds to seconds

* Handle dtm not defined in configuration

* Add test for checking backend v2 dtm less than 1e-6

* add release note

* new line in release note

* Update qiskit/test/mock/fake_backend.py

Co-authored-by: Matthew Treinish <[email protected]>

Co-authored-by: Matthew Treinish <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit cffbb84)
mergify bot added a commit that referenced this pull request May 4, 2022
* convert dtm from nanoseconds to seconds

* Handle dtm not defined in configuration

* Add test for checking backend v2 dtm less than 1e-6

* add release note

* new line in release note

* Update qiskit/test/mock/fake_backend.py

Co-authored-by: Matthew Treinish <[email protected]>

Co-authored-by: Matthew Treinish <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit cffbb84)

Co-authored-by: Junye Huang <[email protected]>
ElePT pushed a commit to ElePT/qiskit-ibm-provider that referenced this pull request Oct 9, 2023
* convert dtm from nanoseconds to seconds

* Handle dtm not defined in configuration

* Add test for checking backend v2 dtm less than 1e-6

* add release note

* new line in release note

* Update qiskit/test/mock/fake_backend.py

Co-authored-by: Matthew Treinish <[email protected]>

Co-authored-by: Matthew Treinish <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dtm in FakeBackendV2 should be in seconds not nanoseconds
4 participants