Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ci-daily pytest failure #6335

Merged
merged 5 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/ci-daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ jobs:
- name: Install requirements
run: |
pip install --pre cirq &&
pip install \
-r dev_tools/requirements/deps/format.txt \
-r dev_tools/requirements/deps/pylint.txt \
-r dev_tools/requirements/deps/pytest.txt
pip install -r dev_tools/requirements/deps/format.txt &&
pip install -r dev_tools/requirements/deps/pylint.txt &&
pip install -r dev_tools/requirements/deps/pytest.txt
- name: Pytest Windows
run: check/pytest -n auto --ignore=cirq-core/cirq/contrib --enable-slow-tests
shell: bash
Expand Down
2 changes: 2 additions & 0 deletions cirq-ft/cirq_ft/algos/and_gate_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import itertools
import random
import sys
from typing import List, Tuple

import cirq
Expand Down Expand Up @@ -203,6 +204,7 @@ def test_and_gate_adjoint(cv: Tuple[int, int]):
cirq_ft.testing.assert_circuit_inp_out_cirqsim(circuit, [c1, c2, t], inp, out)


@pytest.mark.skipif(sys.platform != "linux", reason="Linux-only test")
def test_notebook():
execute_notebook('and_gate')

Expand Down
3 changes: 3 additions & 0 deletions cirq-ft/cirq_ft/algos/apply_gate_to_lth_target_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import sys

import cirq
import cirq_ft
import pytest
Expand Down Expand Up @@ -101,5 +103,6 @@ def test_apply_gate_to_lth_qubit_make_on():
assert op.gate.control_regs == op2.gate.control_regs


@pytest.mark.skipif(sys.platform != "linux", reason="Linux-only test")
def test_notebook():
execute_notebook('apply_gate_to_lth_target')
3 changes: 3 additions & 0 deletions cirq-ft/cirq_ft/algos/generic_select_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import sys
from typing import List, Sequence

import cirq
Expand Down Expand Up @@ -276,5 +278,6 @@ def test_generic_select_consistent_protocols_and_controlled():
_ = gate.controlled(num_controls=2)


@pytest.mark.skipif(sys.platform != "linux", reason="Linux-only test")
def test_notebook():
execute_notebook('generic_select')
3 changes: 3 additions & 0 deletions cirq-ft/cirq_ft/algos/hubbard_model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import sys

import cirq
import cirq_ft
import pytest
Expand Down Expand Up @@ -72,5 +74,6 @@ def test_hubbard_model_consistent_protocols():
assert cirq.circuit_diagram_info(select_gate).wire_symbols == tuple(expected_symbols)


@pytest.mark.skipif(sys.platform != "linux", reason="Linux-only test")
def test_notebook():
execute_notebook('hubbard_model')
2 changes: 2 additions & 0 deletions cirq-ft/cirq_ft/algos/qrom_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import itertools
import sys

import cirq
import cirq_ft
Expand Down Expand Up @@ -114,6 +115,7 @@ def test_qrom_repr():
cirq.testing.assert_equivalent_repr(qrom, setup_code="import cirq_ft\nimport numpy as np")


@pytest.mark.skipif(sys.platform != "linux", reason="Linux-only test")
def test_notebook():
execute_notebook('qrom')

Expand Down
3 changes: 3 additions & 0 deletions cirq-ft/cirq_ft/algos/qubitization_walk_operator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import sys

import cirq
import cirq_ft
import numpy as np
Expand Down Expand Up @@ -240,6 +242,7 @@ def test_qubitization_walk_operator_consistent_protocols_and_controlled():
_ = gate.controlled(num_controls=2)


@pytest.mark.skipif(sys.platform != "linux", reason="Linux-only test")
def test_notebook():
execute_notebook('qubitization_walk_operator')
execute_notebook('phase_estimation_of_quantum_walk')
3 changes: 3 additions & 0 deletions cirq-ft/cirq_ft/algos/state_preparation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import sys

import cirq
import cirq_ft
import numpy as np
Expand Down Expand Up @@ -93,5 +95,6 @@ def test_state_preparation_via_coherent_alias_sampling_diagram():
)


@pytest.mark.skipif(sys.platform != "linux", reason="Linux-only test")
def test_notebook():
execute_notebook('state_preparation')
2 changes: 2 additions & 0 deletions cirq-ft/cirq_ft/algos/swap_network_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import random
import sys

import cirq
import cirq_ft
Expand Down Expand Up @@ -146,6 +147,7 @@ def test_multi_target_cswap_make_on():
assert cswap1 == cswap2


@pytest.mark.skipif(sys.platform != "linux", reason="Linux-only test")
def test_notebook():
execute_notebook('swap_network')

Expand Down
2 changes: 2 additions & 0 deletions cirq-ft/cirq_ft/algos/unary_iteration_gate_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import itertools
import sys
from typing import Sequence, Tuple

import cirq
Expand Down Expand Up @@ -198,5 +199,6 @@ def test_unary_iteration_loop_empty_range():
assert list(cirq_ft.unary_iteration(4, 3, [], [], [cirq.q('s')], qm)) == []


@pytest.mark.skipif(sys.platform != "linux", reason="Linux-only test")
def test_notebook():
execute_notebook('unary_iteration')
3 changes: 3 additions & 0 deletions cirq-ft/cirq_ft/infra/gate_with_registers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import sys

import cirq
import cirq_ft
import numpy as np
Expand Down Expand Up @@ -169,5 +171,6 @@ def test_gate_with_registers():
assert op1 == op2


@pytest.mark.skipif(sys.platform != "linux", reason="Linux-only test")
def test_notebook():
execute_notebook('gate_with_registers')
3 changes: 3 additions & 0 deletions cirq-ft/cirq_ft/infra/t_complexity_protocol_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import sys

import cirq
import cirq_ft
import pytest
Expand Down Expand Up @@ -207,5 +209,6 @@ def gate(self):
cirq_ft.t_complexity.cache_clear()


@pytest.mark.skipif(sys.platform != "linux", reason="Linux-only test")
def test_notebook():
execute_notebook('t_complexity')
2 changes: 2 additions & 0 deletions dev_tools/notebooks/notebook_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import importlib.metadata
import os
import sys
import tempfile

import pytest
Expand Down Expand Up @@ -86,6 +87,7 @@ def env_with_temporary_pip_target():


@pytest.mark.slow
@pytest.mark.skipif(sys.platform != "linux", reason="Linux-only test")
@pytest.mark.parametrize("notebook_path", filter_notebooks(list_all_notebooks(), SKIP_NOTEBOOKS))
def test_notebooks_against_cirq_head(
notebook_path, require_packages_not_changed, env_with_temporary_pip_target
Expand Down
2 changes: 2 additions & 0 deletions dev_tools/packaging/isolated_packages_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@

from dev_tools import shell_tools
from dev_tools.modules import list_modules
from dev_tools.test_utils import only_on_posix

PACKAGES = ["-r", "dev_tools/requirements/isolated-base.env.txt"]


@only_on_posix
@pytest.mark.slow
# ensure that no cirq packages are on the PYTHONPATH, this is important, otherwise
# the "isolation" fails and for example cirq-core would be on the PATH
Expand Down
Loading