for _ in range(20)) self.peripheral = Peripheral(peripheral) def test_rssi(self): self.peripheral.start(self.adv_name) self.central.start(self.adv_name) rssi = self.central.rssi_q.get(timeout=2) logger.info("conn_handle: %d rssi: %d", rssi["conn_handle"], rssi["rssi"]) self.assertTrue(rssi["rssi"] < 0) self.assertEqual(self.central.conn_handle, rssi["conn_handle"]) self.central.stop() def tearDown(self): self.central.adapter.close() self.peripheral.adapter.close() def test_suite(): return unittest.TestLoader().loadTestsFromName(__name__) if __name__ == "__main__": logging.basicConfig( level=Settings.current().log_level, format="%(asctime)s [%(thread)d/%(threadName)s] %(message)s", ) unittest.main(argv=Settings.clean_args())
import unittest import logging from driver_setup import Settings import test_driver_open_close def test_suite(): suite = unittest.TestSuite() suite.addTest(test_driver_open_close.test_suite()) return suite if __name__ == '__main__': logging.basicConfig(level=Settings.current().log_level) unittest.main(defaultTest='test_suite', argv=Settings.clean_args())