示例#1
0
文件: core.py 项目: thylong/cabu
 def __del__(self):
     if hasattr(self, 'ftp') and self.ftp:  # pragma: no cover
         self.ftp.close()
     if hasattr(self, 'webdriver') and self.webdriver:
         unload_driver(self.webdriver)
     if hasattr(self, 'vdisplay') and self.vdisplay:
         unload_vdisplay(self.vdisplay)
示例#2
0
文件: core.py 项目: thylong/cabu
 def __exit__(self, *args, **kwargs):  # pragma: no cover
     if hasattr(self, 'ftp'):
         self.ftp.close()
     if hasattr(self, 'webdriver'):
         unload_driver(self.webdriver)
     if hasattr(self, 'vdisplay'):
         unload_vdisplay(self.vdisplay)
     super(Cabu, self).__exit__(*args, **kwargs)
示例#3
0
 def test_unload_driver_fail(self, mock_driver):
     driver = load_driver(self.config)
     mock_driver.assert_called_once_with(self.config)
     driver.close = Mock()
     driver.close.side_effect = Exception("Boom !")
     unload_driver(driver)
示例#4
0
 def test_load_driver(self, mock_driver):
     driver = load_driver(self.config)
     mock_driver.assert_called_once_with(self.config)
     unload_driver(driver)