Skip to content

Commit 1f754e1

Browse files
committed
Avoid clashing test mocks of QuantumEngineServiceClient
Restrict mocking to the relevant test module only. Fixes quantumlib#5870.
1 parent 490017a commit 1f754e1

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

cirq-google/cirq_google/engine/engine_job_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from cirq_google.engine.test_utils import uses_async_mock
2929

3030

31-
@pytest.fixture(scope='session', autouse=True)
31+
@pytest.fixture(scope='module', autouse=True)
3232
def mock_grpc_client():
3333
with mock.patch(
3434
'cirq_google.engine.engine_client.quantum.QuantumEngineServiceClient'

cirq-google/cirq_google/engine/engine_processor_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def _to_timestamp(json_string):
207207
)
208208

209209

210-
@pytest.fixture(scope='session', autouse=True)
210+
@pytest.fixture(scope='module', autouse=True)
211211
def mock_grpc_client():
212212
with mock.patch(
213213
'cirq_google.engine.engine_client.quantum.QuantumEngineServiceClient'

cirq-google/cirq_google/engine/engine_program_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ def test_get_batch_size(get_program_async):
479479
_ = program.batch_size()
480480

481481

482-
@pytest.fixture(scope='session', autouse=True)
482+
@pytest.fixture(scope='module', autouse=True)
483483
def mock_grpc_client():
484484
with mock.patch(
485485
'cirq_google.engine.engine_client.quantum.QuantumEngineServiceClient'

cirq-google/cirq_google/engine/engine_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def test_make_random_id():
276276
assert random_id != random_id2
277277

278278

279-
@pytest.fixture(scope='session', autouse=True)
279+
@pytest.fixture(scope='module', autouse=True)
280280
def mock_grpc_client_async():
281281
with mock.patch(
282282
'cirq_google.engine.engine_client.quantum.QuantumEngineServiceAsyncClient', autospec=True

0 commit comments

Comments
 (0)