mirror of
https://github.com/xtacocorex/CHIP_IO
synced 2025-07-20 12:53:22 +00:00
Some fixes for the py.test modules. There are still errors and the softpwm stuff is still segfaulting
This commit is contained in:
@ -25,6 +25,7 @@ class TestGPIOOutput:
|
|||||||
GPIO.setup("CSID6", GPIO.OUT)
|
GPIO.setup("CSID6", GPIO.OUT)
|
||||||
direction = GPIO.gpio_function("CSID6")
|
direction = GPIO.gpio_function("CSID6")
|
||||||
assert direction == GPIO.OUT
|
assert direction == GPIO.OUT
|
||||||
|
|
||||||
def test_output_greater_than_one(self):
|
def test_output_greater_than_one(self):
|
||||||
GPIO.setup("CSID6", GPIO.OUT)
|
GPIO.setup("CSID6", GPIO.OUT)
|
||||||
GPIO.output("CSID6", 2)
|
GPIO.output("CSID6", 2)
|
||||||
|
@ -67,6 +67,9 @@ class TestSetup:
|
|||||||
|
|
||||||
def test_setup_expanded_gpio(self):
|
def test_setup_expanded_gpio(self):
|
||||||
GPIO.setup("XIO-P1", GPIO.OUT)
|
GPIO.setup("XIO-P1", GPIO.OUT)
|
||||||
assert os.path.exists('/sys/class/gpio/gpio409')
|
base = GPIO.get_gpio_base() + 1
|
||||||
|
gfile = '/sys/class/gpio/gpio%d' % base
|
||||||
|
assert os.path.exists(gfile)
|
||||||
GPIO.cleanup()
|
GPIO.cleanup()
|
||||||
assert not os.path.exists('/sys/class/gpio/gpio409')
|
assert not os.path.exists(gfile)
|
||||||
|
|
||||||
|
@ -9,8 +9,10 @@ def teardown_module(module):
|
|||||||
class TestSoftpwmSetup:
|
class TestSoftpwmSetup:
|
||||||
def test_start_pwm(self):
|
def test_start_pwm(self):
|
||||||
PWM.start("XIO-P7", 50, 10)
|
PWM.start("XIO-P7", 50, 10)
|
||||||
assert os.path.exists('/sys/class/gpio/gpio415')
|
base = GPIO.get_gpio_base() + 7
|
||||||
direction = open('/sys/class/gpio/gpio415/direction').read()
|
gfile = '/sys/class/gpio/gpio%d' % base
|
||||||
|
assert os.path.exists(base)
|
||||||
|
direction = open(base + '/direction').read()
|
||||||
assert direction == 'out\n'
|
assert direction == 'out\n'
|
||||||
PWM.cleanup()
|
PWM.cleanup()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user