Skip to content

Commit

Permalink
CI - run the pytest-numpy-2 job also with Python 3.13 (#6974)
Browse files Browse the repository at this point in the history
* CI - run the pytest-numpy-2 job also with Python 3.13

This CI job excludes cirq-rigetti which is not yet compatible with
Python 3.13.  This activates Python 3.13 testing for other Cirq packages.

Related to #6932

* Install only dependencies needed for running pytest

* Adjust mocking of EngineClient.get_processor for Python 3.13

In Python 3.13 `Mock(EngineClient)` creates an AsyncMock for
`EngineClient.get_processor()`.  Here we adjust the class
mocking so it works for both Python 3.12 and 3.13.
  • Loading branch information
pavoljuhas authored Jan 28, 2025
1 parent b4190e9 commit ab62c25
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ jobs:
name: Pytest Ubuntu with NumPy-2
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12', '3.13']
runs-on: ubuntu-20.04
steps:
- name: Check out source repository
Expand Down
8 changes: 4 additions & 4 deletions cirq-google/cirq_google/engine/engine_processor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,12 @@ def test_get_sampler_with_incomplete_device_configuration_errors(
)


def test_get_sampler_loads_processor_with_default_device_configuration() -> None:
client = mock.Mock(engine_client.EngineClient)
client.get_processor.return_value = quantum.QuantumProcessor(
@mock.patch('cirq_google.engine.engine_client.EngineClient.get_processor_async')
def test_get_sampler_loads_processor_with_default_device_configuration(get_processor) -> None:
get_processor.return_value = quantum.QuantumProcessor(
default_device_config_key=quantum.DeviceConfigKey(run="run", config_alias="config_alias")
)

client = engine_client.EngineClient()
processor = cg.EngineProcessor('a', 'p', FakeEngineContext(client=client))
sampler = processor.get_sampler()

Expand Down
6 changes: 5 additions & 1 deletion dev_tools/requirements/dev-np2.env.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
-r ../../cirq-google/requirements.txt
-r ../../cirq-core/cirq/contrib/requirements.txt

-r deps/dev-tools.txt
# pytest-minimal.env.txt without cirq-all-no-contrib.txt ---------------------

-r deps/pytest.txt
-r deps/ipython.txt
-r deps/pylint.txt

# own rules ------------------------------------------------------------------

Expand Down

0 comments on commit ab62c25

Please sign in to comment.