def test_100_network_start_stop_singleton(self):
     self.wipTest()
     self.driver_ready = False
     self.driver_removed = False
     self.options = ZWaveOptionSingleton(device=self.device,
                                         user_path=self.userpath)
     self.options.set_log_file("OZW_Log.log")
     self.options.set_append_log_file(False)
     self.options.set_console_output(False)
     self.options.set_save_log_level("Debug")
     self.options.set_logging(True)
     self.options.lock()
     dispatcher.connect(self.driver_ready_message,
                        ZWaveNetwork.SIGNAL_DRIVER_READY)
     dispatcher.connect(self.driver_removed_message,
                        ZWaveNetwork.SIGNAL_DRIVER_REMOVED)
     self.network = ZWaveNetworkSingleton(self.options)
     for i in range(0, SLEEP):
         if self.network.state >= self.network.STATE_AWAKED:
             break
         else:
             time.sleep(1.0)
     self.assertTrue(self.driver_ready)
     network2 = ZWaveNetworkSingleton(self.options, autostart=False)
     self.assertIs(self.network, network2)
     self.network.stop()
     for i in range(0, SLEEP):
         if self.network.state == self.network.STATE_STOPPED:
             break
         else:
             time.sleep(1.0)
     self.assertEqual(self.network.state, self.network.STATE_STOPPED)
示例#2
0
 def test_905_network_singleton(self):
     self.skipPython3()
     self.touchFile('ttyUSBO_fake')
     self.options = ZWaveOptionSingleton(device='ttyUSBO_fake', user_path=self.userpath)
     self.options.set_log_file("OZW_Log.log")
     self.options.set_append_log_file(False)
     self.options.set_console_output(False)
     self.options.set_save_log_level("Debug")
     self.options.set_logging(True)
     self.options.lock()
     options2 = ZWaveOptionSingleton(device='ttyUSBO_fake', user_path=self.userpath)
     self.assertIs(self.options, options2)
     self.network = ZWaveNetworkSingleton(self.options, autostart=False)
     network2 = ZWaveNetworkSingleton(self.options, autostart=False)
     self.assertIs(self.network, network2)
     self.rmFile('ttyUSBO_fake')