mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
Added keyword args to MockFactory.pin
And a few other last minute fixes
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -85,15 +85,13 @@ def pins(request, pin_factory):
|
||||
# Why return both pins in a single fixture? If we defined one fixture for
|
||||
# each pin then pytest will (correctly) test RPiGPIOPin(22) against
|
||||
# NativePin(27) and so on. This isn't supported, so we don't test it
|
||||
if pin_factory.__class__.__name__ == 'MockFactory':
|
||||
test_pin = pin_factory.pin(TEST_PIN, pin_class=MockConnectedPin)
|
||||
else:
|
||||
test_pin = pin_factory.pin(TEST_PIN)
|
||||
input_pin = pin_factory.pin(INPUT_PIN)
|
||||
input_pin.function = 'input'
|
||||
input_pin.pull = 'down'
|
||||
if pin_factory.__class__.__name__ == 'MockFactory':
|
||||
test_pin.input_pin = input_pin
|
||||
test_pin = pin_factory.pin(TEST_PIN, pin_class=MockConnectedPin, input_pin=input_pin)
|
||||
else:
|
||||
test_pin = pin_factory.pin(TEST_PIN)
|
||||
def fin():
|
||||
test_pin.close()
|
||||
input_pin.close()
|
||||
|
||||
Reference in New Issue
Block a user