Commit e8cbec24 authored by qyearsley's avatar qyearsley Committed by Commit bot

Clean up most style warnings in webkitpy/style/checker_unittest.py.

BUG=643937

Review-Url: https://codereview.chromium.org/2373063002
Cr-Commit-Position: refs/heads/master@{#421308}
parent ca8d34b4
...@@ -37,32 +37,29 @@ import logging ...@@ -37,32 +37,29 @@ import logging
import os import os
import unittest import unittest
import checker as style
from webkitpy.common.system.logtesting import LogTesting
from webkitpy.common.system.logtesting import TestLogStream
from checker import _BASE_FILTER_RULES
from checker import _MAX_REPORTS_PER_CATEGORY
from checker import _PATH_RULES_SPECIFIER as PATH_RULES_SPECIFIER
from checker import _all_categories
from checker import check_webkit_style_configuration
from checker import check_webkit_style_parser
from checker import configure_logging
from checker import CheckerDispatcher
from checker import ProcessorBase
from checker import StyleProcessor
from checker import StyleProcessorConfiguration
from checkers.cpp import CppChecker
from checkers.jsonchecker import JSONChecker
from checkers.python import PythonChecker
from checkers.text import TextChecker
from checkers.xml import XMLChecker
from error_handlers import DefaultStyleErrorHandler
from filter import validate_filter_rules
from filter import FilterConfiguration
from optparser import ArgumentParser
from optparser import CommandOptionValues
from webkitpy.common.system.logtesting import LoggingTestCase from webkitpy.common.system.logtesting import LoggingTestCase
from webkitpy.style.filereader import TextFileReader from webkitpy.common.system.logtesting import TestLogStream
from webkitpy.style import checker as style
from webkitpy.style.checker import _all_categories
from webkitpy.style.checker import _BASE_FILTER_RULES
from webkitpy.style.checker import _MAX_REPORTS_PER_CATEGORY
from webkitpy.style.checker import _PATH_RULES_SPECIFIER as PATH_RULES_SPECIFIER
from webkitpy.style.checker import check_webkit_style_configuration
from webkitpy.style.checker import check_webkit_style_parser
from webkitpy.style.checker import CheckerDispatcher
from webkitpy.style.checker import configure_logging
from webkitpy.style.checker import StyleProcessor
from webkitpy.style.checker import StyleProcessorConfiguration
from webkitpy.style.checkers.cpp import CppChecker
from webkitpy.style.checkers.jsonchecker import JSONChecker
from webkitpy.style.checkers.python import PythonChecker
from webkitpy.style.checkers.text import TextChecker
from webkitpy.style.checkers.xml import XMLChecker
from webkitpy.style.error_handlers import DefaultStyleErrorHandler
from webkitpy.style.filter import FilterConfiguration
from webkitpy.style.filter import validate_filter_rules
from webkitpy.style.optparser import ArgumentParser
from webkitpy.style.optparser import CommandOptionValues
class ConfigureLoggingTestBase(unittest.TestCase): class ConfigureLoggingTestBase(unittest.TestCase):
...@@ -74,6 +71,8 @@ class ConfigureLoggingTestBase(unittest.TestCase): ...@@ -74,6 +71,8 @@ class ConfigureLoggingTestBase(unittest.TestCase):
is_verbose: The is_verbose value to pass to configure_logging(). is_verbose: The is_verbose value to pass to configure_logging().
""" """
is_verbose = False
def setUp(self): def setUp(self):
is_verbose = self.is_verbose is_verbose = self.is_verbose
...@@ -194,30 +193,30 @@ class GlobalVariablesTest(unittest.TestCase): ...@@ -194,30 +193,30 @@ class GlobalVariablesTest(unittest.TestCase):
config = FilterConfiguration(path_specific=PATH_RULES_SPECIFIER) config = FilterConfiguration(path_specific=PATH_RULES_SPECIFIER)
def assertCheck(path, category): def assert_check(path, category):
"""Assert that the given category should be checked.""" """Assert that the given category should be checked."""
self.assertTrue(config.should_check(category, path)) self.assertTrue(config.should_check(category, path))
def assertNoCheck(path, category): def assert_no_check(path, category):
"""Assert that the given category should not be checked.""" """Assert that the given category should not be checked."""
message = ('Should not check category "%s" for path "%s".' message = ('Should not check category "%s" for path "%s".'
% (category, path)) % (category, path))
self.assertFalse(config.should_check(category, path), message) self.assertFalse(config.should_check(category, path), message)
assertCheck("random_path.cpp", assert_check("random_path.cpp",
"build/include") "build/include")
assertCheck("random_path.cpp", assert_check("random_path.cpp",
"readability/naming") "readability/naming")
assertNoCheck("Source/core/css/CSSParser-in.cpp", assert_no_check("Source/core/css/CSSParser-in.cpp",
"readability/naming") "readability/naming")
# Third-party Python code: webkitpy/thirdparty # Third-party Python code: webkitpy/thirdparty
path = "Tools/Scripts/webkitpy/thirdparty/mock.py" path = "Tools/Scripts/webkitpy/thirdparty/mock.py"
assertNoCheck(path, "build/include") assert_no_check(path, "build/include")
assertNoCheck(path, "pep8/E401") # A random pep8 category. assert_no_check(path, "pep8/E401") # A random pep8 category.
assertCheck(path, "pep8/W191") assert_check(path, "pep8/W191")
assertCheck(path, "pep8/W291") assert_check(path, "pep8/W291")
assertCheck(path, "whitespace/carriage_return") assert_check(path, "whitespace/carriage_return")
def test_max_reports_per_category(self): def test_max_reports_per_category(self):
"""Check that _MAX_REPORTS_PER_CATEGORY is valid.""" """Check that _MAX_REPORTS_PER_CATEGORY is valid."""
...@@ -523,8 +522,7 @@ class StyleProcessorConfigurationTest(unittest.TestCase): ...@@ -523,8 +522,7 @@ class StyleProcessorConfigurationTest(unittest.TestCase):
"""Tests the StyleProcessorConfiguration class.""" """Tests the StyleProcessorConfiguration class."""
def setUp(self): def setUp(self):
self._error_messages = [] self._error_messages = [] # The messages written to _mock_stderr_write() of this class.
"""The messages written to _mock_stderr_write() of this class."""
def _mock_stderr_write(self, message): def _mock_stderr_write(self, message):
self._error_messages.append(message) self._error_messages.append(message)
...@@ -641,6 +639,7 @@ class StyleProcessor_CodeCoverageTest(LoggingTestCase): ...@@ -641,6 +639,7 @@ class StyleProcessor_CodeCoverageTest(LoggingTestCase):
self.file_path = file_path self.file_path = file_path
self.min_confidence = min_confidence self.min_confidence = min_confidence
self.style_error_handler = style_error_handler self.style_error_handler = style_error_handler
self.lines = None
def check(self, lines): def check(self, lines):
self.lines = lines self.lines = lines
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment