Closed rmlarose closed 3 years ago
We are running the tests on the documentation: https://github.com/unitaryfund/mitiq/blob/58fdff01d53c0b9cf9b068d60e005c094ca6ffcb/.github/workflows/test.yml#L52
In the user guide, we have 76 testcode
directive instances. .
The way myst works is by building the docs by running the notebooks (be them rst or other formats), so all output seen in the html documentation online has been generated by some code, and this happens also in CI.
The instructions to include test code directives in .rst are shown in the [Testing example] (https://mitiq.readthedocs.io/en/stable/examples/test.html#testing) and here in the code: https://github.com/unitaryfund/mitiq/blob/master/docs/source/examples/test.myst#L159-L173 that is not shown.
The reason why this import issue is not picked up may be due to a global requirement that is set in the conf.py
, which sets an alias import, https://github.com/unitaryfund/mitiq/blob/255df184eca7a1b3e60455c281c3b884719ff876/docs/source/conf.py#L157-L168. We could remove that.
Thanks for noting the global config. I removed it in #804 to test and the docs build passes, so there is something else going on.
The problem seems to be related to using .. testcode:: python
instead of just .. testcode::
.
See last commit [test] try removing "python" style label
of #804 (i.e. 9bcb927) .
Thanks @andreamari. There's a lot of other .. testcode:: python
directives in that file, I guess those should be removed as well...?
If you copy-paste the IBMQ example into a colab, there is an error.
(Should be
from mitiq import zne
instead ofimport mitiq
above.)We should be testing examples in CI to make sure they run and catch errors like this.