TeamGraphix / graphix

measurement-based quantum computing (MBQC) compiler and simulator
https://graphix.readthedocs.io
Apache License 2.0
55 stars 20 forks source link

Add support for Python 3.11 #91

Closed king-p3nguin closed 8 months ago

king-p3nguin commented 9 months ago

Context (if applicable):

90

Description of the change:

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.

unittest.mock.MagicMock provides the ability to mock dependent modules. https://github.com/TeamGraphix/graphix/blob/2eb09789e4005139820215ec709ba0b89ae88fdf/tests/test_runner.py#L44-L47

Related issue:

90