Skip to content

Commit f23f87f

Browse files
authored
RSDK-11346 - fix loose_approx (#954)
1 parent 8e21ac8 commit f23f87f

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

tests/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33

44
def loose_approx(val):
5-
return pytest.approx(val, rel=val * 1e-2)
5+
return pytest.approx(val, rel=1e-2)

tests/test_camera.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ async def test_get_image(self, camera: MockCamera, service: CameraRPCService, im
140140

141141
# Test known mime type
142142
request = GetImageRequest(name="camera", mime_type=CameraMimeType.PNG)
143-
response: GetImageResponse = await client.GetImage(request, timeout=18.2)
143+
response: GetImageResponse = await client.GetImage(request, timeout=18.1)
144144
assert response.image == image.data
145-
assert camera.timeout == loose_approx(18.2)
145+
assert camera.timeout == loose_approx(18.1)
146146

147147
# Test empty mime type. Empty mime type should default to response mime type
148148
request = GetImageRequest(name="camera")
@@ -156,12 +156,12 @@ async def test_get_images(self, camera: MockCamera, service: CameraRPCService, m
156156
client = CameraServiceStub(channel)
157157

158158
request = GetImagesRequest(name="camera")
159-
response: GetImagesResponse = await client.GetImages(request, timeout=18.2)
159+
response: GetImagesResponse = await client.GetImages(request, timeout=18.1)
160160
raw_img = response.images[0]
161161
assert raw_img.format == Format.FORMAT_PNG
162162
assert raw_img.source_name == camera.name
163163
assert response.response_metadata == metadata
164-
assert camera.timeout == loose_approx(18.2)
164+
assert camera.timeout == loose_approx(18.1)
165165

166166
async def test_render_frame(self, camera: MockCamera, service: CameraRPCService, image: ViamImage):
167167
assert camera.timeout is None

tests/test_gantry.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,18 @@ async def test_move_to_position(self):
103103
async with ChannelFor([self.service]) as channel:
104104
client = GantryServiceStub(channel)
105105
request = MoveToPositionRequest(name=self.gantry.name, positions_mm=[1, 8, 2], speeds_mm_per_sec=[3, 9, 12])
106-
await client.MoveToPosition(request, timeout=18.2)
106+
await client.MoveToPosition(request, timeout=18.1)
107107
assert self.gantry.position == [1, 8, 2]
108108
assert self.gantry.speeds == [3, 9, 12]
109-
assert self.gantry.timeout == loose_approx(18.2)
109+
assert self.gantry.timeout == loose_approx(18.1)
110110

111111
async def test_home(self):
112112
async with ChannelFor([self.service]) as channel:
113113
client = GantryServiceStub(channel)
114114
request = HomeRequest(name=self.gantry.name)
115-
response: HomeResponse = await client.Home(request, timeout=18.2)
115+
response: HomeResponse = await client.Home(request, timeout=18.1)
116116
assert response.homed is True
117-
assert self.gantry.timeout == loose_approx(18.2)
117+
assert self.gantry.timeout == loose_approx(18.1)
118118

119119
async def test_get_lengths(self):
120120
async with ChannelFor([self.service]) as channel:

0 commit comments

Comments
 (0)