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

Deprecate qiskit.test #6862

Closed
mtreinish opened this issue Aug 3, 2021 · 2 comments · Fixed by #11001
Closed

Deprecate qiskit.test #6862

mtreinish opened this issue Aug 3, 2021 · 2 comments · Fixed by #11001
Labels
type: enhancement It's working, but needs polishing

Comments

@mtreinish
Copy link
Member

What is the expected enhancement?

As a follow up to #6753 we should start to deprecate the qiskit.test namespace. Most of the code there is isolated to terra's unittests and is not something we should be exporting as a public interface in the package's namespace. Test code should live as close to the tests as possible the more abstracted away it is the harder it is to debug test failures or understand what a test is actually doing. As some downstream projects use the base test classes they should probably copy them locally because every project's testing needs are different.

We should investigate if there are any things in there we still want to keep and come up with a strategy for preserving them. The only example I can think of currently is qiskit.test.mock (https://github.com/Qiskit/qiskit-terra/tree/main/qiskit/test/mock) which has all the fake backends and ibmq_mock (https://github.com/Qiskit/qiskit-terra/blob/main/qiskit/test/ibmq_mock.py ) which is used in hidden cells for jupyter executes in docstrings that use the ibmq provider. We can probably move the mock backends to qiskit.provider or make a new namespace for them. For mock_ibmq we can probably just put it in utils or tools (not sure what the distinction is there).

@chriseclectic
Copy link
Member

Many other qiskit packages import the qiskit test cases classes as the base for their own test classes. What should they do instead if this is no longer importable?

@jakelishman
Copy link
Member

jakelishman commented Jan 15, 2024

Closed by #11001 for Qiskit 0.46.

edit: also, the answer to Chris' question above for others is that QiskitTestCase is specific to Qiskit (Terra) - it includes various warning skips and things like that that are appropriate for Terra and not for others - and other libraries should define their own test base if they need something more than the base unittest.TestCase. It's fine to start by vendoring QiskitTestCase and cutting out the bits you don't need, though, if that's most convenient. After #11445, qiskit.test will be drastically slimmed down to a state that's more appropriate to pick out the bits to vendor, then another PR like #10998 will actually move QiskitTestCase out of the Qiskit package, so it won't be importable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement It's working, but needs polishing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants