def test3_0_pin(self): """ Pin >3_0> init dry-run pin """ test1_file = "%s/packaged/etc/raspigpioctrl/pin1.cfg" % PREFIX pin1 = SlavePin(self.opt, test1_file) gpio_sys = "%s/packaged/sys/class/gpio/" % PREFIX if os.path.exists("%s/packaged/sys" % PREFIX): print os.system("rm -rf %s/packaged/sys" % PREFIX) pin1.deb("'%s' removed") self.assertFalse(os.path.exists(gpio_sys), "") pin1.init_pin() filed = open("%s/gpio1/value" % gpio_sys, "r") cont = filed.read().strip() self.assertTrue(cont == "0", cont)
def test3_4_flip(self): """ Pin >3_4> init dry-run pin and flip twice with main-pin """ test1_file = "%s/packaged/etc/raspigpioctrl/pin1.cfg" % PREFIX pin1 = SlavePin(self.opt, test1_file) test5_file = "%s/packaged/etc/raspigpioctrl/main5.cfg" % PREFIX pin5 = MainPin(self.opt, test5_file) gpio_sys = "%s/packaged/sys/class/gpio/" % PREFIX if os.path.exists("%s/packaged/sys" % PREFIX): print os.system("rm -rf %s/packaged/sys" % PREFIX) pin1.deb("'%s' removed") self.assertFalse(os.path.exists(gpio_sys), "") pin1.init_pin() pin5.init_pin() pin1.set_pin(0) pin5.set_pin(0) pin5.change_mode('auto') pin1.flip() filed = open("%s/gpio1/value" % gpio_sys, "r") cont = filed.read().strip() filed.close() self.assertTrue(cont == "1", cont)