def test_add_event_detect(): GPIO_DEVEL.Reset() GPIO.setmode(GPIO.BCM) with pytest.raises(ValueError) as e: GPIO.add_event_detect(16, 47) assert "edge must be set" in str(e.value) with pytest.raises(TypeError) as e: GPIO.add_event_detect(16, GPIO.FALLING, "foo") assert "Parameter must be callable" in str(e.value) # Bouncetime > 0 with pytest.raises(ValueError) as e: GPIO.add_event_detect(16, GPIO.RISING, bouncetime=-1) assert "Bouncetime must be" in str(e.value) GPIO_DEVEL.setdebuginfo(True) GPIO.add_event_detect(16, GPIO.FALLING, foo, 1) time.sleep(0.01) GPIO.add_event_detect(17, GPIO.FALLING, bouncetime=1) time.sleep(0.1) GPIO.remove_event_detect(17) time.sleep(0.1) GPIO.add_event_detect(17, GPIO.FALLING, bouncetime=1) GPIO_DEVEL.Reset()
def test_setdebuginfo(): GPIO_DEVEL.Reset() # Off by default assert GPIO_DEVEL.State_Access().debuginfo == False GPIO_DEVEL.setdebuginfo(True) assert GPIO_DEVEL.State_Access().debuginfo == True