예제 #1
0
 def __init__(self, file_path, handle_style_error):
     self._file_path = file_path
     self._handle_style_error = handle_style_error
     self._handle_style_error.turn_off_line_filtering()
     self._tab_checker = TabChecker(file_path, handle_style_error)
     self._output_regex = re.compile('Line:(?P<line>\d+)\s*(?P<message>.+)')
     # Determining the port of this expectations.
     try:
         port_name = self._file_path.split(os.sep)[-2]
         if port_name == "chromium":
             options = ChromiumOptions()
             self._port_obj = port.get(port_name=None, options=options)
         else:
             self._port_obj = port.get(port_name=port_name)
     except:
         # Using 'test' port when we couldn't determine the port for this
         # expectations.
         _log.warn("Could not determine the port for %s. "
                   "Using 'test' port, but platform-specific expectations "
                   "will fail the check." % self._file_path)
         self._port_obj = port.get('test')
     # Suppress error messages of test_expectations module since they will be
     # reported later.
     log = logging.getLogger("webkitpy.layout_tests.layout_package."
                             "test_expectations")
     log.setLevel(logging.CRITICAL)
    def assert_tab(self, input_lines, error_lines):
        """Assert when the given lines contain tabs."""
        self._error_lines = []

        def style_error_handler(line_number, category, confidence, message):
            self.assertEqual(category, 'whitespace/tab')
            self.assertEqual(confidence, 5)
            self.assertEqual(message, 'Line contains tab character.')
            self._error_lines.append(line_number)

        checker = TabChecker('', style_error_handler)
        checker.check(input_lines)
        self.assertEquals(self._error_lines, error_lines)
예제 #3
0
    def __init__(self, file_path, handle_style_error, host=None):
        self._file_path = file_path
        self._handle_style_error = handle_style_error
        self._tab_checker = TabChecker(file_path, handle_style_error)

        # FIXME: host should be a required parameter, not an optional one.
        host = host or Host()
        host.initialize_scm()

        self._port_obj = self._determine_port_from_expectations_path(host, file_path)

        # Suppress error messages of test_expectations module since they will be reported later.
        log = logging.getLogger("webkitpy.layout_tests.layout_package.test_expectations")
        log.setLevel(logging.CRITICAL)
예제 #4
0
    def __init__(self, file_path, handle_style_error, host=None):
        self._file_path = file_path
        self._handle_style_error = handle_style_error
        self._handle_style_error.turn_off_line_filtering()
        self._tab_checker = TabChecker(file_path, handle_style_error)
        self._output_regex = re.compile('.*(TestExpectations|test_expectations.txt):(?P<line>\d+)\s*(?P<message>.+)')

        # FIXME: host should be a required parameter, not an optional one.
        host = host or Host()
        host._initialize_scm()

        self._port_obj = self._determine_port_from_expectations_path(host, file_path)

        # Suppress error messages of test_expectations module since they will be reported later.
        log = logging.getLogger("webkitpy.layout_tests.layout_package.test_expectations")
        log.setLevel(logging.CRITICAL)
예제 #5
0
 def __init__(self, file_path, handle_style_error):
     self._handle_style_error = handle_style_error
     self._tab_checker = TabChecker(file_path, handle_style_error)
예제 #6
0
 def __init__(self, file_path, handle_style_error, should_line_be_checked):
     self.file_path = file_path
     self.handle_style_error = handle_style_error
     self.should_line_be_checked = should_line_be_checked
     self._tab_checker = TabChecker(file_path, handle_style_error)
예제 #7
0
 def __init__(self, file_path, handle_style_error):
     self._handle_style_error = handle_style_error
     self._tab_checker = TabChecker(file_path, handle_style_error)
     self._single_quote_checker = SingleQuoteChecker(
         file_path, handle_style_error)