Added keyword args to MockFactory.pin

And a few other last minute fixes
This commit is contained in:
Dave Jones
2016-10-23 15:29:55 +01:00
parent 2ecc25f995
commit 945bea4e54
8 changed files with 75 additions and 21 deletions

View File

@@ -171,9 +171,7 @@ def test_input_light_sensor():
reason='timing is too random on pypy')
def test_input_distance_sensor():
echo_pin = Device._pin_factory.pin(4)
trig_pin = Device._pin_factory.pin(5, pin_class=MockTriggerPin)
trig_pin.echo_pin = echo_pin
trig_pin.echo_time = 0.02
trig_pin = Device._pin_factory.pin(5, pin_class=MockTriggerPin, echo_pin=echo_pin, echo_time=0.02)
with pytest.raises(ValueError):
DistanceSensor(echo_pin, trig_pin, max_distance=-1)
# normal queue len is large (because the sensor is *really* jittery) but