Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(820)

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/style/checker_unittest.py

Issue 2373063002: Clean up most style warnings in webkitpy/style/checker_unittest.py. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Tools/Scripts/webkitpy/style/checker_unittest.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/checker_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/checker_unittest.py
index de55c11beaa2d0618c6e2657530f35d91a413cb5..aed58032196226b06d1ae224a190c1a986452c1d 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/style/checker_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/checker_unittest.py
@@ -37,32 +37,29 @@ import logging
import os
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.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):
@@ -74,6 +71,8 @@ class ConfigureLoggingTestBase(unittest.TestCase):
is_verbose: The is_verbose value to pass to configure_logging().
"""
+ is_verbose = False
qyearsley 2016/09/27 17:15:31 Adding this line adds a default value for self.is_
+
def setUp(self):
is_verbose = self.is_verbose
@@ -194,30 +193,30 @@ class GlobalVariablesTest(unittest.TestCase):
config = FilterConfiguration(path_specific=PATH_RULES_SPECIFIER)
- def assertCheck(path, category):
+ def assert_check(path, category):
"""Assert that the given category should be checked."""
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."""
message = ('Should not check category "%s" for path "%s".'
% (category, path))
self.assertFalse(config.should_check(category, path), message)
- assertCheck("random_path.cpp",
+ assert_check("random_path.cpp",
"build/include")
- assertCheck("random_path.cpp",
+ assert_check("random_path.cpp",
"readability/naming")
- assertNoCheck("Source/core/css/CSSParser-in.cpp",
+ assert_no_check("Source/core/css/CSSParser-in.cpp",
"readability/naming")
# Third-party Python code: webkitpy/thirdparty
path = "Tools/Scripts/webkitpy/thirdparty/mock.py"
- assertNoCheck(path, "build/include")
- assertNoCheck(path, "pep8/E401") # A random pep8 category.
- assertCheck(path, "pep8/W191")
- assertCheck(path, "pep8/W291")
- assertCheck(path, "whitespace/carriage_return")
+ assert_no_check(path, "build/include")
+ assert_no_check(path, "pep8/E401") # A random pep8 category.
+ assert_check(path, "pep8/W191")
+ assert_check(path, "pep8/W291")
+ assert_check(path, "whitespace/carriage_return")
qyearsley 2016/09/27 17:15:31 These helper function names are changed to fit the
def test_max_reports_per_category(self):
"""Check that _MAX_REPORTS_PER_CATEGORY is valid."""
@@ -523,8 +522,7 @@ class StyleProcessorConfigurationTest(unittest.TestCase):
"""Tests the StyleProcessorConfiguration class."""
def setUp(self):
- self._error_messages = []
- """The messages written to _mock_stderr_write() of this class."""
+ self._error_messages = [] # The messages written to _mock_stderr_write() of this class.
def _mock_stderr_write(self, message):
self._error_messages.append(message)
@@ -641,6 +639,7 @@ class StyleProcessor_CodeCoverageTest(LoggingTestCase):
self.file_path = file_path
self.min_confidence = min_confidence
self.style_error_handler = style_error_handler
+ self.lines = None
qyearsley 2016/09/27 17:15:31 (This line is added so that attributes are all def
def check(self, lines):
self.lines = lines
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698