def __init__(self, testname, testdescription=''): super(TestSerialMuxer, self).__init__(testname) self.timeout = 1 self.gpio19 = gpiolib.QGpio(19) self.gpio22 = gpiolib.QGpio(22) # Overwrite test description if testdescription: self._testMethodDoc = testdescription
def test_board_id(self): """ Test Board ID : Check for board identification pins. Type: Functional Description: Just read the board identification pins and check if they are correctly. GPIOS 135 134 133 Value 1 0 0 """ self.failUnless( gpiolib.QGpio(135).get_value() == 1, "failed: Invalid value for gpio 135 (should be 1)") self.failUnless( gpiolib.QGpio(134).get_value() == 0, "failed: Invalid value for gpio 134 (should be 0)") self.failUnless( gpiolib.QGpio(133).get_value() == 0, "failed: Invalid value for gpio 133 (should be 0)")
def setUp(self): self.port_enable = gpiolib.QGpio(137) self.port_enable.set_value(1) time.sleep(1) self.port.flushInput() self.port.flushOutput()
def setUp(self): self.port_enable = gpiolib.QGpio(137) self.port_enable.set_value(0) # a small delay to be sure port switched time.sleep(1)
'test_loopback', 138, 158, 'Test GPIOs : Loopback, between gpio 138 (in) and gpio 158 (out)')) suite.addTest( TestGpio( 'test_loopback', 137, 162, 'Test GPIOs : Loopback, between gpio 137 (in) and gpio 162 (out)')) suite.addTest( TestSysfs( 'test_sysfs_entry', '/sys/bus/spi/devices/spi1.0/input', testdescription='Test TSC2046: Check for TOUCH controller at spi1.0' )) return suite # The main program just runs the test suite in verbose mode if __name__ == '__main__': # Setup test environment, these gpios should be inverted gpiolib.QGpio(139).set_active_low(1) # By default run using the dbmysql runner. suite = dbmysql.dbmysqlTestRunner(verbosity=2) # retval = unittest.TestResult() retval = suite.run(testsuite_SLNK0010()) # retval = unittest.TextTestRunner(verbosity=2).run(testsuite_SLNK0010()) # return 0 if all is ok, otherwise return the number of failures + errors sys.exit(len(retval.failures) + len(retval.errors))