Skip to content

Commit

Permalink
revert proto changes to simplify PR
Browse files Browse the repository at this point in the history
  • Loading branch information
martha-johnston committed May 29, 2024
1 parent 30a4313 commit a592b2c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tests/mocks/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ async def set_rpm(
timeout: Optional[float] = None,
**kwargs,
):
self.powered = rpm != 0
self.powered = True
self.extra = extra
self.timeout = timeout

Expand Down
20 changes: 11 additions & 9 deletions tests/test_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,12 @@ async def test_go_to(self, motor: MockMotor):
async def test_set_rpm(self, motor: MockMotor):
await motor.set_rpm(30, timeout=4.56)
assert motor.timeout == loose_approx(4.56)
moving, pwr = await motor.is_powered()
moving = await motor.is_moving()
assert moving is True
assert pwr > 0

await motor.set_rpm(-10)
moving, pwr = await motor.is_powered()
await motor.set_rpm(-30)
moving = await motor.is_moving()
assert moving is True
assert pwr < 0

@pytest.mark.asyncio
async def test_reset_zero(self, motor: MockMotor):
Expand Down Expand Up @@ -226,12 +224,14 @@ async def test_set_rpm(self, motor: MockMotor, service: MotorRPCService):

request = SetRPMRequest(name=motor.name, rpm=30)
await client.SetRPM(request, timeout=4.56)
assert motor.power > 0
moving = await motor.is_moving()
assert moving is True
assert motor.timeout == loose_approx(4.56)

request = SetRPMRequest(name=motor.name, rpm=-10)
await client.SetRPM(request)
assert motor.power < 0
moving = await motor.is_moving()
assert moving is True

@pytest.mark.asyncio
async def test_reset_zero(self, motor: MockMotor, service: MotorRPCService):
Expand Down Expand Up @@ -374,11 +374,13 @@ async def test_set_rpm(self, motor: MockMotor, service: MotorRPCService):
client = MotorClient(motor.name, channel)

await client.set_rpm(30, timeout=4.56)
assert motor.power > 0
moving = await motor.is_moving()
assert motor.timeout == loose_approx(4.56)
assert moving is True

await client.set_rpm(-10)
assert motor.power < 0
moving = await motor.is_moving()
assert moving is True

@pytest.mark.asyncio
async def test_reset_zero(self, motor: MockMotor, service: MotorRPCService):
Expand Down

0 comments on commit a592b2c

Please sign in to comment.