-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Bundle tests in qiskit package to allow running from install #1389
Comments
Did you also want to include the tests in the sdist (which is something I advocated for in #268 ) or just updating the imports to use absolute imports so they'll run on an installed package? |
I want to be able to do qiskit.test() and have the tests run, so in the package. |
Can we regroup after 0.7 before proceeding with the implementation? I think it would be nice to have the tests included in the deliverables, and being able to tackle it after the release would hopefully allow enough time for continuing the discussion hinted by @mtreinish, and at the same time reduce the impact of a potentially big PR at this time (and kind of touches with a test overhaul that might be good for Aer as well). |
It is not marked for 0.7. |
This would ease the integration of qiskit into more exotic hardware (see the qiskit-on-raspberry project for an example). Examples of functionality would be (as mentioned above)
to run the full test suite, but also
to test only the circuits submodule, for example. This should preferably be implemented without changing the current testing functionality or without having to rewrite any of the tests. This can be done by moving the tests from the "external" (external to the qiskit module) test folder and move them into the module itself. To be consistent the best solution would probably be to let every module and submodule handle their tests. That is split up the existing test directory and distribute it over the modules. To make the tests runnable from python without having to implement the functionality in every module/submodule a top-level tester class can be utilized to let modules register that they are testable and let it handle it. This also allows for easy and consistent migration and behavior for all other qiskit elements. I have made a minimal example of how this would look, which can be found here. Furthermore, I have completed the test migration on a local copy of qiskit-terra (with surprising ease) and plan to implement the top-level tester class shortly, as proof of concept. This repo can be made available on request. I would gladly keep going and do the migration if there are no objections. In fact, I will keep going and submit a merge request if I don't hear anything else. |
I have also noticed that there are multiple ways of testing. |
There really isn't anything wrong with variety everyone out there has their own preferred workflow and tool, and we wanted to facilitate that. As a wider project qiskit has standardized on strict unittest compatibility for the test suites, and we use stestr in CI across all the projects. The strict unittest compatibility is to not preclude the use of any runner. All the test runners out there support running unittest. stestr is used in CI primarily for speed since it's a parallel first strictly unittest compatible test runner. The makefile is there for legacy purposes because for a long time that was the only way to run tests and some people are used to running That being said if we are to add a |
We had this debate a long time ago see #268 and we decided we did not want per package test modules as part of that. My personal opinion is that having per module tests really clutters up the repo needlessly, it also can complicate test discovery for a runner. The direction this work was leaning before it stalled was to move |
Ah! I see your point. It is a shame that the To solve this now, what if we instead go for the structure that you suggested in #268? That is all the tests are located under qiskit.tests. I agree that this is a less cluttered way of organizing them, even though it gives a less "modular" feel. For running the tests internally we could still go with the tester class functionality but mapping the function call to |
This was discussed among @Qiskit/terra-core and the current feeling is that this results in too much code churn weighed against the benefit of being able to run |
What is the expected enhancement?
The tests should be able to be run from the installed qiskit package. This is true for all other numeric Python packages. It will also help for testing older releases.
The text was updated successfully, but these errors were encountered: