Skip to content

Commit fec68ae

Browse files
authored
Fix ci-daily pytest failure (#6335)
* Fix requirements installation for Windows * Run notebook tests only on Linux platform * Run test_isolated_packages on POSIX platforms only Temporary workaround for #6336
1 parent 34e8dab commit fec68ae

14 files changed

+36
-4
lines changed

.github/workflows/ci-daily.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ jobs:
5858
- name: Install requirements
5959
run: |
6060
pip install --pre cirq &&
61-
pip install \
62-
-r dev_tools/requirements/deps/format.txt \
63-
-r dev_tools/requirements/deps/pylint.txt \
64-
-r dev_tools/requirements/deps/pytest.txt
61+
pip install -r dev_tools/requirements/deps/format.txt &&
62+
pip install -r dev_tools/requirements/deps/pylint.txt &&
63+
pip install -r dev_tools/requirements/deps/pytest.txt
6564
- name: Pytest Windows
6665
run: check/pytest -n auto --ignore=cirq-core/cirq/contrib --enable-slow-tests
6766
shell: bash

cirq-ft/cirq_ft/algos/and_gate_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import itertools
1616
import random
17+
import sys
1718
from typing import List, Tuple
1819

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

205206

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

cirq-ft/cirq_ft/algos/apply_gate_to_lth_target_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import sys
16+
1517
import cirq
1618
import cirq_ft
1719
import pytest
@@ -101,5 +103,6 @@ def test_apply_gate_to_lth_qubit_make_on():
101103
assert op.gate.control_regs == op2.gate.control_regs
102104

103105

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

cirq-ft/cirq_ft/algos/generic_select_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
15+
import sys
1416
from typing import List, Sequence
1517

1618
import cirq
@@ -276,5 +278,6 @@ def test_generic_select_consistent_protocols_and_controlled():
276278
_ = gate.controlled(num_controls=2)
277279

278280

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

cirq-ft/cirq_ft/algos/hubbard_model_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import sys
16+
1517
import cirq
1618
import cirq_ft
1719
import pytest
@@ -72,5 +74,6 @@ def test_hubbard_model_consistent_protocols():
7274
assert cirq.circuit_diagram_info(select_gate).wire_symbols == tuple(expected_symbols)
7375

7476

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

cirq-ft/cirq_ft/algos/qrom_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import itertools
16+
import sys
1617

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

116117

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

cirq-ft/cirq_ft/algos/qubitization_walk_operator_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import sys
16+
1517
import cirq
1618
import cirq_ft
1719
import numpy as np
@@ -240,6 +242,7 @@ def test_qubitization_walk_operator_consistent_protocols_and_controlled():
240242
_ = gate.controlled(num_controls=2)
241243

242244

245+
@pytest.mark.skipif(sys.platform != "linux", reason="Linux-only test")
243246
def test_notebook():
244247
execute_notebook('qubitization_walk_operator')
245248
execute_notebook('phase_estimation_of_quantum_walk')

cirq-ft/cirq_ft/algos/state_preparation_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import sys
16+
1517
import cirq
1618
import cirq_ft
1719
import numpy as np
@@ -93,5 +95,6 @@ def test_state_preparation_via_coherent_alias_sampling_diagram():
9395
)
9496

9597

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

cirq-ft/cirq_ft/algos/swap_network_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import random
16+
import sys
1617

1718
import cirq
1819
import cirq_ft
@@ -146,6 +147,7 @@ def test_multi_target_cswap_make_on():
146147
assert cswap1 == cswap2
147148

148149

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

cirq-ft/cirq_ft/algos/unary_iteration_gate_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import itertools
16+
import sys
1617
from typing import Sequence, Tuple
1718

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

200201

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

0 commit comments

Comments
 (0)