From 54f14a88af703ae2c62de064465fa12de7f5ce81 Mon Sep 17 00:00:00 2001 From: Robert Wolterman Date: Sun, 3 Jul 2016 12:01:58 -0500 Subject: [PATCH] Some fixes for the py.test modules. There are still errors and the softpwm stuff is still segfaulting --- test/test_gpio_output.py | 1 + test/test_gpio_setup.py | 7 +++++-- test/test_softpwm_setup.py | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/test/test_gpio_output.py b/test/test_gpio_output.py index 06de607..e9b31ed 100644 --- a/test/test_gpio_output.py +++ b/test/test_gpio_output.py @@ -25,6 +25,7 @@ class TestGPIOOutput: GPIO.setup("CSID6", GPIO.OUT) direction = GPIO.gpio_function("CSID6") assert direction == GPIO.OUT + def test_output_greater_than_one(self): GPIO.setup("CSID6", GPIO.OUT) GPIO.output("CSID6", 2) diff --git a/test/test_gpio_setup.py b/test/test_gpio_setup.py index a6bd848..4dd1385 100644 --- a/test/test_gpio_setup.py +++ b/test/test_gpio_setup.py @@ -67,6 +67,9 @@ class TestSetup: def test_setup_expanded_gpio(self): 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() - assert not os.path.exists('/sys/class/gpio/gpio409') + assert not os.path.exists(gfile) + diff --git a/test/test_softpwm_setup.py b/test/test_softpwm_setup.py index e2a9284..3de6595 100644 --- a/test/test_softpwm_setup.py +++ b/test/test_softpwm_setup.py @@ -9,8 +9,10 @@ def teardown_module(module): class TestSoftpwmSetup: def test_start_pwm(self): PWM.start("XIO-P7", 50, 10) - assert os.path.exists('/sys/class/gpio/gpio415') - direction = open('/sys/class/gpio/gpio415/direction').read() + base = GPIO.get_gpio_base() + 7 + gfile = '/sys/class/gpio/gpio%d' % base + assert os.path.exists(base) + direction = open(base + '/direction').read() assert direction == 'out\n' PWM.cleanup()