Using the current code on Python 3.11 does not seem to have a problem, so I just modified the CI, setup.py, and tox.ini.
Mocks were introduced to remove the dependency on graphix_ibmq during testing.
Currently, when running the PatternRunner test, graphix_ibmq is imported to see if PatternRunner works correctly. This strategy for testing checks the functionality of PatternRunner and graphix_ibmq at the same time, so when an error occurs, it is difficult to tell whether the problem derives from PatternRunner or graphix_ibmq. Also, because graphix imports graphix_ibmq and graphix_ibmq imports graphix, the test will not work correctly until graphix_ibmq supports Python 3.11. It is not ideal to encounter this issue every time graphix adds support for a newer Python version, so I avoided it by running the test assuming that graphix_ibmq is working correctly during testing.
Context (if applicable):
90
Description of the change:
setup.py
, andtox.ini
.graphix_ibmq
during testing.Currently, when running the
PatternRunner
test,graphix_ibmq
is imported to see ifPatternRunner
works correctly. This strategy for testing checks the functionality ofPatternRunner
andgraphix_ibmq
at the same time, so when an error occurs, it is difficult to tell whether the problem derives fromPatternRunner
orgraphix_ibmq
. Also, becausegraphix
importsgraphix_ibmq
andgraphix_ibmq
importsgraphix
, the test will not work correctly untilgraphix_ibmq
supports Python 3.11. It is not ideal to encounter this issue every timegraphix
adds support for a newer Python version, so I avoided it by running the test assuming thatgraphix_ibmq
is working correctly during testing.unittest.mock.MagicMock
provides the ability to mock dependent modules. https://github.com/TeamGraphix/graphix/blob/2eb09789e4005139820215ec709ba0b89ae88fdf/tests/test_runner.py#L44-L47Related issue:
90