當前位置: 首頁>>代碼示例>>Python>>正文


Python logger.info方法代碼示例

本文整理匯總了Python中robot.api.logger.info方法的典型用法代碼示例。如果您正苦於以下問題:Python logger.info方法的具體用法?Python logger.info怎麽用?Python logger.info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在robot.api.logger的用法示例。


在下文中一共展示了logger.info方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from robot.api import logger [as 別名]
# 或者: from robot.api.logger import info [as 別名]
def __init__(self, server: str, user: str, password: str, run_id: str, protocol: str = 'http',
                 juggler_disable: str = None, update: str = None) -> None:
        """Listener initialization.

        *Args:*\n
            _server_ - name of TestRail server;\n
            _user_ - name of TestRail user;\n
            _password_ - password of TestRail user;\n
            _run_id_ - ID of the test run;\n
            _protocol_ - connecting protocol to TestRail server: http or https;\n
            _juggler_disable_ - indicator to disable juggler logic; if exist, then juggler logic will be disabled;\n
            _update_ - indicator to update test case in TestRail; if exist, then test will be updated.
        """
        testrail_url = '{protocol}://{server}/testrail/'.format(protocol=protocol, server=server)
        self._url = testrail_url + 'index.php?/api/v2/'
        self._user = user
        self._password = password
        self.run_id = run_id
        self.juggler_disable = juggler_disable
        self.update = update
        self.tr_client = TestRailAPIClient(server, user, password, run_id, protocol)
        self._vars_for_report_link: Optional[Dict[str, str]] = None
        logger.info('[TestRailListener] url: {testrail_url}'.format(testrail_url=testrail_url))
        logger.info('[TestRailListener] user: {user}'.format(user=user))
        logger.info('[TestRailListener] the ID of the test run: {run_id}'.format(run_id=run_id)) 
開發者ID:peterservice-rnd,項目名稱:robotframework-testrail,代碼行數:27,代碼來源:TestRailListener.py

示例2: _update_case_description

# 需要導入模塊: from robot.api import logger [as 別名]
# 或者: from robot.api.logger import info [as 別名]
def _update_case_description(self, attributes: JsonDict, case_id: str, name: str,
                                 references: Optional[str]) -> None:
        """ Update test case description in TestRail

        *Args:* \n
            _attributes_ - attributes of test case in Robot Framework;\n
            _case_id_ - case id;\n
            _name_ - test case name;\n
            _references_ - test references.
        """
        logger.info(f"[TestRailListener] update of test {case_id} in TestRail")
        description = f"{attributes['doc']}\nPath to test: {attributes['longname']}"
        request_fields: Dict[str, Union[str, int, None]] = {
            'title': name, 'type_id': self.TESTRAIL_CASE_TYPE_ID_AUTOMATED,
            'custom_case_description': description, 'refs': references}
        try:
            json_result = self.tr_client.update_case(case_id, request_fields)
            result = json.dumps(json_result, sort_keys=True, indent=4)
            logger.info(f"[TestRailListener] result for method update_case: {result}")
        except requests.HTTPError as error:
            logger.error(f"[TestRailListener] http error, while execute request:\n{error}") 
開發者ID:peterservice-rnd,項目名稱:robotframework-testrail,代碼行數:23,代碼來源:TestRailListener.py

示例3: page_should_contain_string

# 需要導入模塊: from robot.api import logger [as 別名]
# 或者: from robot.api.logger import info [as 別名]
def page_should_contain_string(self, txt, ignore_case=False, error_message=None):
        """Search if a given string exists on the mainframe screen.

           The search is case sensitive, if you want ignore this you can pass the argument: ignore_case=${True}
           and you can edit the raise exception message with error_message.

           Example:
               | Page Should Contain String | something |
               | Page Should Contain String | someTHING | ignore_case=${True} |
               | Page Should Contain String | something | error_message=New error message |
        """
        message = 'The string "' + txt + '" was not found'
        if error_message: message = error_message
        if ignore_case: txt = str(txt).lower()
        result = self._search_string(txt, ignore_case)
        if not result: raise Exception(message)
        logger.info('The string "' + txt + '" was found') 
開發者ID:Altran-PT-GDC,項目名稱:Robot-Framework-Mainframe-3270-Library,代碼行數:19,代碼來源:x3270.py

示例4: page_should_contain_string_x_times

# 需要導入模塊: from robot.api import logger [as 別名]
# 或者: from robot.api.logger import info [as 別名]
def page_should_contain_string_x_times(self, txt, number, ignore_case=False, error_message=None):
        """Search if the entered string appears the desired number of times on the mainframe screen.

        The search is case sensitive, if you want ignore this you can pass the argument: ignore_case=${True} and you
        can edit the raise exception message with error_message.

        Example:
               | Page Should Contain String X Times | something | 3 |
               | Page Should Contain String X Times | someTHING | 3 | ignore_case=${True} |
               | Page Should Contain String X Times | something | 3 | error_message=New error message |
        """
        message = error_message
        number = int(number)
        all_screen = self._read_all_screen()
        if ignore_case:
            txt = str(txt).lower()
            all_screen = str(all_screen).lower()
        number_of_times = all_screen.count(txt)
        if number_of_times != number:
            if message is None:
                message = 'The string "' + txt + '" was not found "' + str(number) + '" times, it appears "' \
                          + str(number_of_times) + '" times'
            raise Exception(message)
        logger.info('The string "' + txt + '" was found "' + str(number) + '" times') 
開發者ID:Altran-PT-GDC,項目名稱:Robot-Framework-Mainframe-3270-Library,代碼行數:26,代碼來源:x3270.py

示例5: take_a_screenshot

# 需要導入模塊: from robot.api import logger [as 別名]
# 或者: from robot.api.logger import info [as 別名]
def take_a_screenshot(self):
        '''Takes a screenshot of the screen.

        This keyword is run on failure if it is not overwritten when
        `importing` the library.

        Screenshots are saved to the current working directory or in the
        ``screenshot_folder`` if such is defined during `importing`.

        The file name for the screenshot is the current suite name with a
        running integer appended. If this keyword is used outside of Robot
        Framework execution, file name is this library's name with running
        integer appended.
        '''
        target_dir = self.screenshot_folder if self.screenshot_folder else ''
        if not isinstance(target_dir, str):
            raise ScreenshotFolderException('Screenshot folder is invalid: '
                                            '"%s"' % target_dir)
        path = self._make_up_filename()
        path = abspath(path_join(target_dir, path))
        LOGGER.info('Screenshot taken: {0}<br/><img src="{0}" '
                    'width="100%" />'.format(path), html=True)
        ag.screenshot(path) 
開發者ID:eficode,項目名稱:robotframework-imagehorizonlibrary,代碼行數:25,代碼來源:_screenshot.py

示例6: _click_to_the_direction_of

# 需要導入模塊: from robot.api import logger [as 別名]
# 或者: from robot.api.logger import info [as 別名]
def _click_to_the_direction_of(self, direction, location, offset,
                                   clicks, button, interval):
        x, y = self._get_location(direction, location, offset)
        try:
            clicks = int(clicks)
        except ValueError:
            raise MouseException('Invalid argument "%s" for `clicks`')
        if button not in ['left', 'middle', 'right']:
            raise MouseException('Invalid button "%s" for `button`')
        try:
            interval = float(interval)
        except ValueError:
            raise MouseException('Invalid argument "%s" for `interval`')

        LOGGER.info('Clicking %d time(s) at (%d, %d) with '
                    '%s mouse button at interval %f' % (clicks, x, y,
                                                        button, interval))
        ag.click(x, y, clicks=clicks, button=button, interval=interval) 
開發者ID:eficode,項目名稱:robotframework-imagehorizonlibrary,代碼行數:20,代碼來源:__init__.py

示例7: take_desktop_screenshot

# 需要導入模塊: from robot.api import logger [as 別名]
# 或者: from robot.api.logger import info [as 別名]
def take_desktop_screenshot(self):
        """Takes a screenshot of the whole desktop and inserts screenshot link to log file.

        Returns path to the screenshot file.
        """
        filepath = self._get_screenshot_path("whitelib_screenshot_{index}.png")
        directory = os.path.dirname(filepath)
        if not os.path.exists(directory):
            os.makedirs(directory)
        logger.info(get_link_path(filepath, self._log_directory))
        logger.info(
            '</td></tr><tr><td colspan="3">'
            '<a href="{src}"><img src="{src}" width="800px"></a>'.format(
                src=get_link_path(filepath, self._log_directory)
            ),
            html=True,
        )
        bmp = Desktop.CaptureScreenshot()
        bmp.Save(filepath, ImageFormat.Png)
        return filepath 
開發者ID:Omenia,項目名稱:robotframework-whitelibrary,代碼行數:22,代碼來源:screenshot.py

示例8: start_virtual_display

# 需要導入模塊: from robot.api import logger [as 別名]
# 或者: from robot.api.logger import info [as 別名]
def start_virtual_display(self, width=1440, height=900,
                              colordepth=24, **kwargs):
        """Starts virtual display which will be
         destroyed after test execution will be end

        *Arguments:*
        - width: a width to be set in pixels
        - height: a height to be set in pixels
        - color_depth: a color depth to be used
        - kwargs: extra parameters

        *Example:*

        | Start Virtual Display |
        | Start Virtual Display | 1920 | 1080 |
        | Start Virtual Display | ${1920} | ${1080} | ${16} |
        """
        if self._display is None:
            logger.info("Using virtual display: '{0}x{1}x{2}'".format(
                        width, height, colordepth))

            self._display = Xvfb(int(width), int(height),
                                 int(colordepth), **kwargs)
            self._display.start()
            atexit.register(self._display.stop) 
開發者ID:drobota,項目名稱:robotframework-xvfb,代碼行數:27,代碼來源:__init__.py

示例9: log_json

# 需要導入模塊: from robot.api import logger [as 別名]
# 或者: from robot.api.logger import info [as 別名]
def log_json(json, header="", also_console=True, sort_keys=False):
        json = dumps(
            json,
            ensure_ascii=False,
            indent=4,
            separators=(",", ": "),
            sort_keys=sort_keys,
        )
        logger.info("{}\n{}".format(header, json))  # no coloring for log.html
        if also_console:
            json_data = highlight(
                json, lexers.JsonLexer(), formatters.TerminalFormatter()
            )
            logger.console("{}\n{}".format(header, json_data), newline=False)
        return json 
開發者ID:asyrjasalo,項目名稱:RESTinstance,代碼行數:17,代碼來源:__init__.py

示例10: log_page_object_keywords

# 需要導入模塊: from robot.api import logger [as 別名]
# 或者: from robot.api.logger import info [as 別名]
def log_page_object_keywords(self):
        """Logs page objects and their keywords for all page objects
           which have been imported into the current suite.
        """
        for key in sorted(self.registry.keys()):
            pobj = self.registry[key]
            keywords = get_keyword_names(pobj)
            logger.info("{}: {}".format(key, ", ".join(keywords))) 
開發者ID:SFDO-Tooling,項目名稱:CumulusCI,代碼行數:10,代碼來源:PageObjects.py

示例11: _make_up_filename

# 需要導入模塊: from robot.api import logger [as 別名]
# 或者: from robot.api.logger import info [as 別名]
def _make_up_filename(self):
        try:
            path = BuiltIn().get_variable_value('${SUITE NAME}')
            path = '%s-screenshot' % path.replace(' ', '')
        except RobotNotRunningError:
            LOGGER.info('Could not get suite name, using '
                        'default naming scheme')
            path = 'ImageHorizon-screenshot'
        path = '%s-%d.png' % (path, self.screenshot_counter)
        self.screenshot_counter += 1
        return path 
開發者ID:eficode,項目名稱:robotframework-imagehorizonlibrary,代碼行數:13,代碼來源:_screenshot.py

示例12: click_image

# 需要導入模塊: from robot.api import logger [as 別名]
# 或者: from robot.api.logger import info [as 別名]
def click_image(self, reference_image):
        '''Finds the reference image on screen and clicks it once.

        ``reference_image`` is automatically normalized as described in the
        `Reference image names`.
        '''
        center_location = self.locate(reference_image)
        LOGGER.info('Clicking image "%s" in position %s' % (reference_image,
                                                            center_location))
        ag.click(center_location)
        return center_location 
開發者ID:eficode,項目名稱:robotframework-imagehorizonlibrary,代碼行數:13,代碼來源:_recognize_images.py

示例13: wait_for

# 需要導入模塊: from robot.api import logger [as 別名]
# 或者: from robot.api.logger import info [as 別名]
def wait_for(self, reference_image, timeout=10):
        '''Tries to locate given image from the screen for given time.

        Fail if the image is not found on the screen after ``timeout`` has
        expired.

        See `Reference image names` for documentation for ``reference_image``.

        ``timeout`` is given in seconds.

        Returns Python tuple ``(x, y)`` of the coordinates.
        '''
        stop_time = time() + int(timeout)
        location = None
        with self._suppress_keyword_on_failure():
            while time() < stop_time:
                try:
                    location = self._locate(reference_image, log_it=False)
                    break
                except ImageNotFoundException:
                    pass
        if location is None:
            self._run_on_failure()
            raise ImageNotFoundException(self.__normalize(reference_image))
        LOGGER.info('Image "%s" found at %r' % (reference_image, location))
        return location 
開發者ID:eficode,項目名稱:robotframework-imagehorizonlibrary,代碼行數:28,代碼來源:_recognize_images.py

示例14: _info

# 需要導入模塊: from robot.api import logger [as 別名]
# 或者: from robot.api.logger import info [as 別名]
def _info(self, message):
        if self._log_level in self.LOG_LEVEL_INFO:
            logger.info(message) 
開發者ID:serhatbolsu,項目名稱:robotframework-appiumlibrary,代碼行數:5,代碼來源:_logging.py

示例15: _html

# 需要導入模塊: from robot.api import logger [as 別名]
# 或者: from robot.api.logger import info [as 別名]
def _html(self, message):
        if self._log_level in self.LOG_LEVEL_INFO:
            logger.info(message, True, False) 
開發者ID:serhatbolsu,項目名稱:robotframework-appiumlibrary,代碼行數:5,代碼來源:_logging.py


注:本文中的robot.api.logger.info方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。