quantum
quantum copied to clipboard
Enhance `test_tutorials.py`'s handling of notebook magics
The previous version of scripts/test_tutorials.py did not handle !pip commands inside if-then conditionals, and also didn't handle % magics. This PR makes some simple changes to the code to make it handle those cases.
The original motivation for these changes were to accommodate different notebook instructions for running pip installs. The notebooks have been changed since then, and the specific constructs that led to this PR are not there anymore. However, IMHO these simple changes are worth adding at some point because the need to combine ! with conditionals (as well as use % magics) may arise again in the future. We can save future maintainers the trouble of figuring this out again.