Skip to content

Commit

Permalink
test: Mock only service call in AHS device initialization (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
yitchen-tim committed Feb 7, 2024
1 parent 2af722e commit 863b492
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions test/unit_tests/test_ahs_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import json
from dataclasses import dataclass
from functools import partial
from unittest import mock
from unittest.mock import Mock

import numpy as np
Expand Down Expand Up @@ -233,9 +232,9 @@ class MockDevProperties:
def mock_aws_device(monkeypatch, wires=3):
"""A function to create a mock device that mocks most of the methods"""
with monkeypatch.context() as m:
m.setattr(AwsDevice, "__init__", lambda self, *args, **kwargs: None)
m.setattr(AwsDevice, "aws_session", MockAwsSession)
m.setattr(AwsDevice, "type", mock.PropertyMock)
m.setattr(
AwsDevice, "_get_session_and_initialize", lambda self, *args, **kwargs: MockAwsSession
)
m.setattr(AwsDevice, "properties", MockDevProperties)

def get_aws_device(
Expand Down

0 comments on commit 863b492

Please sign in to comment.