コード例 #1
0
    def get_testcase_path(self):
        """Get the testcase path."""
        android.adb_shell('rm -rf %s' % ANDROID_TESTCASE_DIR)
        android_testcase_dir = '%s/%s' % (ANDROID_TESTCASE_DIR,
                                          self.testcase.id)

        testcase_relative_path = os.path.relpath(
            self.testcase.get_testcase_path(), self.testcase.testcase_dir_path)
        android.adb('push %s %s' %
                    (self.testcase.testcase_dir_path, android_testcase_dir))

        return '%s/%s' % (android_testcase_dir, testcase_relative_path)
コード例 #2
0
def set_device_id_if_possible():
    """Get the device ID if there's only one."""
    if os.environ.get(ANDROID_SERIAL_ENV):
        return

    _, output = android.adb('devices')
    device_lines = output.strip().splitlines()[1:]

    if len(device_lines) == 1:
        os.environ[ANDROID_SERIAL_ENV] = re.split(r'\s+', device_lines[0])[0]