quantumlib / Cirq

A Python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.
Apache License 2.0
4.28k stars 1.02k forks source link

Fix CI notebook tests for MacOS and Windows #6336

Open pavoljuhas opened 1 year ago

pavoljuhas commented 1 year ago

Description of the issue

After activating MacOS and Windows testing in ci-daily.yml in #6331, the notebook tests failed on these platforms, example. As a temporary solution, #6335 restricts notebook testing to run on Linux only. For a proper solution we need to fix notebook tests on Mac and Windows platforms.

The affected notebook tests are those touched in #6335, ie, those decorated with

@pytest.mark.skipif(sys.platform != "linux", reason="Linux-only test")

Cirq version 1.3.0.dev at 34e8dab087c65ff62957e8fc33c418f19f47333a

smburdick commented 11 months ago

I can take this on.

I can use my own local Windows/MacOS environments to reproduce the issues.

smburdick commented 11 months ago

https://github.com/quantumlib/Cirq/commit/3c6a305bb88b93b197c8c98762013baa1134f41e removed all but one of the skipif(sys.platform != "linux", reason="Linux-only test") tags.

The remaining one is in dev_tools/notebooks/notebook_test.py which failed in integration testing.

smburdick commented 11 months ago

From the macOS output:

dev_tools/notebooks/notebook_test.py:123: Failed
----------------------------- Captured stdout call -----------------------------
/bin/sh: line 1: papermill: command not found

papermill is included in dev_tools/requirements/deps/notebook.txt. Let's have pip install that when we run integration tests.

smburdick commented 11 months ago

Windows output:

-r: D:\a\_temp\c0ad28f8-cc4a-442c-b165-389fe89d7f5e.ps1:4
Line |
   4 |    -r dev_tools/requirements/deps/format.txt \
     |    ~~
     | The term '-r' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the
     | spelling of the name, or if a path was included, verify that the path is correct and try again.

Error: Process completed with exit code 1.
##[debug]Finishing: Install requirements

I'm not too well versed on Windows/PowerShell, but it looks like you're trying to run a Unix style multiline command in a Powershell/cmd context. Edit: it's interesting that's how it's being run, when the && line breaks are used for the Windows version of the command. I haven't had a chance to run this locally, though.

smburdick commented 11 months ago

https://github.com/quantumlib/Cirq/commit/30b6c3908e36c58299e920f03803c0f9d8d23668 addresses macOS bug. Will begin on Windows side now.

smburdick commented 11 months ago

I'm a little out of my depth on the Windows side of things (all my dev experience is Unix). I will pick up something else. Thanks!