Пример #1
0
 def tearDown(self):
     self.adb.device = u''
     self.adb.kill_server()
     with ignored(OSError):
         os.remove(self.bugreport_f)
     with ignored(OSError):
         os.remove(self.logcat_f)
     with ignored(OSError):
         os.remove(self.logcatv_f)
Пример #2
0
 def test_pull_folder2folder(self):
     file_list = self.adb.pull(self.pullfolder_success, self.pullremote_srcfolder)
     self.assertTrue(file_list)
     list((self.assertTrue(os.path.basename(x) in self.files_in_pullfolder_success) for x in file_list))
     for file_ in file_list:
         with ignored(OSError):
             os.remove(file_)
Пример #3
0
 def test_pull_file2folder(self):
     file_list = self.adb.pull(self.pullfile_success, self.pullremote_srcfolder)
     self.assertTrue(file_list)
     target_file_path = os.path.join(tempfile.gettempdir(), u'build.prop')
     self.assertEqual(os.path.abspath(file_list[0]), target_file_path)
     with ignored(OSError):
         os.remove(target_file_path)
Пример #4
0
    def test_push(self):
        with ignored(OSError, WindowsError):
            os.makedirs(self.pushfolder_nofileinfolder)
            os.makedirs(self.pushfolder_withfileinfolder)
        f_in_folder = os.path.join(self.pushfolder_withfileinfolder, 'temp')
        with open(f_in_folder, 'wb') as tempf:
            tempf.write(b'test')
        with open(self.pushfile_success, 'wb') as tempf:
            tempf.write(b'test')

        self.adb.push(self.pushfolder_nofileinfolder, self.dstfolder_successfolder)
        self.adb.push(self.pushfolder_withfileinfolder, self.dstfolder_successfolder)
        with self.assertRaises(AdbFailException):
            self.adb.push(self.pushfolder_withfileinfolder, self.dstfolder_permissiondeny)
        self.adb.push(self.pushfile_success, self.dstfile_successfile)
        with self.assertRaises(AdbFailException):
            self.adb.push(self.pushfile_success, self.dstfolder_permissiondeny)

        pushfolderfile_in_dst = posixpath.join(self.dstfolder_successfolder, os.path.basename(f_in_folder))
        self.adb.shell('rm -rf {}'.format(pushfolderfile_in_dst))
        self.adb.shell('rm -rf {}'.format(self.dstfile_successfile))
        os.remove(f_in_folder)
        os.rmdir(self.pushfolder_nofileinfolder)
        os.rmdir(self.pushfolder_withfileinfolder)
Пример #5
0
 def test_pull_file2file(self):
     file_list = self.adb.pull(self.pullfile_success, self.pullremote_srcfile)
     self.assertTrue(file_list)
     self.assertEqual(os.path.abspath(file_list[0]), self.pullremote_srcfile)
     with ignored(OSError):
         os.remove(self.pullremote_srcfile)