本文整理汇总了Python中mozdevice.DeviceManagerADB.dirExists方法的典型用法代码示例。如果您正苦于以下问题:Python DeviceManagerADB.dirExists方法的具体用法?Python DeviceManagerADB.dirExists怎么用?Python DeviceManagerADB.dirExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mozdevice.DeviceManagerADB
的用法示例。
在下文中一共展示了DeviceManagerADB.dirExists方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_marionette_exists
# 需要导入模块: from mozdevice import DeviceManagerADB [as 别名]
# 或者: from mozdevice.DeviceManagerADB import dirExists [as 别名]
def check_marionette_exists(adb="adb"):
dm = DeviceManagerADB(adbPath=adb)
if dm.dirExists(INSTALL_DIR):
return True
else:
dm.forward("tcp:2828", "tcp:2828")
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(('localhost', 2828))
data = sock.recv(16)
sock.close()
if 'root' in data:
return True
except socket.error:
return False
return False
示例2: DeviceManagerADBTestCase
# 需要导入模块: from mozdevice import DeviceManagerADB [as 别名]
# 或者: from mozdevice.DeviceManagerADB import dirExists [as 别名]
class DeviceManagerADBTestCase(unittest.TestCase):
tempLocalDir = "tempDir"
tempLocalFile = os.path.join(tempLocalDir, "tempfile.txt")
tempRemoteDir = None
tempRemoteFile = None
tempRemoteSystemFile = None
def setUp(self):
self.assertTrue(find_mount_permissions(self.dm, "/system"), "ro")
self.assertTrue(os.path.exists(self.tempLocalDir))
self.assertTrue(os.path.exists(self.tempLocalFile))
if self.dm.fileExists(self.tempRemoteFile):
self.dm.removeFile(self.tempRemoteFile)
self.assertFalse(self.dm.fileExists(self.tempRemoteFile))
if self.dm.fileExists(self.tempRemoteSystemFile):
self.dm.removeFile(self.tempRemoteSystemFile)
self.assertTrue(self.dm.dirExists(self.tempRemoteDir))
@classmethod
def setUpClass(self):
self.dm = DeviceManagerADB()
if not os.path.exists(self.tempLocalDir):
os.mkdir(self.tempLocalDir)
if not os.path.exists(self.tempLocalFile):
# Create empty file
open(self.tempLocalFile, 'w').close()
self.tempRemoteDir = self.dm.getTempDir()
self.tempRemoteFile = os.path.join(self.tempRemoteDir,
os.path.basename(self.tempLocalFile))
self.tempRemoteSystemFile = \
os.path.join("/system", os.path.basename(self.tempLocalFile))
@classmethod
def tearDownClass(self):
os.remove(self.tempLocalFile)
os.rmdir(self.tempLocalDir)
if self.dm.dirExists(self.tempRemoteDir):
# self.tempRemoteFile will get deleted with it
self.dm.removeDir(self.tempRemoteDir)
if self.dm.fileExists(self.tempRemoteSystemFile):
self.dm.removeFile(self.tempRemoteSystemFile)
示例3: DeviceManagerADBTestCase
# 需要导入模块: from mozdevice import DeviceManagerADB [as 别名]
# 或者: from mozdevice.DeviceManagerADB import dirExists [as 别名]
class DeviceManagerADBTestCase(unittest.TestCase):
tempLocalDir = "tempDir"
tempLocalFile = os.path.join(tempLocalDir, "tempfile.txt")
tempRemoteDir = None
tempRemoteFile = None
def setUp(self):
self.dm = DeviceManagerADB()
if not os.path.exists(self.tempLocalDir):
os.mkdir(self.tempLocalDir)
if not os.path.exists(self.tempLocalFile):
# Create empty file
open(self.tempLocalFile, 'w').close()
self.tempRemoteDir = self.dm.getTempDir()
self.tempRemoteFile = os.path.join(self.tempRemoteDir,
os.path.basename(self.tempLocalFile))
def tearDown(self):
os.remove(self.tempLocalFile)
os.rmdir(self.tempLocalDir)
if self.dm.dirExists(self.tempRemoteDir):
self.dm.removeDir(self.tempRemoteDir)
示例4: uninstall
# 需要导入模块: from mozdevice import DeviceManagerADB [as 别名]
# 或者: from mozdevice.DeviceManagerADB import dirExists [as 别名]
def uninstall(adb="adb"):
dm = DeviceManagerADB(adbPath=adb)
dm.remount()
if dm.dirExists(INSTALL_DIR):
dm.removeDir(INSTALL_DIR)