diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-22 09:09:45 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-22 09:10:13 +0100 |
commit | 470286ecfe79d59df14944e5b5d34630fc739391 (patch) | |
tree | 43983212872e06cebefd2ae474418fa2908ca54c /Tools/Scripts/webkitpy | |
parent | 23037105e948c2065da5a937d3a2396b0ff45c1e (diff) | |
download | qtwebkit-470286ecfe79d59df14944e5b5d34630fc739391.tar.gz |
Imported WebKit commit e89504fa9195b2063b2530961d4b73dd08de3242 (http://svn.webkit.org/repository/webkit/trunk@135485)
Change-Id: I03774e5ac79721c13ffa30d152537a74d0b12e66
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Tools/Scripts/webkitpy')
138 files changed, 1449 insertions, 1439 deletions
diff --git a/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py b/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py index 9591744d1..fa2339f45 100644 --- a/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py +++ b/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py @@ -181,7 +181,7 @@ class ChangeLogTest(unittest.TestCase): ''' - self.assertEquals(56988, parse_bug_id_from_changelog(commit_text)) + self.assertEqual(56988, parse_bug_id_from_changelog(commit_text)) commit_text = ''' 2011-03-23 Ojan Vafai <ojan@chromium.org> @@ -194,7 +194,7 @@ class ChangeLogTest(unittest.TestCase): ''' - self.assertEquals(12345, parse_bug_id_from_changelog(commit_text)) + self.assertEqual(12345, parse_bug_id_from_changelog(commit_text)) commit_text = ''' 2011-03-31 Adam Roben <aroben@apple.com> @@ -213,7 +213,7 @@ class ChangeLogTest(unittest.TestCase): ''' - self.assertEquals(57569, parse_bug_id_from_changelog(commit_text)) + self.assertEqual(57569, parse_bug_id_from_changelog(commit_text)) commit_text = ''' 2011-03-29 Timothy Hatcher <timothy@apple.com> @@ -230,24 +230,24 @@ class ChangeLogTest(unittest.TestCase): extract-localizable-strings does not complain about unbalanced single quotes. ''' - self.assertEquals(57354, parse_bug_id_from_changelog(commit_text)) + self.assertEqual(57354, parse_bug_id_from_changelog(commit_text)) def test_parse_log_entries_from_changelog(self): changelog_file = StringIO(self._example_changelog) parsed_entries = list(ChangeLog.parse_entries_from_file(changelog_file)) - self.assertEquals(len(parsed_entries), 9) - self.assertEquals(parsed_entries[0].reviewer_text(), "David Levin") - self.assertEquals(parsed_entries[1].author_email(), "ddkilzer@apple.com") - self.assertEquals(parsed_entries[2].reviewer_text(), "Mark Rowe") - self.assertEquals(parsed_entries[2].touched_files(), ["DumpRenderTree/mac/DumpRenderTreeWindow.mm"]) - self.assertEquals(parsed_entries[3].author_name(), "Benjamin Poulain") - self.assertEquals(parsed_entries[3].touched_files(), ["platform/cf/KURLCFNet.cpp", "platform/mac/KURLMac.mm", + self.assertEqual(len(parsed_entries), 9) + self.assertEqual(parsed_entries[0].reviewer_text(), "David Levin") + self.assertEqual(parsed_entries[1].author_email(), "ddkilzer@apple.com") + self.assertEqual(parsed_entries[2].reviewer_text(), "Mark Rowe") + self.assertEqual(parsed_entries[2].touched_files(), ["DumpRenderTree/mac/DumpRenderTreeWindow.mm"]) + self.assertEqual(parsed_entries[3].author_name(), "Benjamin Poulain") + self.assertEqual(parsed_entries[3].touched_files(), ["platform/cf/KURLCFNet.cpp", "platform/mac/KURLMac.mm", "WebCoreSupport/ChromeClientEfl.cpp", "ewk/ewk_private.h", "ewk/ewk_view.cpp"]) - self.assertEquals(parsed_entries[4].reviewer_text(), "David Hyatt") - self.assertEquals(parsed_entries[5].reviewer_text(), "Adam Roben") - self.assertEquals(parsed_entries[6].reviewer_text(), "Tony Chang") - self.assertEquals(parsed_entries[7].reviewer_text(), None) - self.assertEquals(parsed_entries[8].reviewer_text(), 'Darin Adler') + self.assertEqual(parsed_entries[4].reviewer_text(), "David Hyatt") + self.assertEqual(parsed_entries[5].reviewer_text(), "Adam Roben") + self.assertEqual(parsed_entries[6].reviewer_text(), "Tony Chang") + self.assertEqual(parsed_entries[7].reviewer_text(), None) + self.assertEqual(parsed_entries[8].reviewer_text(), 'Darin Adler') def test_parse_log_entries_from_annotated_file(self): # Note that there are trailing spaces on some of the lines intentionally. @@ -285,28 +285,28 @@ class ChangeLogTest(unittest.TestCase): u"99187 andreas.kling@nokia.com \n") parsed_entries = list(ChangeLog.parse_entries_from_file(changelog_file)) - self.assertEquals(parsed_entries[0].revision(), 100000) - self.assertEquals(parsed_entries[0].reviewer_text(), "Zoltan Herczeg") - self.assertEquals(parsed_entries[0].author_name(), u"Csaba Osztrogon\u00e1c") - self.assertEquals(parsed_entries[0].author_email(), "ossy@webkit.org") - self.assertEquals(parsed_entries[1].revision(), 93798) - self.assertEquals(parsed_entries[1].author_name(), "Alexey Proskuryakov") - self.assertEquals(parsed_entries[2].revision(), 99190) - self.assertEquals(parsed_entries[2].author_name(), "Andreas Kling") - self.assertEquals(parsed_entries[3].revision(), 99187) - self.assertEquals(parsed_entries[3].author_name(), "Andreas Kling") + self.assertEqual(parsed_entries[0].revision(), 100000) + self.assertEqual(parsed_entries[0].reviewer_text(), "Zoltan Herczeg") + self.assertEqual(parsed_entries[0].author_name(), u"Csaba Osztrogon\u00e1c") + self.assertEqual(parsed_entries[0].author_email(), "ossy@webkit.org") + self.assertEqual(parsed_entries[1].revision(), 93798) + self.assertEqual(parsed_entries[1].author_name(), "Alexey Proskuryakov") + self.assertEqual(parsed_entries[2].revision(), 99190) + self.assertEqual(parsed_entries[2].author_name(), "Andreas Kling") + self.assertEqual(parsed_entries[3].revision(), 99187) + self.assertEqual(parsed_entries[3].author_name(), "Andreas Kling") def _assert_parse_reviewer_text_and_list(self, text, expected_reviewer_text, expected_reviewer_text_list=None): reviewer_text, reviewer_text_list = ChangeLogEntry._parse_reviewer_text(text) - self.assertEquals(reviewer_text, expected_reviewer_text) + self.assertEqual(reviewer_text, expected_reviewer_text) if expected_reviewer_text_list: - self.assertEquals(reviewer_text_list, expected_reviewer_text_list) + self.assertEqual(reviewer_text_list, expected_reviewer_text_list) else: - self.assertEquals(reviewer_text_list, [expected_reviewer_text]) + self.assertEqual(reviewer_text_list, [expected_reviewer_text]) def _assert_parse_reviewer_text_list(self, text, expected_reviewer_text_list): reviewer_text, reviewer_text_list = ChangeLogEntry._parse_reviewer_text(text) - self.assertEquals(reviewer_text_list, expected_reviewer_text_list) + self.assertEqual(reviewer_text_list, expected_reviewer_text_list) def test_parse_reviewer_text(self): self._assert_parse_reviewer_text_and_list(' reviewed by Ryosuke Niwa, Oliver Hunt, and Dimitri Glazkov', @@ -388,8 +388,8 @@ class ChangeLogTest(unittest.TestCase): def _assert_fuzzy_reviewer_match(self, reviewer_text, expected_text_list, expected_contributors): unused, reviewer_text_list = ChangeLogEntry._parse_reviewer_text(reviewer_text) - self.assertEquals(reviewer_text_list, expected_text_list) - self.assertEquals(self._entry_with_reviewer(reviewer_text).reviewers(), self._contributors(expected_contributors)) + self.assertEqual(reviewer_text_list, expected_text_list) + self.assertEqual(self._entry_with_reviewer(reviewer_text).reviewers(), self._contributors(expected_contributors)) def test_fuzzy_reviewer_match__none(self): self._assert_fuzzy_reviewer_match('Reviewed by BUILD FIX', ['BUILD FIX'], []) @@ -427,7 +427,7 @@ class ChangeLogTest(unittest.TestCase): def _assert_parse_authors(self, author_text, expected_contributors): parsed_authors = [(author['name'], author['email']) for author in self._entry_with_author(author_text).authors()] - self.assertEquals(parsed_authors, expected_contributors) + self.assertEqual(parsed_authors, expected_contributors) def test_parse_authors(self): self._assert_parse_authors(u'Aaron Colwell <acolwell@chromium.org>', [(u'Aaron Colwell', u'acolwell@chromium.org')]) @@ -458,11 +458,11 @@ class ChangeLogTest(unittest.TestCase): changelog_contents = u"%s\n%s" % (self._example_entry, self._example_changelog) changelog_file = StringIO(changelog_contents) latest_entry = ChangeLog.parse_latest_entry_from_file(changelog_file) - self.assertEquals(latest_entry.contents(), self._example_entry) - self.assertEquals(latest_entry.author_name(), "Peter Kasting") - self.assertEquals(latest_entry.author_email(), "pkasting@google.com") - self.assertEquals(latest_entry.reviewer_text(), u"Tor Arne Vestb\xf8") - self.assertEquals(latest_entry.touched_files(), ["DumpRenderTree/win/DumpRenderTree.vcproj", "DumpRenderTree/win/ImageDiff.vcproj", "DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj"]) + self.assertEqual(latest_entry.contents(), self._example_entry) + self.assertEqual(latest_entry.author_name(), "Peter Kasting") + self.assertEqual(latest_entry.author_email(), "pkasting@google.com") + self.assertEqual(latest_entry.reviewer_text(), u"Tor Arne Vestb\xf8") + self.assertEqual(latest_entry.touched_files(), ["DumpRenderTree/win/DumpRenderTree.vcproj", "DumpRenderTree/win/ImageDiff.vcproj", "DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj"]) self.assertTrue(latest_entry.reviewer()) # Make sure that our UTF8-based lookup of Tor works. @@ -470,8 +470,8 @@ class ChangeLogTest(unittest.TestCase): changelog_contents = u"%s\n%s" % (self._example_entry, self._rolled_over_footer) changelog_file = StringIO(changelog_contents) latest_entry = ChangeLog.parse_latest_entry_from_file(changelog_file) - self.assertEquals(latest_entry.contents(), self._example_entry) - self.assertEquals(latest_entry.author_name(), "Peter Kasting") + self.assertEqual(latest_entry.contents(), self._example_entry) + self.assertEqual(latest_entry.author_name(), "Peter Kasting") @staticmethod def _write_tmp_file_with_contents(byte_array): @@ -543,14 +543,14 @@ class ChangeLogTest(unittest.TestCase): actual_contents = self._read_file_contents(changelog_path, "utf-8") expected_contents = changelog_contents.replace('NOBODY (OOPS!)', reviewer_name) os.remove(changelog_path) - self.assertEquals(actual_contents.splitlines(), expected_contents.splitlines()) + self.assertEqual(actual_contents.splitlines(), expected_contents.splitlines()) changelog_contents_without_reviewer_line = u"%s\n%s" % (self._new_entry_boilerplate_without_reviewer_line, self._example_changelog) changelog_path = self._write_tmp_file_with_contents(changelog_contents_without_reviewer_line.encode("utf-8")) ChangeLog(changelog_path).set_reviewer(reviewer_name) actual_contents = self._read_file_contents(changelog_path, "utf-8") os.remove(changelog_path) - self.assertEquals(actual_contents.splitlines(), expected_contents.splitlines()) + self.assertEqual(actual_contents.splitlines(), expected_contents.splitlines()) changelog_contents_without_reviewer_line = u"%s\n%s" % (self._new_entry_boilerplate_without_reviewer_multiple_bugurl, self._example_changelog) changelog_path = self._write_tmp_file_with_contents(changelog_contents_without_reviewer_line.encode("utf-8")) @@ -559,7 +559,7 @@ class ChangeLogTest(unittest.TestCase): changelog_contents = u"%s\n%s" % (self._new_entry_boilerplate_with_multiple_bugurl, self._example_changelog) expected_contents = changelog_contents.replace('NOBODY (OOPS!)', reviewer_name) os.remove(changelog_path) - self.assertEquals(actual_contents.splitlines(), expected_contents.splitlines()) + self.assertEqual(actual_contents.splitlines(), expected_contents.splitlines()) def test_set_short_description_and_bug_url(self): changelog_contents = u"%s\n%s" % (self._new_entry_boilerplate_with_bugurl, self._example_changelog) @@ -571,7 +571,7 @@ class ChangeLogTest(unittest.TestCase): expected_message = "%s\n %s" % (short_description, bug_url) expected_contents = changelog_contents.replace("Need a short description (OOPS!).", expected_message) os.remove(changelog_path) - self.assertEquals(actual_contents.splitlines(), expected_contents.splitlines()) + self.assertEqual(actual_contents.splitlines(), expected_contents.splitlines()) changelog_contents = u"%s\n%s" % (self._new_entry_boilerplate, self._example_changelog) changelog_path = self._write_tmp_file_with_contents(changelog_contents.encode("utf-8")) @@ -582,4 +582,4 @@ class ChangeLogTest(unittest.TestCase): expected_message = "%s\n %s" % (short_description, bug_url) expected_contents = changelog_contents.replace("Need a short description (OOPS!).\n Need the bug URL (OOPS!).", expected_message) os.remove(changelog_path) - self.assertEquals(actual_contents.splitlines(), expected_contents.splitlines()) + self.assertEqual(actual_contents.splitlines(), expected_contents.splitlines()) diff --git a/Tools/Scripts/webkitpy/common/checkout/diff_parser_unittest.py b/Tools/Scripts/webkitpy/common/checkout/diff_parser_unittest.py index d61a0989b..cba0f249e 100644 --- a/Tools/Scripts/webkitpy/common/checkout/diff_parser_unittest.py +++ b/Tools/Scripts/webkitpy/common/checkout/diff_parser_unittest.py @@ -36,44 +36,44 @@ class DiffParserTest(unittest.TestCase): def test_diff_parser(self, parser = None): if not parser: parser = diff_parser.DiffParser(DIFF_TEST_DATA.splitlines()) - self.assertEquals(3, len(parser.files)) + self.assertEqual(3, len(parser.files)) self.assertTrue('WebCore/rendering/style/StyleFlexibleBoxData.h' in parser.files) diff = parser.files['WebCore/rendering/style/StyleFlexibleBoxData.h'] - self.assertEquals(7, len(diff.lines)) + self.assertEqual(7, len(diff.lines)) # The first two unchaged lines. - self.assertEquals((47, 47), diff.lines[0][0:2]) - self.assertEquals('', diff.lines[0][2]) - self.assertEquals((48, 48), diff.lines[1][0:2]) - self.assertEquals(' unsigned align : 3; // EBoxAlignment', diff.lines[1][2]) + self.assertEqual((47, 47), diff.lines[0][0:2]) + self.assertEqual('', diff.lines[0][2]) + self.assertEqual((48, 48), diff.lines[1][0:2]) + self.assertEqual(' unsigned align : 3; // EBoxAlignment', diff.lines[1][2]) # The deleted line - self.assertEquals((50, 0), diff.lines[3][0:2]) - self.assertEquals(' unsigned orient: 1; // EBoxOrient', diff.lines[3][2]) + self.assertEqual((50, 0), diff.lines[3][0:2]) + self.assertEqual(' unsigned orient: 1; // EBoxOrient', diff.lines[3][2]) # The first file looks OK. Let's check the next, more complicated file. self.assertTrue('WebCore/rendering/style/StyleRareInheritedData.cpp' in parser.files) diff = parser.files['WebCore/rendering/style/StyleRareInheritedData.cpp'] # There are 3 chunks. - self.assertEquals(7 + 7 + 9, len(diff.lines)) + self.assertEqual(7 + 7 + 9, len(diff.lines)) # Around an added line. - self.assertEquals((60, 61), diff.lines[9][0:2]) - self.assertEquals((0, 62), diff.lines[10][0:2]) - self.assertEquals((61, 63), diff.lines[11][0:2]) + self.assertEqual((60, 61), diff.lines[9][0:2]) + self.assertEqual((0, 62), diff.lines[10][0:2]) + self.assertEqual((61, 63), diff.lines[11][0:2]) # Look through the last chunk, which contains both add's and delete's. - self.assertEquals((81, 83), diff.lines[14][0:2]) - self.assertEquals((82, 84), diff.lines[15][0:2]) - self.assertEquals((83, 85), diff.lines[16][0:2]) - self.assertEquals((84, 0), diff.lines[17][0:2]) - self.assertEquals((0, 86), diff.lines[18][0:2]) - self.assertEquals((0, 87), diff.lines[19][0:2]) - self.assertEquals((85, 88), diff.lines[20][0:2]) - self.assertEquals((86, 89), diff.lines[21][0:2]) - self.assertEquals((87, 90), diff.lines[22][0:2]) + self.assertEqual((81, 83), diff.lines[14][0:2]) + self.assertEqual((82, 84), diff.lines[15][0:2]) + self.assertEqual((83, 85), diff.lines[16][0:2]) + self.assertEqual((84, 0), diff.lines[17][0:2]) + self.assertEqual((0, 86), diff.lines[18][0:2]) + self.assertEqual((0, 87), diff.lines[19][0:2]) + self.assertEqual((85, 88), diff.lines[20][0:2]) + self.assertEqual((86, 89), diff.lines[21][0:2]) + self.assertEqual((87, 90), diff.lines[22][0:2]) # Check if a newly added file is correctly handled. diff = parser.files['LayoutTests/platform/mac/fast/flexbox/box-orient-button-expected.checksum'] - self.assertEquals(1, len(diff.lines)) - self.assertEquals((0, 1), diff.lines[0][0:2]) + self.assertEqual(1, len(diff.lines)) + self.assertEqual((0, 1), diff.lines[0][0:2]) def test_git_mnemonicprefix(self): p = re.compile(r' ([a|b])/') diff --git a/Tools/Scripts/webkitpy/common/checkout/scm/scm.py b/Tools/Scripts/webkitpy/common/checkout/scm/scm.py index 815e7501f..ee63b7130 100644 --- a/Tools/Scripts/webkitpy/common/checkout/scm/scm.py +++ b/Tools/Scripts/webkitpy/common/checkout/scm/scm.py @@ -137,7 +137,7 @@ class SCM: def in_working_directory(cls, path, executive=None): SCM._subclass_must_implement() - def find_checkout_root(path): + def find_checkout_root(self, path): SCM._subclass_must_implement() @staticmethod @@ -234,7 +234,7 @@ class SCM: def supports_local_commits(): SCM._subclass_must_implement() - def remote_merge_base(): + def remote_merge_base(self): SCM._subclass_must_implement() def commit_locally_with_message(self, message): diff --git a/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py b/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py index 9dd01e8d4..9c5d3af0d 100644 --- a/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py +++ b/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py @@ -26,6 +26,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +from webkitpy.common.checkout.scm import CommitMessage from webkitpy.common.system.filesystem_mock import MockFileSystem from webkitpy.common.system.executive_mock import MockExecutive diff --git a/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py b/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py index 802fe2cee..cff254e63 100644 --- a/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py +++ b/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py @@ -615,12 +615,12 @@ class SVNTest(SCMTest): self._setup_webkittools_scripts_symlink(self.scm) self.checkout.apply_patch(self._create_patch(one_line_overlap_patch)) expected_changelog_contents = "%s\n%s" % (self._set_date_and_reviewer(one_line_overlap_entry), changelog_contents) - self.assertEquals(read_from_path('ChangeLog'), expected_changelog_contents) + self.assertEqual(read_from_path('ChangeLog'), expected_changelog_contents) self.scm.revert_files(['ChangeLog']) self.checkout.apply_patch(self._create_patch(two_line_overlap_patch)) expected_changelog_contents = "%s\n%s" % (self._set_date_and_reviewer(two_line_overlap_entry), changelog_contents) - self.assertEquals(read_from_path('ChangeLog'), expected_changelog_contents) + self.assertEqual(read_from_path('ChangeLog'), expected_changelog_contents) def setUp(self): SVNTestRepository.setup(self) @@ -1192,7 +1192,7 @@ class GitSVNTest(SCMTest): def test_revisions_changing_files_with_local_commit(self): self._one_local_commit() - self.assertEquals(self.scm.revisions_changing_file('test_file_commit1'), []) + self.assertEqual(self.scm.revisions_changing_file('test_file_commit1'), []) def test_commit_with_message(self): self._one_local_commit_plus_working_copy_changes() @@ -1302,7 +1302,7 @@ class GitSVNTest(SCMTest): def test_upstream_branch(self): run_command(['git', 'checkout', '-t', '-b', 'my-branch']) run_command(['git', 'checkout', '-t', '-b', 'my-second-branch']) - self.assertEquals(self.scm._upstream_branch(), 'my-branch') + self.assertEqual(self.scm._upstream_branch(), 'my-branch') def test_remote_branch_ref(self): self.assertEqual(self.scm.remote_branch_ref(), 'refs/remotes/trunk') @@ -1353,7 +1353,7 @@ class GitSVNTest(SCMTest): os.remove('test_file_commit1') patch = scm.create_patch() patch_with_changed_files = scm.create_patch(changed_files=['test_file_commit1', 'test_file_commit2']) - self.assertEquals(patch, patch_with_changed_files) + self.assertEqual(patch, patch_with_changed_files) def test_create_patch_git_commit(self): self._two_local_commits() @@ -1597,7 +1597,7 @@ class GitTestWithMock(unittest.TestCase): OutputCapture().assert_outputs(self, scm.create_patch, expected_stderr=expected_stderr) def test_push_local_commits_to_server_with_username_and_password(self): - self.assertEquals(self.make_scm().push_local_commits_to_server(username='dbates@webkit.org', password='blah'), "MOCK output of child process") + self.assertEqual(self.make_scm().push_local_commits_to_server(username='dbates@webkit.org', password='blah'), "MOCK output of child process") def test_push_local_commits_to_server_without_username_and_password(self): self.assertRaises(AuthenticationError, self.make_scm().push_local_commits_to_server) diff --git a/Tools/Scripts/webkitpy/common/checkout/scm/svn.py b/Tools/Scripts/webkitpy/common/checkout/scm/svn.py index 25b7e3b47..112be057d 100644 --- a/Tools/Scripts/webkitpy/common/checkout/scm/svn.py +++ b/Tools/Scripts/webkitpy/common/checkout/scm/svn.py @@ -32,6 +32,7 @@ import os import re import shutil import sys +import tempfile from webkitpy.common.memoized import memoized from webkitpy.common.system.deprecated_logging import log @@ -46,6 +47,7 @@ _log = logging.getLogger(__name__) # A mixin class that represents common functionality for SVN and Git-SVN. class SVNRepository: def has_authorization_for_realm(self, realm, home_directory=os.getenv("HOME")): + # ignore false positives for methods implemented in the mixee class. pylint: disable-msg=E1101 # Assumes find and grep are installed. if not os.path.isdir(os.path.join(home_directory, ".subversion")): return False @@ -75,8 +77,7 @@ class SVN(SCM, SVNRepository): SCM.__init__(self, cwd, **kwargs) self._bogus_dir = None if patch_directories == []: - # FIXME: ScriptError is for Executive, this should probably be a normal Exception. - raise ScriptError(script_args=svn_info_args, message='Empty list of patch directories passed to SCM.__init__') + raise Exception(message='Empty list of patch directories passed to SCM.__init__') elif patch_directories == None: self._patch_directories = [self._filesystem.relpath(cwd, self.checkout_root)] else: diff --git a/Tools/Scripts/webkitpy/common/config/committers.py b/Tools/Scripts/webkitpy/common/config/committers.py index 36df3dbcc..ea92d9948 100644 --- a/Tools/Scripts/webkitpy/common/config/committers.py +++ b/Tools/Scripts/webkitpy/common/config/committers.py @@ -404,12 +404,13 @@ committers_unable_to_review = [ Committer("Victor Wang", "victorw@chromium.org", "victorw"), Committer("Victoria Kirst", ["vrk@chromium.org", "vrk@google.com"], "vrk"), Committer("Vincent Scheib", "scheib@chromium.org", "scheib"), + Committer("Vineet Chaudhary", "rgf748@motorola.com", "vineetc"), Committer("Vitaly Repeshko", "vitalyr@chromium.org"), Committer("William Siegrist", "wsiegrist@apple.com", "wms"), Committer("W. James MacLean", "wjmaclean@chromium.org", "seumas"), Committer("Xianzhu Wang", ["wangxianzhu@chromium.org", "phnixwxz@gmail.com", "wangxianzhu@google.com"], "wangxianzhu"), Committer("Xiaomei Ji", "xji@chromium.org", "xji"), - Committer("Yael Aharon", ["yael.aharon.m@gmail.com", "yael@webkit.org"], "yael"), + Committer("Yael Aharon", "yael@webkit.org", "yael"), Committer("Yaar Schnitman", ["yaar@chromium.org", "yaar@google.com"]), Committer("Yi Shen", ["yi.4.shen@nokia.com", "shenyi2006@gmail.com"]), Committer("Yongjun Zhang", ["yongjun.zhang@nokia.com", "yongjun_zhang@apple.com"]), @@ -444,7 +445,7 @@ reviewers_list = [ Reviewer("Alice Liu", "alice.liu@apple.com", "aliu"), Reviewer("Alp Toker", ["alp@nuanti.com", "alp@atoker.com", "alp@webkit.org"], "alp"), Reviewer("Anders Carlsson", ["andersca@apple.com", "acarlsson@apple.com"], "andersca"), - Reviewer("Andreas Kling", ["kling@webkit.org", "awesomekling@apple.com", "andreas.kling@nokia.com"], "kling"), + Reviewer("Andreas Kling", ["akling@apple.com", "kling@webkit.org", "awesomekling@apple.com", "andreas.kling@nokia.com"], "kling"), Reviewer("Andy Estes", "aestes@apple.com", "estes"), Reviewer("Antonio Gomes", ["tonikitoo@webkit.org", "agomes@rim.com"], "tonikitoo"), Reviewer("Antti Koivisto", ["koivisto@iki.fi", "antti@apple.com", "antti.j.koivisto@nokia.com"], "anttik"), @@ -523,7 +524,7 @@ reviewers_list = [ Reviewer("Mihai Parparita", "mihaip@chromium.org", "mihaip"), Reviewer("Nate Chapin", "japhet@chromium.org", ["japhet", "natechapin"]), Reviewer("Nikolas Zimmermann", ["zimmermann@kde.org", "zimmermann@physik.rwth-aachen.de", "zimmermann@webkit.org", "nzimmermann@rim.com"], "wildfox"), - Reviewer("Noam Rosenthal", "noam.rosenthal@nokia.com", "noamr"), + Reviewer("Noam Rosenthal", ["noam@webkit.org", "noam.rosenthal@nokia.com"], "noamr"), Reviewer("Ojan Vafai", "ojan@chromium.org", "ojan"), Reviewer("Oliver Hunt", "oliver@apple.com", "olliej"), Reviewer("Pavel Feldman", ["pfeldman@chromium.org", "pfeldman@google.com"], "pfeldman"), diff --git a/Tools/Scripts/webkitpy/common/config/contributionareas.py b/Tools/Scripts/webkitpy/common/config/contributionareas.py index 61a7488d6..b48df2a55 100644 --- a/Tools/Scripts/webkitpy/common/config/contributionareas.py +++ b/Tools/Scripts/webkitpy/common/config/contributionareas.py @@ -180,9 +180,6 @@ class ContributionAreas(object): def names(self): return [area.name() for area in self._contribution_areas] - def names(self): - return [area.name() for area in self._contribution_areas] - def _split_path(self, path): result = [] while path and len(path): diff --git a/Tools/Scripts/webkitpy/common/config/ports.py b/Tools/Scripts/webkitpy/common/config/ports.py index 884380e65..f6f3db0c8 100644 --- a/Tools/Scripts/webkitpy/common/config/ports.py +++ b/Tools/Scripts/webkitpy/common/config/ports.py @@ -38,6 +38,9 @@ from webkitpy.common.system.executive import Executive class DeprecatedPort(object): results_directory = "/tmp/layout-test-results" + # Subclasses must override + port_flag_name = None + # FIXME: This is only used by BotInfo. def name(self): return self.__class__ diff --git a/Tools/Scripts/webkitpy/common/config/ports_unittest.py b/Tools/Scripts/webkitpy/common/config/ports_unittest.py index 272052339..58d58d473 100644 --- a/Tools/Scripts/webkitpy/common/config/ports_unittest.py +++ b/Tools/Scripts/webkitpy/common/config/ports_unittest.py @@ -34,42 +34,42 @@ from webkitpy.common.config.ports import * class DeprecatedPortTest(unittest.TestCase): def test_mac_port(self): - self.assertEquals(MacPort().flag(), "--port=mac") - self.assertEquals(MacPort().run_webkit_tests_command(), DeprecatedPort().script_shell_command("run-webkit-tests")) - self.assertEquals(MacPort().build_webkit_command(), DeprecatedPort().script_shell_command("build-webkit")) - self.assertEquals(MacPort().build_webkit_command(build_style="debug"), DeprecatedPort().script_shell_command("build-webkit") + ["--debug"]) - self.assertEquals(MacPort().build_webkit_command(build_style="release"), DeprecatedPort().script_shell_command("build-webkit") + ["--release"]) + self.assertEqual(MacPort().flag(), "--port=mac") + self.assertEqual(MacPort().run_webkit_tests_command(), DeprecatedPort().script_shell_command("run-webkit-tests")) + self.assertEqual(MacPort().build_webkit_command(), DeprecatedPort().script_shell_command("build-webkit")) + self.assertEqual(MacPort().build_webkit_command(build_style="debug"), DeprecatedPort().script_shell_command("build-webkit") + ["--debug"]) + self.assertEqual(MacPort().build_webkit_command(build_style="release"), DeprecatedPort().script_shell_command("build-webkit") + ["--release"]) def test_gtk_port(self): - self.assertEquals(GtkPort().flag(), "--port=gtk") - self.assertEquals(GtkPort().run_webkit_tests_command(), DeprecatedPort().script_shell_command("run-webkit-tests") + ["--gtk"]) - self.assertEquals(GtkPort().build_webkit_command(), DeprecatedPort().script_shell_command("build-webkit") + ["--gtk", "--update-gtk", DeprecatedPort().makeArgs()]) - self.assertEquals(GtkPort().build_webkit_command(build_style="debug"), DeprecatedPort().script_shell_command("build-webkit") + ["--debug", "--gtk", "--update-gtk", DeprecatedPort().makeArgs()]) + self.assertEqual(GtkPort().flag(), "--port=gtk") + self.assertEqual(GtkPort().run_webkit_tests_command(), DeprecatedPort().script_shell_command("run-webkit-tests") + ["--gtk"]) + self.assertEqual(GtkPort().build_webkit_command(), DeprecatedPort().script_shell_command("build-webkit") + ["--gtk", "--update-gtk", DeprecatedPort().makeArgs()]) + self.assertEqual(GtkPort().build_webkit_command(build_style="debug"), DeprecatedPort().script_shell_command("build-webkit") + ["--debug", "--gtk", "--update-gtk", DeprecatedPort().makeArgs()]) def test_efl_port(self): - self.assertEquals(EflPort().flag(), "--port=efl") - self.assertEquals(EflPort().build_webkit_command(), DeprecatedPort().script_shell_command("build-webkit") + ["--efl", "--update-efl", DeprecatedPort().makeArgs()]) - self.assertEquals(EflPort().build_webkit_command(build_style="debug"), DeprecatedPort().script_shell_command("build-webkit") + ["--debug", "--efl", "--update-efl", DeprecatedPort().makeArgs()]) + self.assertEqual(EflPort().flag(), "--port=efl") + self.assertEqual(EflPort().build_webkit_command(), DeprecatedPort().script_shell_command("build-webkit") + ["--efl", "--update-efl", DeprecatedPort().makeArgs()]) + self.assertEqual(EflPort().build_webkit_command(build_style="debug"), DeprecatedPort().script_shell_command("build-webkit") + ["--debug", "--efl", "--update-efl", DeprecatedPort().makeArgs()]) def test_qt_port(self): - self.assertEquals(QtPort().flag(), "--port=qt") - self.assertEquals(QtPort().run_webkit_tests_command(), DeprecatedPort().script_shell_command("run-webkit-tests")) - self.assertEquals(QtPort().build_webkit_command(), DeprecatedPort().script_shell_command("build-webkit") + ["--qt", DeprecatedPort().makeArgs()]) - self.assertEquals(QtPort().build_webkit_command(build_style="debug"), DeprecatedPort().script_shell_command("build-webkit") + ["--debug", "--qt", DeprecatedPort().makeArgs()]) + self.assertEqual(QtPort().flag(), "--port=qt") + self.assertEqual(QtPort().run_webkit_tests_command(), DeprecatedPort().script_shell_command("run-webkit-tests")) + self.assertEqual(QtPort().build_webkit_command(), DeprecatedPort().script_shell_command("build-webkit") + ["--qt", DeprecatedPort().makeArgs()]) + self.assertEqual(QtPort().build_webkit_command(build_style="debug"), DeprecatedPort().script_shell_command("build-webkit") + ["--debug", "--qt", DeprecatedPort().makeArgs()]) def test_chromium_port(self): - self.assertEquals(ChromiumPort().flag(), "--port=chromium") - self.assertEquals(ChromiumPort().run_webkit_tests_command(), DeprecatedPort().script_shell_command("new-run-webkit-tests") + ["--chromium", "--skip-failing-tests"]) - self.assertEquals(ChromiumPort().build_webkit_command(), DeprecatedPort().script_shell_command("build-webkit") + ["--chromium", "--update-chromium"]) - self.assertEquals(ChromiumPort().build_webkit_command(build_style="debug"), DeprecatedPort().script_shell_command("build-webkit") + ["--debug", "--chromium", "--update-chromium"]) - self.assertEquals(ChromiumPort().update_webkit_command(), DeprecatedPort().script_shell_command("update-webkit") + ["--chromium"]) + self.assertEqual(ChromiumPort().flag(), "--port=chromium") + self.assertEqual(ChromiumPort().run_webkit_tests_command(), DeprecatedPort().script_shell_command("new-run-webkit-tests") + ["--chromium", "--skip-failing-tests"]) + self.assertEqual(ChromiumPort().build_webkit_command(), DeprecatedPort().script_shell_command("build-webkit") + ["--chromium", "--update-chromium"]) + self.assertEqual(ChromiumPort().build_webkit_command(build_style="debug"), DeprecatedPort().script_shell_command("build-webkit") + ["--debug", "--chromium", "--update-chromium"]) + self.assertEqual(ChromiumPort().update_webkit_command(), DeprecatedPort().script_shell_command("update-webkit") + ["--chromium"]) def test_chromium_android_port(self): - self.assertEquals(ChromiumAndroidPort().build_webkit_command(), ChromiumPort().build_webkit_command() + ["--chromium-android"]) - self.assertEquals(ChromiumAndroidPort().update_webkit_command(), ChromiumPort().update_webkit_command() + ["--chromium-android"]) + self.assertEqual(ChromiumAndroidPort().build_webkit_command(), ChromiumPort().build_webkit_command() + ["--chromium-android"]) + self.assertEqual(ChromiumAndroidPort().update_webkit_command(), ChromiumPort().update_webkit_command() + ["--chromium-android"]) def test_chromium_xvfb_port(self): - self.assertEquals(ChromiumXVFBPort().run_webkit_tests_command(), ['xvfb-run'] + DeprecatedPort().script_shell_command('new-run-webkit-tests') + ['--chromium', '--skip-failing-tests']) + self.assertEqual(ChromiumXVFBPort().run_webkit_tests_command(), ['xvfb-run'] + DeprecatedPort().script_shell_command('new-run-webkit-tests') + ['--chromium', '--skip-failing-tests']) if __name__ == '__main__': diff --git a/Tools/Scripts/webkitpy/common/config/urls_unittest.py b/Tools/Scripts/webkitpy/common/config/urls_unittest.py index 2b94b860e..b4bf8978a 100644 --- a/Tools/Scripts/webkitpy/common/config/urls_unittest.py +++ b/Tools/Scripts/webkitpy/common/config/urls_unittest.py @@ -34,28 +34,28 @@ from .urls import parse_bug_id, parse_attachment_id class URLsTest(unittest.TestCase): def test_parse_bug_id(self): # FIXME: These would be all better as doctests - self.assertEquals(12345, parse_bug_id("http://webkit.org/b/12345")) - self.assertEquals(12345, parse_bug_id("foo\n\nhttp://webkit.org/b/12345\nbar\n\n")) - self.assertEquals(12345, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?id=12345")) - self.assertEquals(12345, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?id=12345&ctype=xml")) - self.assertEquals(12345, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?id=12345&ctype=xml&excludefield=attachmentdata")) - self.assertEquals(12345, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?id=12345excludefield=attachmentdata&ctype=xml")) + self.assertEqual(12345, parse_bug_id("http://webkit.org/b/12345")) + self.assertEqual(12345, parse_bug_id("foo\n\nhttp://webkit.org/b/12345\nbar\n\n")) + self.assertEqual(12345, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?id=12345")) + self.assertEqual(12345, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?id=12345&ctype=xml")) + self.assertEqual(12345, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?id=12345&ctype=xml&excludefield=attachmentdata")) + self.assertEqual(12345, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?id=12345excludefield=attachmentdata&ctype=xml")) # Our url parser is super-fragile, but at least we're testing it. - self.assertEquals(None, parse_bug_id("http://www.webkit.org/b/12345")) - self.assertEquals(None, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?ctype=xml&id=12345")) - self.assertEquals(None, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?ctype=xml&id=12345&excludefield=attachmentdata")) - self.assertEquals(None, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?ctype=xml&excludefield=attachmentdata&id=12345")) - self.assertEquals(None, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?excludefield=attachmentdata&ctype=xml&id=12345")) - self.assertEquals(None, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?excludefield=attachmentdata&id=12345&ctype=xml")) + self.assertEqual(None, parse_bug_id("http://www.webkit.org/b/12345")) + self.assertEqual(None, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?ctype=xml&id=12345")) + self.assertEqual(None, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?ctype=xml&id=12345&excludefield=attachmentdata")) + self.assertEqual(None, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?ctype=xml&excludefield=attachmentdata&id=12345")) + self.assertEqual(None, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?excludefield=attachmentdata&ctype=xml&id=12345")) + self.assertEqual(None, parse_bug_id("http://bugs.webkit.org/show_bug.cgi?excludefield=attachmentdata&id=12345&ctype=xml")) def test_parse_attachment_id(self): - self.assertEquals(12345, parse_attachment_id("https://bugs.webkit.org/attachment.cgi?id=12345&action=review")) - self.assertEquals(12345, parse_attachment_id("https://bugs.webkit.org/attachment.cgi?id=12345&action=edit")) - self.assertEquals(12345, parse_attachment_id("https://bugs.webkit.org/attachment.cgi?id=12345&action=prettypatch")) - self.assertEquals(12345, parse_attachment_id("https://bugs.webkit.org/attachment.cgi?id=12345&action=diff")) + self.assertEqual(12345, parse_attachment_id("https://bugs.webkit.org/attachment.cgi?id=12345&action=review")) + self.assertEqual(12345, parse_attachment_id("https://bugs.webkit.org/attachment.cgi?id=12345&action=edit")) + self.assertEqual(12345, parse_attachment_id("https://bugs.webkit.org/attachment.cgi?id=12345&action=prettypatch")) + self.assertEqual(12345, parse_attachment_id("https://bugs.webkit.org/attachment.cgi?id=12345&action=diff")) # Direct attachment links are hosted from per-bug subdomains: - self.assertEquals(12345, parse_attachment_id("https://bug-23456-attachments.webkit.org/attachment.cgi?id=12345")) + self.assertEqual(12345, parse_attachment_id("https://bug-23456-attachments.webkit.org/attachment.cgi?id=12345")) # Make sure secure attachment URLs work too. - self.assertEquals(12345, parse_attachment_id("https://bug-23456-attachments.webkit.org/attachment.cgi?id=12345&t=Bqnsdkl9fs")) + self.assertEqual(12345, parse_attachment_id("https://bug-23456-attachments.webkit.org/attachment.cgi?id=12345&t=Bqnsdkl9fs")) diff --git a/Tools/Scripts/webkitpy/common/config/watchlist b/Tools/Scripts/webkitpy/common/config/watchlist index c3c9c9a2c..75f709b76 100755 --- a/Tools/Scripts/webkitpy/common/config/watchlist +++ b/Tools/Scripts/webkitpy/common/config/watchlist @@ -17,7 +17,11 @@ }, "ChromiumPublicApi": { "filename": r"Source/WebKit/chromium/public/" - r"|Source/Platform/chromium/public/", + r"|Source/Platform/chromium/public/" + r"|Tools/DumpRenderTree/chromium/TestRunner/public", + }, + "ChromiumTestRunner": { + "filename": r"Tools/DumpRenderTree/chromium/TestRunner", }, "AppleMacPublicApi": { "filename": r"Source/WebCore/bindings/objc/PublicDOMInterfaces.h" @@ -105,8 +109,7 @@ # Project files for each target are intentionally left out, as those # mostly list source and header files, which would just add noise. "filename": r"Tools/qmake/" - r"|WebKit.pro" - r"|.*DerivedSources\.pri", + r"|WebKit.pro", }, "QtWebKit2PublicAPI": { "filename": r"Source/WebKit2/UIProcess/API/qt/" @@ -115,8 +118,12 @@ }, "QtGraphics": { "filename": r"Source/WebCore/platform/graphics/qt/" - r"|Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/" - r"|Source/WebKit2/UIProcess/CoordinatedGraphics", + }, + "CoordinatedGraphics": { + "filename": r"Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/" + r"|Source/WebKit2/UIProcess/CoordinatedGraphics/" + r"|Source/WebKit2/Shared/CoordinatedGraphics/" + r"|Source/WebCore/platform/graphics/surfaces/", }, "TextureMapper": { "filename": r"Source/WebCore/platform/graphics/texmap/", @@ -147,6 +154,12 @@ "CSS": { "filename": r"Source/WebCore/css/", }, + "DOM": { + "filename": r"Source/WebCore/dom/", + }, + "HTML": { + "filename": r"Source/WebCore/html/", + }, "DOMAttributes": { "filename": r"Source/WebCore/dom/.*Attr.*" r"|Source/WebCore/dom/NamedNodeMap\.(cpp|h|idl)" @@ -293,9 +306,12 @@ "BlackBerry": [ "mifenton@rim.com", "rwlbuis@gmail.com", "tonikitoo@webkit.org" ], "Cairo": [ "dominik.rottsches@intel.com" ], "CMake": [ "rakuco@webkit.org", "gyuyoung.kim@samsung.com" ], - "CSS": [ "alexis@webkit.org", "macpherson@chromium.org", "cmarcelo@webkit.org"], + "CoordinatedGraphics" : [ "noam@webkit.org", "zeno@webkit.org" ], + "CSS": [ "alexis@webkit.org", "macpherson@chromium.org", "cmarcelo@webkit.org", "ojan@chromium.org"], "ChromiumGraphics": [ "jamesr@chromium.org", "cc-bugs@chromium.org" ], "ChromiumPublicApi": [ "abarth@webkit.org", "dglazkov@chromium.org", "fishd@chromium.org", "jamesr@chromium.org", "tkent+wkapi@chromium.org" ], + "ChromiumTestRunner": [ "jochen@chromium.org" ], + "DOM": [ "ojan@chromium.org" ], "DOMAttributes": [ "cmarcelo@webkit.org", ], "EFL": [ "rakuco@webkit.org", "gyuyoung.kim@samsung.com" ], "EFLWebKit2PlatformSpecific": [ "gyuyoung.kim@samsung.com", "rakuco@webkit.org" ], @@ -307,17 +323,18 @@ "GStreamerGraphics": [ "alexis@webkit.org", "pnormand@igalia.com", "gns@gnome.org", "mrobinson@webkit.org" ], "GtkWebKit2PublicAPI": [ "cgarcia@igalia.com", "gns@gnome.org", "mrobinson@webkit.org" ], "Harfbuzz": [ "dominik.rottsches@intel.com" ], + "HTML": [ "ojan@chromium.org" ], "Loader": [ "japhet@chromium.org" ], "MathML": [ "dbarton@mathscribe.com" ], "Media": [ "feature-media-reviews@chromium.org", "eric.carlson@apple.com" ], "MediaStream": [ "tommyw@google.com", "hta@google.com" ], "NetworkInfo": [ "gyuyoung.kim@samsung.com" ], - "OpenGL" : [ "noam.rosenthal@nokia.com", "dino@apple.com" ], + "OpenGL" : [ "noam@webkit.org", "dino@apple.com" ], "QtBuildSystem" : [ "vestbo@webkit.org", "abecsi@webkit.org" ], - "QtGraphics" : [ "noam.rosenthal@nokia.com" ], + "QtGraphics" : [ "noam@webkit.org" ], "QtWebKit2PlatformSpecific": [ "alexis@webkit.org", "cmarcelo@webkit.org", "abecsi@webkit.org" ], "QtWebKit2PublicAPI": [ "alexis@webkit.org", "cmarcelo@webkit.org", "abecsi@webkit.org" ], - "Rendering": [ "eric@webkit.org" ], + "Rendering": [ "eric@webkit.org", "ojan@chromium.org" ], "SVG": ["schenney@chromium.org", "pdr@google.com", "fmalita@chromium.org", "dominik.rottsches@intel.com" ], "SVNScripts": [ "dbates@webkit.org" ], "ScrollingCoordinator": [ "andersca@apple.com", "jamesr@chromium.org", "tonikitoo@webkit.org" ], @@ -326,21 +343,21 @@ "Selectors": [ "allan.jensen@digia.com" ], "SoupNetwork": [ "rakuco@webkit.org", "gns@gnome.org", "mrobinson@webkit.org", "danw@gnome.org" ], "StyleChecker": [ "levin@chromium.org", ], - "TestFailures": [ "abarth@webkit.org", "dglazkov@chromium.org" ], - "TextureMapper" : [ "noam.rosenthal@nokia.com" ], + "TestFailures": [ "abarth@webkit.org", "dglazkov@chromium.org", "ojan@chromium.org" ], + "TextureMapper" : [ "noam@webkit.org" ], "ThreadingFiles|ThreadingUsage": [ "levin+threading@chromium.org", ], "TouchAdjustment" : [ "allan.jensen@digia.com" ], "V8Bindings|BindingsScripts": [ "abarth@webkit.org", "japhet@chromium.org", "haraken@chromium.org" ], - "WTF": [ "benjamin@webkit.org",], + "WTF": [ "benjamin@webkit.org", "ojan@chromium.org"], "WatchListScript": [ "levin+watchlist@chromium.org", ], "WebGL": [ "dino@apple.com" ], "WebIDL": [ "abarth@webkit.org", "ojan@chromium.org" ], "WebInspectorAPI": [ "timothy@apple.com", "joepeck@webkit.org" ], "WebKitGTKTranslations": [ "gns@gnome.org", "mrobinson@webkit.org" ], "WebSocket": [ "yutak@chromium.org" ], - "XSS": [ "dbates@webkit.org" ], + "XSS": [ "dbates@webkit.org", "ojan@chromium.org" ], "webkitperl": [ "dbates@webkit.org" ], - "webkitpy": [ "abarth@webkit.org", "ojan@chromium.org", "dpranke@chromium.org" ], + "webkitpy": [ "abarth@webkit.org", "dpranke@chromium.org" ], }, "MESSAGE_RULES": { "ChromiumPublicApi": [ "Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, " diff --git a/Tools/Scripts/webkitpy/common/find_files_unittest.py b/Tools/Scripts/webkitpy/common/find_files_unittest.py index 75beaf0b4..641251f0e 100644 --- a/Tools/Scripts/webkitpy/common/find_files_unittest.py +++ b/Tools/Scripts/webkitpy/common/find_files_unittest.py @@ -43,7 +43,7 @@ class MockWinFileSystem(object): class TestWinNormalize(unittest.TestCase): def assert_filesystem_normalizes(self, filesystem): - self.assertEquals(find_files._normalize(filesystem, "c:\\foo", + self.assertEqual(find_files._normalize(filesystem, "c:\\foo", ['fast/html', 'fast/canvas/*', 'compositing/foo.html']), ['c:\\foo\\fast\html', 'c:\\foo\\fast\canvas\*', 'c:\\foo\compositing\\foo.html']) diff --git a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py index 6108b5e8a..538d39e85 100644 --- a/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py +++ b/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py @@ -85,16 +85,16 @@ class BugzillaTest(unittest.TestCase): def test_url_creation(self): # FIXME: These would be all better as doctests bugs = Bugzilla() - self.assertEquals(None, bugs.bug_url_for_bug_id(None)) - self.assertEquals(None, bugs.short_bug_url_for_bug_id(None)) - self.assertEquals(None, bugs.attachment_url_for_id(None)) + self.assertEqual(None, bugs.bug_url_for_bug_id(None)) + self.assertEqual(None, bugs.short_bug_url_for_bug_id(None)) + self.assertEqual(None, bugs.attachment_url_for_id(None)) def test_parse_bug_id(self): # Test that we can parse the urls we produce. bugs = Bugzilla() - self.assertEquals(12345, urls.parse_bug_id(bugs.short_bug_url_for_bug_id(12345))) - self.assertEquals(12345, urls.parse_bug_id(bugs.bug_url_for_bug_id(12345))) - self.assertEquals(12345, urls.parse_bug_id(bugs.bug_url_for_bug_id(12345, xml=True))) + self.assertEqual(12345, urls.parse_bug_id(bugs.short_bug_url_for_bug_id(12345))) + self.assertEqual(12345, urls.parse_bug_id(bugs.bug_url_for_bug_id(12345))) + self.assertEqual(12345, urls.parse_bug_id(bugs.bug_url_for_bug_id(12345, xml=True))) _bug_xml = """ <bug> @@ -198,10 +198,10 @@ Ignore this bug. Just for testing failure modes of webkit-patch and the commit- # FIXME: This should move to a central location and be shared by more unit tests. def _assert_dictionaries_equal(self, actual, expected): # Make sure we aren't parsing more or less than we expect - self.assertEquals(sorted(actual.keys()), sorted(expected.keys())) + self.assertEqual(sorted(actual.keys()), sorted(expected.keys())) for key, expected_value in expected.items(): - self.assertEquals(actual[key], expected_value, ("Failure for key: %s: Actual='%s' Expected='%s'" % (key, actual[key], expected_value))) + self.assertEqual(actual[key], expected_value, ("Failure for key: %s: Actual='%s' Expected='%s'" % (key, actual[key], expected_value))) def test_parse_bug_dictionary_from_xml(self): bug = Bugzilla()._parse_bug_dictionary_from_xml(self._single_bug_xml) @@ -217,10 +217,10 @@ Ignore this bug. Just for testing failure modes of webkit-patch and the commit- def test_parse_bugs_from_xml(self): bugzilla = Bugzilla() bugs = bugzilla._parse_bugs_from_xml(self._sample_multi_bug_xml) - self.assertEquals(len(bugs), 2) - self.assertEquals(bugs[0].id(), self._expected_example_bug_parsing['id']) + self.assertEqual(len(bugs), 2) + self.assertEqual(bugs[0].id(), self._expected_example_bug_parsing['id']) bugs = bugzilla._parse_bugs_from_xml("") - self.assertEquals(len(bugs), 0) + self.assertEqual(len(bugs), 0) # This could be combined into test_bug_parsing later if desired. def test_attachment_parsing(self): @@ -244,7 +244,7 @@ Ignore this bug. Just for testing failure modes of webkit-patch and the commit- def test_attachment_detail_bug_parsing(self): bugzilla = Bugzilla() - self.assertEquals(27314, bugzilla._parse_bug_id_from_attachment_page(self._sample_attachment_detail_page)) + self.assertEqual(27314, bugzilla._parse_bug_id_from_attachment_page(self._sample_attachment_detail_page)) def test_add_cc_to_bug(self): bugzilla = Bugzilla() @@ -408,7 +408,7 @@ class BugzillaQueriesTest(unittest.TestCase): """ def _assert_result_count(self, queries, html, count): - self.assertEquals(queries._parse_result_count(html), count) + self.assertEqual(queries._parse_result_count(html), count) def test_parse_result_count(self): queries = BugzillaQueries(None) @@ -420,12 +420,12 @@ class BugzillaQueriesTest(unittest.TestCase): def test_request_page_parsing(self): queries = BugzillaQueries(None) - self.assertEquals([40511, 40722, 40723], queries._parse_attachment_ids_request_query(self._sample_request_page)) + self.assertEqual([40511, 40722, 40723], queries._parse_attachment_ids_request_query(self._sample_request_page)) def test_quip_page_parsing(self): queries = BugzillaQueries(None) expected_quips = ["Everything should be made as simple as possible, but not simpler. - Albert Einstein", "Good artists copy. Great artists steal. - Pablo Picasso", u"\u00e7gua mole em pedra dura, tanto bate at\u008e que fura."] - self.assertEquals(expected_quips, queries._parse_quips(self._sample_quip_page)) + self.assertEqual(expected_quips, queries._parse_quips(self._sample_quip_page)) def test_load_query(self): queries = BugzillaQueries(Mock()) @@ -482,7 +482,7 @@ class EditUsersParserTest(unittest.TestCase): def _assert_login_userid_pairs(self, results_page, expected_logins): parser = EditUsersParser() logins = parser.login_userid_pairs_from_edit_user_results(results_page) - self.assertEquals(logins, expected_logins) + self.assertEqual(logins, expected_logins) def test_logins_from_editusers_results(self): self._assert_login_userid_pairs(self._example_user_results, [("abarth@webkit.org", 1234)]) diff --git a/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py b/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py index adb5a3d2c..d6804d5b7 100644 --- a/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py +++ b/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py @@ -135,6 +135,7 @@ class Builder(object): return form.find_control("username") except Exception, e: return False + # ignore false positives for missing Browser methods - pylint: disable-msg=E1102 self._browser.open(self.url()) self._browser.select_form(predicate=predicate) self._browser["username"] = username diff --git a/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_mock.py b/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_mock.py index f8ec49b7b..f5b6042b3 100644 --- a/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_mock.py +++ b/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_mock.py @@ -26,6 +26,8 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +from webkitpy.common.system.deprecated_logging import log + class MockBuild(object): def __init__(self, build_number, revision, is_green): diff --git a/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py b/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py index 69f864889..547a8e6ff 100644 --- a/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py +++ b/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py @@ -232,10 +232,10 @@ class BuildBotTest(unittest.TestCase): builder = buildbot._parse_builder_status_from_row(status_row) # Make sure we aren't parsing more or less than we expect - self.assertEquals(builder.keys(), expected_parsing.keys()) + self.assertEqual(builder.keys(), expected_parsing.keys()) for key, expected_value in expected_parsing.items(): - self.assertEquals(builder[key], expected_value, ("Builder %d parse failure for key: %s: Actual='%s' Expected='%s'" % (x, key, builder[key], expected_value))) + self.assertEqual(builder[key], expected_value, ("Builder %d parse failure for key: %s: Actual='%s' Expected='%s'" % (x, key, builder[key], expected_value))) def test_builder_with_name(self): buildbot = BuildBot() @@ -464,7 +464,7 @@ class BuildBotTest(unittest.TestCase): b = Builder('builder', BuildBot()) b._fetch_build = self._fetch_build b._fetch_revision_to_build_map = self._fetch_revision_to_build_map - self.assertEquals("correct build", b.latest_cached_build()) + self.assertEqual("correct build", b.latest_cached_build()) def results_url(self): return "some-url" @@ -472,7 +472,7 @@ class BuildBotTest(unittest.TestCase): def test_results_zip_url(self): b = Build(None, 123, 123, False) b.results_url = self.results_url - self.assertEquals("some-url.zip", b.results_zip_url()) + self.assertEqual("some-url.zip", b.results_zip_url()) if __name__ == '__main__': diff --git a/Tools/Scripts/webkitpy/common/net/credentials_unittest.py b/Tools/Scripts/webkitpy/common/net/credentials_unittest.py index a797e3d1b..15682f3b8 100644 --- a/Tools/Scripts/webkitpy/common/net/credentials_unittest.py +++ b/Tools/Scripts/webkitpy/common/net/credentials_unittest.py @@ -135,8 +135,8 @@ password: "SECRETSAUCE" os.environ['WEBKIT_BUGZILLA_USERNAME'] = "foo" os.environ['WEBKIT_BUGZILLA_PASSWORD'] = "bar" username, password = credentials._credentials_from_environment() - self.assertEquals(username, "foo") - self.assertEquals(password, "bar") + self.assertEqual(username, "foo") + self.assertEqual(password, "bar") os.environ = saved_environ def test_read_credentials_without_git_repo(self): diff --git a/Tools/Scripts/webkitpy/common/net/failuremap_unittest.py b/Tools/Scripts/webkitpy/common/net/failuremap_unittest.py index 9a66d9ede..bd41032cb 100644 --- a/Tools/Scripts/webkitpy/common/net/failuremap_unittest.py +++ b/Tools/Scripts/webkitpy/common/net/failuremap_unittest.py @@ -54,27 +54,27 @@ class FailureMapTest(unittest.TestCase): def test_failing_revisions(self): failure_map = self._make_failure_map() - self.assertEquals(failure_map.failing_revisions(), [1234, 1235]) + self.assertEqual(failure_map.failing_revisions(), [1234, 1235]) def test_new_failures(self): failure_map = self._make_failure_map() failure_map.filter_out_old_failures(lambda revision: False) - self.assertEquals(failure_map.failing_revisions(), [1234, 1235]) + self.assertEqual(failure_map.failing_revisions(), [1234, 1235]) def test_new_failures_with_old_revisions(self): failure_map = self._make_failure_map() failure_map.filter_out_old_failures(lambda revision: revision == 1234) - self.assertEquals(failure_map.failing_revisions(), []) + self.assertEqual(failure_map.failing_revisions(), []) def test_new_failures_with_more_old_revisions(self): failure_map = self._make_failure_map() failure_map.filter_out_old_failures(lambda revision: revision == 1235) - self.assertEquals(failure_map.failing_revisions(), [1234]) + self.assertEqual(failure_map.failing_revisions(), [1234]) def test_tests_failing_for(self): failure_map = self._make_failure_map() - self.assertEquals(failure_map.tests_failing_for(1234), [u'test1']) + self.assertEqual(failure_map.tests_failing_for(1234), [u'test1']) def test_failing_tests(self): failure_map = self._make_failure_map() - self.assertEquals(failure_map.failing_tests(), set([u'test1'])) + self.assertEqual(failure_map.failing_tests(), set([u'test1'])) diff --git a/Tools/Scripts/webkitpy/common/net/layouttestresults_unittest.py b/Tools/Scripts/webkitpy/common/net/layouttestresults_unittest.py index 939a56a7d..462a88c66 100644 --- a/Tools/Scripts/webkitpy/common/net/layouttestresults_unittest.py +++ b/Tools/Scripts/webkitpy/common/net/layouttestresults_unittest.py @@ -130,9 +130,9 @@ class LayoutTestResultsTest(unittest.TestCase): def test_set_failure_limit_count(self): results = LayoutTestResults([]) - self.assertEquals(results.failure_limit_count(), None) + self.assertEqual(results.failure_limit_count(), None) results.set_failure_limit_count(10) - self.assertEquals(results.failure_limit_count(), 10) + self.assertEqual(results.failure_limit_count(), 10) def test_results_from_string(self): self.assertEqual(LayoutTestResults.results_from_string(None), None) diff --git a/Tools/Scripts/webkitpy/common/net/unittestresults_unittest.py b/Tools/Scripts/webkitpy/common/net/unittestresults_unittest.py index f8852062c..40e80236f 100644 --- a/Tools/Scripts/webkitpy/common/net/unittestresults_unittest.py +++ b/Tools/Scripts/webkitpy/common/net/unittestresults_unittest.py @@ -34,10 +34,10 @@ from unittestresults import UnitTestResults class UnitTestResultsTest(unittest.TestCase): def test_nostring(self): - self.assertEquals(None, UnitTestResults.results_from_string(None)) + self.assertEqual(None, UnitTestResults.results_from_string(None)) def test_emptystring(self): - self.assertEquals(None, UnitTestResults.results_from_string("")) + self.assertEqual(None, UnitTestResults.results_from_string("")) def test_nofailures(self): no_failures_xml = """<?xml version="1.0" encoding="UTF-8"?> @@ -48,7 +48,7 @@ class UnitTestResultsTest(unittest.TestCase): <testcase name="CrashIfSettingUnsetRowIndex" status="run" time="0.123" classname="RenderTableCellDeathTest" /> </testsuite> </testsuites>""" - self.assertEquals([], UnitTestResults.results_from_string(no_failures_xml)) + self.assertEqual([], UnitTestResults.results_from_string(no_failures_xml)) def test_onefailure(self): one_failure_xml = """<?xml version="1.0" encoding="UTF-8"?> @@ -66,7 +66,7 @@ Expected: 1]]></failure> </testsuite> </testsuites>""" expected = ["WebFrameTest.FAILS_DivAutoZoomParamsTest"] - self.assertEquals(expected, UnitTestResults.results_from_string(one_failure_xml)) + self.assertEqual(expected, UnitTestResults.results_from_string(one_failure_xml)) def test_multiple_failures_per_test(self): multiple_failures_per_test_xml = """<?xml version="1.0" encoding="UTF-8"?> @@ -91,7 +91,7 @@ Expected: 6.28]]></failure> </testsuite> </testsuites>""" expected = ["ClassOne.TestOne", "ClassTwo.TestTwo"] - self.assertEquals(expected, UnitTestResults.results_from_string(multiple_failures_per_test_xml)) + self.assertEqual(expected, UnitTestResults.results_from_string(multiple_failures_per_test_xml)) if __name__ == '__main__': diff --git a/Tools/Scripts/webkitpy/common/newstringio.py b/Tools/Scripts/webkitpy/common/newstringio.py index f6d08ec59..724fb11aa 100644 --- a/Tools/Scripts/webkitpy/common/newstringio.py +++ b/Tools/Scripts/webkitpy/common/newstringio.py @@ -29,10 +29,10 @@ """'with'-compliant StringIO implementation.""" -import StringIO +import StringIO as OldStringIO -class StringIO(StringIO.StringIO): +class StringIO(OldStringIO.StringIO): def __enter__(self): return self diff --git a/Tools/Scripts/webkitpy/common/read_checksum_from_png_unittest.py b/Tools/Scripts/webkitpy/common/read_checksum_from_png_unittest.py index defbbf806..a56bec2e4 100644 --- a/Tools/Scripts/webkitpy/common/read_checksum_from_png_unittest.py +++ b/Tools/Scripts/webkitpy/common/read_checksum_from_png_unittest.py @@ -32,12 +32,12 @@ class ReadChecksumFromPngTest(unittest.TestCase): # Test a file with the comment. filehandle = StringIO.StringIO('''\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x03 \x00\x00\x02X\x08\x02\x00\x00\x00\x15\x14\x15'\x00\x00\x00)tEXtchecksum\x003c4134fe2739880353f91c5b84cadbaaC\xb8?\xec\x00\x00\x16\xfeIDATx\x9c\xed\xdd[\x8cU\xe5\xc1\xff\xf15T\x18\x0ea,)\xa6\x80XZ<\x10\n\xd6H\xc4V\x88}\xb5\xa9\xd6r\xd5\x0bki0\xa6\xb5ih\xd2\xde\x98PHz\xd1\x02=\\q#\x01\x8b\xa5rJ\x8b\x88i\xacM\xc5h\x8cbMk(\x1ez@!\x0c\xd5\xd2\xc2\xb44\x1c\x848\x1dF(\xeb\x7f\xb1\xff\xd9\xef~g\xd6\xde3\xe0o\x10\xec\xe7sa6{\xd6z\xd6\xb3\xd7\xf3\xa8_7\xdbM[Y\x96\x05\x00\x009\xc3\xde\xeb\t\x00\x00\xbc\xdf\x08,\x00\x800\x81\x05\x00\x10&\xb0\x00\x00\xc2\x04\x16\x00@\x98\xc0\x02\x00\x08\x13X\x00\x00a\x02\x0b\x00 Lx01\x00\x84\t,\x00\x800\x81\x05\x00\x10\xd64\xb0\xda\x9a\xdb\xb6m\xdb\xb4i\xd3\xfa\x9fr\xf3\xcd7\x0f\xe5T\x07\xe5\xd4\xa9''') checksum = read_checksum_from_png.read_checksum(filehandle) - self.assertEquals('3c4134fe2739880353f91c5b84cadbaa', checksum) + self.assertEqual('3c4134fe2739880353f91c5b84cadbaa', checksum) # Test a file without the comment. filehandle = StringIO.StringIO('''\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x03 \x00\x00\x02X\x08\x02\x00\x00\x00\x15\x14\x15'\x00\x00\x16\xfeIDATx\x9c\xed\xdd[\x8cU\xe5\xc1\xff\xf15T\x18\x0ea,)\xa6\x80XZ<\x10\n\xd6H\xc4V\x88}\xb5\xa9\xd6r\xd5\x0bki0\xa6\xb5ih\xd2\xde\x98PHz\xd1\x02=\\q#\x01\x8b\xa5rJ\x8b\x88i\xacM\xc5h\x8cbMk(\x1ez@!\x0c\xd5\xd2\xc2\xb44\x1c\x848\x1dF(\xeb\x7f\xb1\xff\xd9\xef~g\xd6\xde3\xe0o\x10\xec\xe7sa6{\xd6z\xd6\xb3\xd7\xf3\xa8_7\xdbM[Y\x96\x05\x00\x009\xc3\xde\xeb\t\x00\x00\xbc\xdf\x08,\x00\x800\x81\x05\x00\x10&\xb0\x00\x00\xc2\x04\x16\x00@\x98\xc0\x02\x00\x08\x13X\x00\x00a\x02\x0b\x00 Lx01\x00\x84\t,\x00\x800\x81\x05\x00\x10\xd64\xb0\xda\x9a\xdb\xb6m\xdb\xb4i\xd3\xfa\x9fr\xf3\xcd7\x0f\xe5T\x07\xe5\xd4\xa9S\x8b\x17/\x1e?~\xfc\xf8\xf1\xe3\xef\xbf\xff\xfe\xf7z:M5\xbb\x87\x17\xcbUZ\x8f|V\xd7\xbd\x10\xb6\xcd{b\x88\xf6j\xb3\x9b?\x14\x9b\xa1>\xe6\xf9\xd9\xcf\x00\x17\x93''') checksum = read_checksum_from_png.read_checksum(filehandle) - self.assertEquals(None, checksum) + self.assertEqual(None, checksum) if __name__ == '__main__': diff --git a/Tools/Scripts/webkitpy/common/system/deprecated_logging_unittest.py b/Tools/Scripts/webkitpy/common/system/deprecated_logging_unittest.py index 377816207..b986609bb 100644 --- a/Tools/Scripts/webkitpy/common/system/deprecated_logging_unittest.py +++ b/Tools/Scripts/webkitpy/common/system/deprecated_logging_unittest.py @@ -47,7 +47,7 @@ class LoggingTest(unittest.TestCase): finally: sys.stderr = original_stderr - self.assertEquals(actual_output, expected_output, "log(\"%s\") expected: %s actual: %s" % (log_input, expected_output, actual_output)) + self.assertEqual(actual_output, expected_output, "log(\"%s\") expected: %s actual: %s" % (log_input, expected_output, actual_output)) def test_log(self): self.assert_log_equals("test", "test\n") diff --git a/Tools/Scripts/webkitpy/common/system/executive_mock.py b/Tools/Scripts/webkitpy/common/system/executive_mock.py index c2613530b..47eddea8b 100644 --- a/Tools/Scripts/webkitpy/common/system/executive_mock.py +++ b/Tools/Scripts/webkitpy/common/system/executive_mock.py @@ -168,7 +168,7 @@ class MockExecutive2(MockExecutive): self.calls.append(args) assert(isinstance(args, list) or isinstance(args, tuple)) if self._exception: - raise self._exception + raise self._exception # pylint: disable-msg=E0702 if self._run_command_fn: return self._run_command_fn(args) if return_exit_code: diff --git a/Tools/Scripts/webkitpy/common/system/executive_unittest.py b/Tools/Scripts/webkitpy/common/system/executive_unittest.py index 57c557369..755955d34 100644 --- a/Tools/Scripts/webkitpy/common/system/executive_unittest.py +++ b/Tools/Scripts/webkitpy/common/system/executive_unittest.py @@ -48,19 +48,19 @@ from webkitpy.common.system.filesystem_mock import MockFileSystem class ScriptErrorTest(unittest.TestCase): def test_string_from_args(self): error = ScriptError() - self.assertEquals(error._string_from_args(None), 'None') - self.assertEquals(error._string_from_args([]), '[]') - self.assertEquals(error._string_from_args(map(str, range(30))), "['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17'...") + self.assertEqual(error._string_from_args(None), 'None') + self.assertEqual(error._string_from_args([]), '[]') + self.assertEqual(error._string_from_args(map(str, range(30))), "['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17'...") def test_message_with_output(self): error = ScriptError('My custom message!', '', -1) - self.assertEquals(error.message_with_output(), 'My custom message!') + self.assertEqual(error.message_with_output(), 'My custom message!') error = ScriptError('My custom message!', '', -1, 'My output.') - self.assertEquals(error.message_with_output(), 'My custom message!\n\nMy output.') + self.assertEqual(error.message_with_output(), 'My custom message!\n\nMy output.') error = ScriptError('', 'my_command!', -1, 'My output.', '/Users/username/blah') - self.assertEquals(error.message_with_output(), 'Failed to run "my_command!" exit_code: -1 cwd: /Users/username/blah\n\nMy output.') + self.assertEqual(error.message_with_output(), 'Failed to run "my_command!" exit_code: -1 cwd: /Users/username/blah\n\nMy output.') error = ScriptError('', 'my_command!', -1, 'ab' + '1' * 499) - self.assertEquals(error.message_with_output(), 'Failed to run "my_command!" exit_code: -1\n\nLast 500 characters of output:\nb' + '1' * 499) + self.assertEqual(error.message_with_output(), 'Failed to run "my_command!" exit_code: -1\n\nLast 500 characters of output:\nb' + '1' * 499) def never_ending_command(): """Arguments for a command that will never end (useful for testing process @@ -104,7 +104,7 @@ class ExecutiveTest(unittest.TestCase): def test_run_command_with_bad_command(self): def run_bad_command(): Executive().run_command(["foo_bar_command_blah"], error_handler=Executive.ignore_error, return_exit_code=True) - self.failUnlessRaises(OSError, run_bad_command) + self.assertRaises(OSError, run_bad_command) def test_run_command_args_type(self): executive = Executive() @@ -133,24 +133,24 @@ class ExecutiveTest(unittest.TestCase): executive = Executive() output = executive.run_command(command_line('cat'), input=unicode_tor_input) - self.assertEquals(output, unicode_tor_output) + self.assertEqual(output, unicode_tor_output) output = executive.run_command(command_line('echo', unicode_tor_input)) - self.assertEquals(output, unicode_tor_output) + self.assertEqual(output, unicode_tor_output) output = executive.run_command(command_line('echo', unicode_tor_input), decode_output=False) - self.assertEquals(output, encoded_tor) + self.assertEqual(output, encoded_tor) # Make sure that str() input also works. output = executive.run_command(command_line('cat'), input=encoded_tor, decode_output=False) - self.assertEquals(output, encoded_tor) + self.assertEqual(output, encoded_tor) # FIXME: We should only have one run* method to test output = executive.run_and_throw_if_fail(command_line('echo', unicode_tor_input), quiet=True) - self.assertEquals(output, unicode_tor_output) + self.assertEqual(output, unicode_tor_output) output = executive.run_and_throw_if_fail(command_line('echo', unicode_tor_input), quiet=True, decode_output=False) - self.assertEquals(output, encoded_tor) + self.assertEqual(output, encoded_tor) def serial_test_kill_process(self): executive = Executive() @@ -236,8 +236,8 @@ class ExecutiveTest(unittest.TestCase): command_outputs = Executive().run_in_parallel(commands, processes=NUM_PROCESSES) done = time.time() self.assertTrue(done - start < NUM_PROCESSES * DELAY_SECS) - self.assertEquals([output[1] for output in command_outputs], ["hello\n"] * NUM_PROCESSES) - self.assertEquals([], multiprocessing.active_children()) + self.assertEqual([output[1] for output in command_outputs], ["hello\n"] * NUM_PROCESSES) + self.assertEqual([], multiprocessing.active_children()) def test_run_in_parallel_assert_nonempty(self): self.assertRaises(AssertionError, Executive().run_in_parallel, []) diff --git a/Tools/Scripts/webkitpy/common/system/filesystem_mock.py b/Tools/Scripts/webkitpy/common/system/filesystem_mock.py index d87fe1b8e..16e9fadaa 100644 --- a/Tools/Scripts/webkitpy/common/system/filesystem_mock.py +++ b/Tools/Scripts/webkitpy/common/system/filesystem_mock.py @@ -108,9 +108,9 @@ class MockFileSystem(object): if not self.exists(source): self._raise_not_found(source) if self.isdir(source): - raise IOError(errno.EISDIR, source, os.strerror(errno.ISDIR)) + raise IOError(errno.EISDIR, source, os.strerror(errno.EISDIR)) if self.isdir(destination): - raise IOError(errno.EISDIR, destination, os.strerror(errno.ISDIR)) + raise IOError(errno.EISDIR, destination, os.strerror(errno.EISDIR)) if not self.exists(self.dirname(destination)): raise IOError(errno.ENOENT, destination, os.strerror(errno.ENOENT)) diff --git a/Tools/Scripts/webkitpy/common/system/filesystem_mock_unittest.py b/Tools/Scripts/webkitpy/common/system/filesystem_mock_unittest.py index 2a6ccbf4b..391c1d954 100644 --- a/Tools/Scripts/webkitpy/common/system/filesystem_mock_unittest.py +++ b/Tools/Scripts/webkitpy/common/system/filesystem_mock_unittest.py @@ -52,7 +52,7 @@ class MockFileSystemTest(unittest.TestCase, filesystem_unittest.GenericFileSyste else: expected = good_fn(test) actual = test_fn(test) - self.assertEquals(expected, actual, 'given %s, expected %s, got %s' % (repr(test), repr(expected), repr(actual))) + self.assertEqual(expected, actual, 'given %s, expected %s, got %s' % (repr(test), repr(expected), repr(actual))) def test_join(self): self.quick_check(self.fs.join, diff --git a/Tools/Scripts/webkitpy/common/system/filesystem_unittest.py b/Tools/Scripts/webkitpy/common/system/filesystem_unittest.py index e6d1e428f..d656b2580 100644 --- a/Tools/Scripts/webkitpy/common/system/filesystem_unittest.py +++ b/Tools/Scripts/webkitpy/common/system/filesystem_unittest.py @@ -60,19 +60,19 @@ class GenericFileSystemTests(object): def test_glob__trailing_asterisk(self): self.fs.chdir(self.generic_test_dir) - self.assertEquals(set(self.fs.glob('fo*')), set(['foo.txt', 'foobar', 'foodir'])) + self.assertEqual(set(self.fs.glob('fo*')), set(['foo.txt', 'foobar', 'foodir'])) def test_glob__leading_asterisk(self): self.fs.chdir(self.generic_test_dir) - self.assertEquals(set(self.fs.glob('*xt')), set(['foo.txt'])) + self.assertEqual(set(self.fs.glob('*xt')), set(['foo.txt'])) def test_glob__middle_asterisk(self): self.fs.chdir(self.generic_test_dir) - self.assertEquals(set(self.fs.glob('f*r')), set(['foobar', 'foodir'])) + self.assertEqual(set(self.fs.glob('f*r')), set(['foobar', 'foodir'])) def test_glob__period_is_escaped(self): self.fs.chdir(self.generic_test_dir) - self.assertEquals(set(self.fs.glob('foo.*')), set(['foo.txt'])) + self.assertEqual(set(self.fs.glob('foo.*')), set(['foo.txt'])) class RealFileSystemTest(unittest.TestCase, GenericFileSystemTests): def setUp(self): @@ -94,7 +94,7 @@ class RealFileSystemTest(unittest.TestCase, GenericFileSystemTests): if sys.platform == 'win32': newdir = 'c:\\' fs.chdir(newdir) - self.assertEquals(fs.getcwd(), newdir) + self.assertEqual(fs.getcwd(), newdir) fs.chdir(cwd) def test_chdir__notexists(self): @@ -246,13 +246,13 @@ class RealFileSystemTest(unittest.TestCase, GenericFileSystemTests): fs = FileSystem() self.assertTrue(fs.remove('filename', remove_with_exception)) - self.assertEquals(-1, RealFileSystemTest._remove_failures) + self.assertEqual(-1, RealFileSystemTest._remove_failures) def test_sep(self): fs = FileSystem() - self.assertEquals(fs.sep, os.sep) - self.assertEquals(fs.join("foo", "bar"), + self.assertEqual(fs.sep, os.sep) + self.assertEqual(fs.join("foo", "bar"), os.path.join("foo", "bar")) diff --git a/Tools/Scripts/webkitpy/common/system/logtesting.py b/Tools/Scripts/webkitpy/common/system/logtesting.py index e361cb593..0cfa6cb0a 100644 --- a/Tools/Scripts/webkitpy/common/system/logtesting.py +++ b/Tools/Scripts/webkitpy/common/system/logtesting.py @@ -72,7 +72,7 @@ class TestLogStream(object): messages: A list of log message strings. """ - self._test_case.assertEquals(messages, self.messages) + self._test_case.assertEqual(messages, self.messages) class LogTesting(object): diff --git a/Tools/Scripts/webkitpy/common/system/logutils_unittest.py b/Tools/Scripts/webkitpy/common/system/logutils_unittest.py index 72789eb37..6d7cc4da4 100644 --- a/Tools/Scripts/webkitpy/common/system/logutils_unittest.py +++ b/Tools/Scripts/webkitpy/common/system/logutils_unittest.py @@ -37,7 +37,7 @@ class GetLoggerTest(unittest.TestCase): def test_get_logger_in_webkitpy(self): logger = logutils.get_logger(__file__) - self.assertEquals(logger.name, "webkitpy.common.system.logutils_unittest") + self.assertEqual(logger.name, "webkitpy.common.system.logutils_unittest") def test_get_logger_not_in_webkitpy(self): # Temporarily change the working directory so that we @@ -47,10 +47,10 @@ class GetLoggerTest(unittest.TestCase): os.chdir(root_dir) logger = logutils.get_logger("/Tools/Scripts/test-webkitpy") - self.assertEquals(logger.name, "test-webkitpy") + self.assertEqual(logger.name, "test-webkitpy") logger = logutils.get_logger("/Tools/Scripts/test-webkitpy.py") - self.assertEquals(logger.name, "test-webkitpy") + self.assertEqual(logger.name, "test-webkitpy") os.chdir(working_directory) diff --git a/Tools/Scripts/webkitpy/common/system/outputcapture.py b/Tools/Scripts/webkitpy/common/system/outputcapture.py index 78a12f0e2..26670d214 100644 --- a/Tools/Scripts/webkitpy/common/system/outputcapture.py +++ b/Tools/Scripts/webkitpy/common/system/outputcapture.py @@ -115,7 +115,7 @@ class OutputCaptureTestCaseBase(unittest.TestCase): unittest.TestCase.tearDown(self) def assertStdout(self, expected_stdout): - self.assertEquals(expected_stdout, self.__captured_stdout.getvalue()) + self.assertEqual(expected_stdout, self.__captured_stdout.getvalue()) def assertStderr(self, expected_stderr): - self.assertEquals(expected_stderr, self.__captured_stderr.getvalue()) + self.assertEqual(expected_stderr, self.__captured_stderr.getvalue()) diff --git a/Tools/Scripts/webkitpy/common/system/path_unittest.py b/Tools/Scripts/webkitpy/common/system/path_unittest.py index 954d32d71..7a719584d 100644 --- a/Tools/Scripts/webkitpy/common/system/path_unittest.py +++ b/Tools/Scripts/webkitpy/common/system/path_unittest.py @@ -41,28 +41,28 @@ class AbspathTest(unittest.TestCase): def test_abspath_to_uri_cygwin(self): if sys.platform != 'cygwin': return - self.assertEquals(path.abspath_to_uri(self.platforminfo(), '/cygdrive/c/foo/bar.html'), + self.assertEqual(path.abspath_to_uri(self.platforminfo(), '/cygdrive/c/foo/bar.html'), 'file:///C:/foo/bar.html') def test_abspath_to_uri_unixy(self): - self.assertEquals(path.abspath_to_uri(MockPlatformInfo(), "/foo/bar.html"), + self.assertEqual(path.abspath_to_uri(MockPlatformInfo(), "/foo/bar.html"), 'file:///foo/bar.html') def test_abspath_to_uri_win(self): if sys.platform != 'win32': return - self.assertEquals(path.abspath_to_uri(self.platforminfo(), 'c:\\foo\\bar.html'), + self.assertEqual(path.abspath_to_uri(self.platforminfo(), 'c:\\foo\\bar.html'), 'file:///c:/foo/bar.html') def test_abspath_to_uri_escaping_unixy(self): - self.assertEquals(path.abspath_to_uri(MockPlatformInfo(), '/foo/bar + baz%?.html'), + self.assertEqual(path.abspath_to_uri(MockPlatformInfo(), '/foo/bar + baz%?.html'), 'file:///foo/bar%20+%20baz%25%3F.html') # Note that you can't have '?' in a filename on windows. def test_abspath_to_uri_escaping_cygwin(self): if sys.platform != 'cygwin': return - self.assertEquals(path.abspath_to_uri(self.platforminfo(), '/cygdrive/c/foo/bar + baz%.html'), + self.assertEqual(path.abspath_to_uri(self.platforminfo(), '/cygdrive/c/foo/bar + baz%.html'), 'file:///C:/foo/bar%20+%20baz%25.html') def test_stop_cygpath_subprocess(self): diff --git a/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py b/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py index a2b4255b7..327229eb9 100644 --- a/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py +++ b/Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py @@ -84,7 +84,7 @@ class TestPlatformInfo(unittest.TestCase): if info.is_mac(): self.assertTrue(info.total_bytes_memory() > 0) else: - self.assertEquals(info.total_bytes_memory(), None) + self.assertEqual(info.total_bytes_memory(), None) def test_os_name_and_wrappers(self): info = self.make_info(fake_sys('linux2')) @@ -100,28 +100,28 @@ class TestPlatformInfo(unittest.TestCase): self.assertFalse(info.is_freebsd()) info = self.make_info(fake_sys('darwin'), fake_platform('10.6.3')) - self.assertEquals(info.os_name, 'mac') + self.assertEqual(info.os_name, 'mac') self.assertFalse(info.is_linux()) self.assertTrue(info.is_mac()) self.assertFalse(info.is_win()) self.assertFalse(info.is_freebsd()) info = self.make_info(fake_sys('win32', tuple([6, 1, 7600]))) - self.assertEquals(info.os_name, 'win') + self.assertEqual(info.os_name, 'win') self.assertFalse(info.is_linux()) self.assertFalse(info.is_mac()) self.assertTrue(info.is_win()) self.assertFalse(info.is_freebsd()) info = self.make_info(fake_sys('cygwin'), executive=fake_executive('6.1.7600')) - self.assertEquals(info.os_name, 'win') + self.assertEqual(info.os_name, 'win') self.assertFalse(info.is_linux()) self.assertFalse(info.is_mac()) self.assertTrue(info.is_win()) self.assertFalse(info.is_freebsd()) info = self.make_info(fake_sys('freebsd8')) - self.assertEquals(info.os_name, 'freebsd') + self.assertEqual(info.os_name, 'freebsd') self.assertFalse(info.is_linux()) self.assertFalse(info.is_mac()) self.assertFalse(info.is_win()) @@ -131,28 +131,28 @@ class TestPlatformInfo(unittest.TestCase): def test_os_version(self): self.assertRaises(AssertionError, self.make_info, fake_sys('darwin'), fake_platform('10.4.3')) - self.assertEquals(self.make_info(fake_sys('darwin'), fake_platform('10.5.1')).os_version, 'leopard') - self.assertEquals(self.make_info(fake_sys('darwin'), fake_platform('10.6.1')).os_version, 'snowleopard') - self.assertEquals(self.make_info(fake_sys('darwin'), fake_platform('10.7.1')).os_version, 'lion') - self.assertEquals(self.make_info(fake_sys('darwin'), fake_platform('10.8.1')).os_version, 'mountainlion') - self.assertEquals(self.make_info(fake_sys('darwin'), fake_platform('10.9.0')).os_version, 'future') + self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.5.1')).os_version, 'leopard') + self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.6.1')).os_version, 'snowleopard') + self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.7.1')).os_version, 'lion') + self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.8.1')).os_version, 'mountainlion') + self.assertEqual(self.make_info(fake_sys('darwin'), fake_platform('10.9.0')).os_version, 'future') - self.assertEquals(self.make_info(fake_sys('linux2')).os_version, 'lucid') + self.assertEqual(self.make_info(fake_sys('linux2')).os_version, 'lucid') - self.assertEquals(self.make_info(fake_sys('freebsd8'), fake_platform('', '8.3-PRERELEASE')).os_version, '8.3-PRERELEASE') - self.assertEquals(self.make_info(fake_sys('freebsd9'), fake_platform('', '9.0-RELEASE')).os_version, '9.0-RELEASE') + self.assertEqual(self.make_info(fake_sys('freebsd8'), fake_platform('', '8.3-PRERELEASE')).os_version, '8.3-PRERELEASE') + self.assertEqual(self.make_info(fake_sys('freebsd9'), fake_platform('', '9.0-RELEASE')).os_version, '9.0-RELEASE') self.assertRaises(AssertionError, self.make_info, fake_sys('win32', tuple([5, 0, 1234]))) - self.assertEquals(self.make_info(fake_sys('win32', tuple([6, 2, 1234]))).os_version, 'future') - self.assertEquals(self.make_info(fake_sys('win32', tuple([6, 1, 7600]))).os_version, '7sp0') - self.assertEquals(self.make_info(fake_sys('win32', tuple([6, 0, 1234]))).os_version, 'vista') - self.assertEquals(self.make_info(fake_sys('win32', tuple([5, 1, 1234]))).os_version, 'xp') + self.assertEqual(self.make_info(fake_sys('win32', tuple([6, 2, 1234]))).os_version, 'future') + self.assertEqual(self.make_info(fake_sys('win32', tuple([6, 1, 7600]))).os_version, '7sp0') + self.assertEqual(self.make_info(fake_sys('win32', tuple([6, 0, 1234]))).os_version, 'vista') + self.assertEqual(self.make_info(fake_sys('win32', tuple([5, 1, 1234]))).os_version, 'xp') self.assertRaises(AssertionError, self.make_info, fake_sys('win32'), executive=fake_executive('5.0.1234')) - self.assertEquals(self.make_info(fake_sys('cygwin'), executive=fake_executive('6.2.1234')).os_version, 'future') - self.assertEquals(self.make_info(fake_sys('cygwin'), executive=fake_executive('6.1.7600')).os_version, '7sp0') - self.assertEquals(self.make_info(fake_sys('cygwin'), executive=fake_executive('6.0.1234')).os_version, 'vista') - self.assertEquals(self.make_info(fake_sys('cygwin'), executive=fake_executive('5.1.1234')).os_version, 'xp') + self.assertEqual(self.make_info(fake_sys('cygwin'), executive=fake_executive('6.2.1234')).os_version, 'future') + self.assertEqual(self.make_info(fake_sys('cygwin'), executive=fake_executive('6.1.7600')).os_version, '7sp0') + self.assertEqual(self.make_info(fake_sys('cygwin'), executive=fake_executive('6.0.1234')).os_version, 'vista') + self.assertEqual(self.make_info(fake_sys('cygwin'), executive=fake_executive('5.1.1234')).os_version, 'xp') def test_display_name(self): info = self.make_info(fake_sys('darwin')) @@ -169,16 +169,16 @@ class TestPlatformInfo(unittest.TestCase): def test_total_bytes_memory(self): info = self.make_info(fake_sys('darwin'), fake_platform('10.6.3'), fake_executive('1234')) - self.assertEquals(info.total_bytes_memory(), 1234) + self.assertEqual(info.total_bytes_memory(), 1234) info = self.make_info(fake_sys('win32', tuple([6, 1, 7600]))) - self.assertEquals(info.total_bytes_memory(), None) + self.assertEqual(info.total_bytes_memory(), None) info = self.make_info(fake_sys('linux2')) - self.assertEquals(info.total_bytes_memory(), None) + self.assertEqual(info.total_bytes_memory(), None) info = self.make_info(fake_sys('freebsd9')) - self.assertEquals(info.total_bytes_memory(), None) + self.assertEqual(info.total_bytes_memory(), None) if __name__ == '__main__': diff --git a/Tools/Scripts/webkitpy/common/system/user_unittest.py b/Tools/Scripts/webkitpy/common/system/user_unittest.py index 86b9db7d1..bd86d228f 100644 --- a/Tools/Scripts/webkitpy/common/system/user_unittest.py +++ b/Tools/Scripts/webkitpy/common/system/user_unittest.py @@ -120,12 +120,12 @@ class UserTest(unittest.TestCase): expected, inputs = test_case def mock_raw_input(message): - self.assertEquals(expected[0], message) + self.assertEqual(expected[0], message) return inputs[1] result = User().confirm(default=inputs[0], raw_input=mock_raw_input) - self.assertEquals(expected[1], result) + self.assertEqual(expected[1], result) def test_warn_if_application_is_xcode(self): output = OutputCapture() diff --git a/Tools/Scripts/webkitpy/common/system/zipfileset_unittest.py b/Tools/Scripts/webkitpy/common/system/zipfileset_unittest.py index 16a74cbd7..22ba72082 100644 --- a/Tools/Scripts/webkitpy/common/system/zipfileset_unittest.py +++ b/Tools/Scripts/webkitpy/common/system/zipfileset_unittest.py @@ -67,15 +67,15 @@ class ZipFileSetTest(unittest.TestCase): def test_open(self): file = self._zip.open('a/b/some-other-file') - self.assertEquals('a/b/some-other-file', file.name()) - self.assertEquals('other contents', file.contents()) + self.assertEqual('a/b/some-other-file', file.name()) + self.assertEqual('other contents', file.contents()) def test_close(self): zipfileset = ZipFileSet('blah', self._filesystem, self.make_fake_zip) zipfileset.close() def test_read(self): - self.assertEquals('contents', self._zip.read('some-file')) + self.assertEqual('contents', self._zip.read('some-file')) def test_extract(self): self._filesystem.maybe_make_directory('/some-dir') diff --git a/Tools/Scripts/webkitpy/common/watchlist/watchlist_unittest.py b/Tools/Scripts/webkitpy/common/watchlist/watchlist_unittest.py index 09010b288..67ff3b01a 100644 --- a/Tools/Scripts/webkitpy/common/watchlist/watchlist_unittest.py +++ b/Tools/Scripts/webkitpy/common/watchlist/watchlist_unittest.py @@ -52,7 +52,7 @@ class WatchListTest(unittest.TestCase): ' ],' ' },' '}') - self.assertEquals(set([]), watch_list.find_matching_definitions(DIFF_TEST_DATA)) + self.assertEqual(set([]), watch_list.find_matching_definitions(DIFF_TEST_DATA)) def test_filename_definition(self): watch_list = self._watch_list_parser.parse( @@ -68,7 +68,7 @@ class WatchListTest(unittest.TestCase): ' ],' ' },' '}') - self.assertEquals(set(['WatchList1']), watch_list.find_matching_definitions(DIFF_TEST_DATA)) + self.assertEqual(set(['WatchList1']), watch_list.find_matching_definitions(DIFF_TEST_DATA)) def test_cc_rules_simple(self): watch_list = self._watch_list_parser.parse( @@ -85,7 +85,7 @@ class WatchListTest(unittest.TestCase): ' },' '}') cc_and_messages = watch_list.determine_cc_and_messages(DIFF_TEST_DATA) - self.assertEquals({ + self.assertEqual({ 'cc_list': ['levin@chromium.org'], 'messages': [], }, cc_and_messages) @@ -109,7 +109,7 @@ class WatchListTest(unittest.TestCase): ' },' '}') cc_and_messages = watch_list.determine_cc_and_messages(DIFF_TEST_DATA) - self.assertEquals({ + self.assertEqual({ 'cc_list': ['levin@chromium.org'], 'messages': [], }, cc_and_messages) @@ -136,7 +136,7 @@ class WatchListTest(unittest.TestCase): ' },' '}') cc_and_messages = watch_list.determine_cc_and_messages(DIFF_TEST_DATA) - self.assertEquals({ + self.assertEqual({ 'cc_list': ['levin@chromium.org'], 'messages': ['msg1', 'msg2'], }, cc_and_messages) @@ -163,7 +163,7 @@ class WatchListTest(unittest.TestCase): ' },' '}') cc_and_messages = watch_list.determine_cc_and_messages(DIFF_TEST_DATA) - self.assertEquals({ + self.assertEqual({ 'cc_list': [], 'messages': [], }, cc_and_messages) @@ -185,7 +185,7 @@ class WatchListTest(unittest.TestCase): ' },' '}') cc_and_messages = watch_list.determine_cc_and_messages(DIFF_TEST_DATA) - self.assertEquals({ + self.assertEqual({ 'cc_list': ['eric@webkit.org'], 'messages': [], }, cc_and_messages) @@ -207,7 +207,7 @@ class WatchListTest(unittest.TestCase): ' },' '}') cc_and_messages = watch_list.determine_cc_and_messages(DIFF_TEST_DATA) - self.assertEquals({ + self.assertEqual({ 'cc_list': ['abarth@webkit.org'], 'messages': [], }, cc_and_messages) @@ -236,7 +236,7 @@ class WatchListTest(unittest.TestCase): ' },' '}') cc_and_messages = watch_list.determine_cc_and_messages(DIFF_TEST_DATA) - self.assertEquals({ + self.assertEqual({ 'cc_list': ['levin@chromium.org'], 'messages': ["Test message."], }, cc_and_messages) @@ -271,7 +271,7 @@ class WatchListTest(unittest.TestCase): ' },' '}') cc_and_messages = watch_list.determine_cc_and_messages(DIFF_TEST_DATA) - self.assertEquals({ + self.assertEqual({ 'cc_list': ['eric@webkit.org'], 'messages': ["This is a test message."], }, cc_and_messages) diff --git a/Tools/Scripts/webkitpy/common/webkit_finder.py b/Tools/Scripts/webkitpy/common/webkit_finder.py new file mode 100644 index 000000000..3705ef37f --- /dev/null +++ b/Tools/Scripts/webkitpy/common/webkit_finder.py @@ -0,0 +1,65 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +class WebKitFinder(object): + def __init__(self, filesystem): + self._filesystem = filesystem + self._webkit_base = None + + def webkit_base(self): + """Returns the absolute path to the top of the WebKit tree. + + Raises an AssertionError if the top dir can't be determined.""" + # Note: This code somewhat duplicates the code in + # scm.find_checkout_root(). However, that code only works if the top + # of the SCM repository also matches the top of the WebKit tree. Some SVN users + # (the chromium test bots, for example), might only check out subdirectories like + # Tools/Scripts. This code will also work if there is no SCM system at all. + if not self._webkit_base: + self._webkit_base = self._webkit_base + module_path = self._filesystem.path_to_module(self.__module__) + tools_index = module_path.find('Tools') + assert tools_index != -1, "could not find location of this checkout from %s" % module_path + self._webkit_base = self._filesystem.normpath(module_path[0:tools_index - 1]) + return self._webkit_base + + def path_from_webkit_base(self, *comps): + return self._filesystem.join(self.webkit_base(), *comps) + + def path_to_script(self, script_name): + """Returns the relative path to the script from the top of the WebKit tree.""" + # This is intentionally relative in order to force callers to consider what + # their current working directory is (and change to the top of the tree if necessary). + return self._filesystem.join("Tools", "Scripts", script_name) + + def layout_tests_dir(self): + return self.path_from_webkit_base('LayoutTests') + + def perf_tests_dir(self): + return self.path_from_webkit_base('PerformanceTests') diff --git a/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner_unittest.py b/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner_unittest.py index 4efa4e00c..501fb4326 100644 --- a/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner_unittest.py @@ -75,14 +75,14 @@ class LockCheckingRunner(LayoutTestRunner): def handle_finished_list(self, source, list_name, num_tests, elapsed_time): if not self._finished_list_called: - self._tester.assertEquals(list_name, 'locked_tests') + self._tester.assertEqual(list_name, 'locked_tests') self._tester.assertTrue(self._remaining_locked_shards) self._tester.assertTrue(self._has_http_lock is self._should_have_http_lock) super(LockCheckingRunner, self).handle_finished_list(source, list_name, num_tests, elapsed_time) if not self._finished_list_called: - self._tester.assertEquals(self._remaining_locked_shards, []) + self._tester.assertEqual(self._remaining_locked_shards, []) self._tester.assertFalse(self._has_http_lock) self._finished_list_called = True @@ -136,8 +136,8 @@ class LayoutTestRunnerTests(unittest.TestCase): # Interrupt if we've exceeded either limit: runner._options.exit_after_n_crashes_or_timeouts = 10 self.assertRaises(TestRunInterruptedException, runner._interrupt_if_at_failure_limits, result_summary) - self.assertEquals(result_summary.results['passes/text.html'].type, test_expectations.SKIP) - self.assertEquals(result_summary.results['passes/image.html'].type, test_expectations.SKIP) + self.assertEqual(result_summary.results['passes/text.html'].type, test_expectations.SKIP) + self.assertEqual(result_summary.results['passes/image.html'].type, test_expectations.SKIP) runner._options.exit_after_n_crashes_or_timeouts = None runner._options.exit_after_n_failures = 10 @@ -154,14 +154,14 @@ class LayoutTestRunnerTests(unittest.TestCase): result_summary = ResultSummary(expectations, [test], 1, set()) result = TestResult(test_name=test, failures=[test_failures.FailureReftestMismatchDidNotOccur()], reftest_type=['!=']) runner._update_summary_with_result(result_summary, result) - self.assertEquals(1, result_summary.expected) - self.assertEquals(0, result_summary.unexpected) + self.assertEqual(1, result_summary.expected) + self.assertEqual(0, result_summary.unexpected) result_summary = ResultSummary(expectations, [test], 1, set()) result = TestResult(test_name=test, failures=[], reftest_type=['==']) runner._update_summary_with_result(result_summary, result) - self.assertEquals(0, result_summary.expected) - self.assertEquals(1, result_summary.unexpected) + self.assertEqual(0, result_summary.expected) + self.assertEqual(1, result_summary.unexpected) def test_servers_started(self): @@ -189,31 +189,31 @@ class LayoutTestRunnerTests(unittest.TestCase): runner._needs_http = True runner._needs_websockets = False runner.start_servers_with_lock(number_of_servers=4) - self.assertEquals(self.http_started, True) - self.assertEquals(self.websocket_started, False) + self.assertEqual(self.http_started, True) + self.assertEqual(self.websocket_started, False) runner.stop_servers_with_lock() - self.assertEquals(self.http_stopped, True) - self.assertEquals(self.websocket_stopped, False) + self.assertEqual(self.http_stopped, True) + self.assertEqual(self.websocket_stopped, False) self.http_started = self.http_stopped = self.websocket_started = self.websocket_stopped = False runner._needs_http = True runner._needs_websockets = True runner.start_servers_with_lock(number_of_servers=4) - self.assertEquals(self.http_started, True) - self.assertEquals(self.websocket_started, True) + self.assertEqual(self.http_started, True) + self.assertEqual(self.websocket_started, True) runner.stop_servers_with_lock() - self.assertEquals(self.http_stopped, True) - self.assertEquals(self.websocket_stopped, True) + self.assertEqual(self.http_stopped, True) + self.assertEqual(self.websocket_stopped, True) self.http_started = self.http_stopped = self.websocket_started = self.websocket_stopped = False runner._needs_http = False runner._needs_websockets = False runner.start_servers_with_lock(number_of_servers=4) - self.assertEquals(self.http_started, False) - self.assertEquals(self.websocket_started, False) + self.assertEqual(self.http_started, False) + self.assertEqual(self.websocket_started, False) runner.stop_servers_with_lock() - self.assertEquals(self.http_stopped, False) - self.assertEquals(self.websocket_stopped, False) + self.assertEqual(self.http_stopped, False) + self.assertEqual(self.websocket_stopped, False) class SharderTests(unittest.TestCase): @@ -245,11 +245,11 @@ class SharderTests(unittest.TestCase): return self.sharder.shard_tests([self.get_test_input(test) for test in test_list], num_workers, fully_parallel) def assert_shards(self, actual_shards, expected_shard_names): - self.assertEquals(len(actual_shards), len(expected_shard_names)) + self.assertEqual(len(actual_shards), len(expected_shard_names)) for i, shard in enumerate(actual_shards): expected_shard_name, expected_test_names = expected_shard_names[i] - self.assertEquals(shard.name, expected_shard_name) - self.assertEquals([test_input.test_name for test_input in shard.test_inputs], + self.assertEqual(shard.name, expected_shard_name) + self.assertEqual([test_input.test_name for test_input in shard.test_inputs], expected_test_names) def test_shard_by_dir(self): @@ -307,14 +307,14 @@ class SharderTests(unittest.TestCase): def test_shard_in_two_has_no_locked_shards(self): locked, unlocked = self.get_shards(num_workers=1, fully_parallel=False, test_list=['animations/keyframe.html']) - self.assertEquals(len(locked), 0) - self.assertEquals(len(unlocked), 1) + self.assertEqual(len(locked), 0) + self.assertEqual(len(unlocked), 1) def test_shard_in_two_has_no_unlocked_shards(self): locked, unlocked = self.get_shards(num_workers=1, fully_parallel=False, test_list=['http/tests/websocket/tests/unicode.htm']) - self.assertEquals(len(locked), 1) - self.assertEquals(len(unlocked), 0) + self.assertEqual(len(locked), 1) + self.assertEqual(len(unlocked), 0) def test_multiple_locked_shards(self): locked, unlocked = self.get_shards(num_workers=4, fully_parallel=False, max_locked_shards=2) @@ -339,7 +339,7 @@ class SharderTests(unittest.TestCase): class NaturalCompareTest(unittest.TestCase): def assert_cmp(self, x, y, result): - self.assertEquals(cmp(Sharder.natural_sort_key(x), Sharder.natural_sort_key(y)), result) + self.assertEqual(cmp(Sharder.natural_sort_key(x), Sharder.natural_sort_key(y)), result) def test_natural_compare(self): self.assert_cmp('a', 'a', 0) @@ -369,7 +369,7 @@ class KeyCompareTest(unittest.TestCase): self.sharder = Sharder(split, '/', 1) def assert_cmp(self, x, y, result): - self.assertEquals(cmp(self.sharder.test_key(x), self.sharder.test_key(y)), result) + self.assertEqual(cmp(self.sharder.test_key(x), self.sharder.test_key(y)), result) def test_test_key(self): self.assert_cmp('/a', '/a', 0) diff --git a/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py b/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py index 636edd2be..cc2f0f9b9 100644 --- a/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py +++ b/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py @@ -300,9 +300,6 @@ class Manager(object): def _http_tests(self): return set(test for test in self._test_names if self._is_http_test(test)) - def _websocket_tests(self): - return set(test for test in self._test_files if self._is_websocket(test)) - def _is_perf_test(self, test): return self.PERF_SUBDIR == test or (self.PERF_SUBDIR + self._port.TEST_PATH_SEPARATOR) in test diff --git a/Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py b/Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py index 5c43b6ac6..ec99cf6b4 100644 --- a/Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py @@ -51,22 +51,22 @@ class TestConfigurationTest(unittest.TestCase): result_config_dict = {} for category, specifier in config.items(): result_config_dict[category] = specifier - self.assertEquals({'version': 'xp', 'architecture': 'x86', 'build_type': 'release'}, result_config_dict) + self.assertEqual({'version': 'xp', 'architecture': 'x86', 'build_type': 'release'}, result_config_dict) def test_keys(self): config = TestConfiguration('xp', 'x86', 'release') result_config_keys = [] for category in config.keys(): result_config_keys.append(category) - self.assertEquals(set(['version', 'architecture', 'build_type']), set(result_config_keys)) + self.assertEqual(set(['version', 'architecture', 'build_type']), set(result_config_keys)) def test_str(self): config = TestConfiguration('xp', 'x86', 'release') - self.assertEquals('<xp, x86, release>', str(config)) + self.assertEqual('<xp, x86, release>', str(config)) def test_repr(self): config = TestConfiguration('xp', 'x86', 'release') - self.assertEquals("TestConfig(version='xp', architecture='x86', build_type='release')", repr(config)) + self.assertEqual("TestConfig(version='xp', architecture='x86', build_type='release')", repr(config)) def test_hash(self): config_dict = {} @@ -81,11 +81,11 @@ class TestConfigurationTest(unittest.TestCase): self.assertTrue(TestConfiguration('xp', 'x86', 'release') in config_dict) self.assertFalse(TestConfiguration('xp', 'x86', 'debug') in config_dict) configs_list = [TestConfiguration('xp', 'x86', 'release'), TestConfiguration('xp', 'x86', 'debug'), TestConfiguration('xp', 'x86', 'debug')] - self.assertEquals(len(configs_list), 3) - self.assertEquals(len(set(configs_list)), 2) + self.assertEqual(len(configs_list), 3) + self.assertEqual(len(set(configs_list)), 2) def test_eq(self): - self.assertEquals(TestConfiguration('xp', 'x86', 'release'), TestConfiguration('xp', 'x86', 'release')) + self.assertEqual(TestConfiguration('xp', 'x86', 'release'), TestConfiguration('xp', 'x86', 'release')) self.assertNotEquals(TestConfiguration('xp', 'x86', 'release'), TestConfiguration('xp', 'x86', 'debug')) def test_values(self): @@ -93,7 +93,7 @@ class TestConfigurationTest(unittest.TestCase): result_config_values = [] for value in config.values(): result_config_values.append(value) - self.assertEquals(set(['xp', 'x86', 'release']), set(result_config_values)) + self.assertEqual(set(['xp', 'x86', 'release']), set(result_config_values)) class SpecifierSorterTest(unittest.TestCase): @@ -103,48 +103,48 @@ class SpecifierSorterTest(unittest.TestCase): def test_init(self): sorter = SpecifierSorter() - self.assertEquals(sorter.category_for_specifier('control'), None) + self.assertEqual(sorter.category_for_specifier('control'), None) sorter = SpecifierSorter(self._all_test_configurations) - self.assertEquals(sorter.category_for_specifier('xp'), 'version') + self.assertEqual(sorter.category_for_specifier('xp'), 'version') sorter = SpecifierSorter(self._all_test_configurations, MOCK_MACROS) - self.assertEquals(sorter.category_for_specifier('mac'), 'version') + self.assertEqual(sorter.category_for_specifier('mac'), 'version') def test_add_specifier(self): sorter = SpecifierSorter() - self.assertEquals(sorter.category_for_specifier('control'), None) + self.assertEqual(sorter.category_for_specifier('control'), None) sorter.add_specifier('version', 'control') - self.assertEquals(sorter.category_for_specifier('control'), 'version') + self.assertEqual(sorter.category_for_specifier('control'), 'version') sorter.add_specifier('version', 'one') - self.assertEquals(sorter.category_for_specifier('one'), 'version') + self.assertEqual(sorter.category_for_specifier('one'), 'version') sorter.add_specifier('architecture', 'renaissance') - self.assertEquals(sorter.category_for_specifier('one'), 'version') - self.assertEquals(sorter.category_for_specifier('renaissance'), 'architecture') + self.assertEqual(sorter.category_for_specifier('one'), 'version') + self.assertEqual(sorter.category_for_specifier('renaissance'), 'architecture') def test_add_macros(self): sorter = SpecifierSorter(self._all_test_configurations) sorter.add_macros(MOCK_MACROS) - self.assertEquals(sorter.category_for_specifier('mac'), 'version') - self.assertEquals(sorter.category_for_specifier('win'), 'version') - self.assertEquals(sorter.category_for_specifier('x86'), 'architecture') + self.assertEqual(sorter.category_for_specifier('mac'), 'version') + self.assertEqual(sorter.category_for_specifier('win'), 'version') + self.assertEqual(sorter.category_for_specifier('x86'), 'architecture') def test_category_priority(self): sorter = SpecifierSorter(self._all_test_configurations) - self.assertEquals(sorter.category_priority('version'), 0) - self.assertEquals(sorter.category_priority('build_type'), 2) + self.assertEqual(sorter.category_priority('version'), 0) + self.assertEqual(sorter.category_priority('build_type'), 2) def test_specifier_priority(self): sorter = SpecifierSorter(self._all_test_configurations) - self.assertEquals(sorter.specifier_priority('x86'), 1) - self.assertEquals(sorter.specifier_priority('snowleopard'), 0) + self.assertEqual(sorter.specifier_priority('x86'), 1) + self.assertEqual(sorter.specifier_priority('snowleopard'), 0) def test_sort_specifiers(self): sorter = SpecifierSorter(self._all_test_configurations, MOCK_MACROS) - self.assertEquals(sorter.sort_specifiers(set()), []) - self.assertEquals(sorter.sort_specifiers(set(['x86'])), ['x86']) - self.assertEquals(sorter.sort_specifiers(set(['x86', 'win7'])), ['win7', 'x86']) - self.assertEquals(sorter.sort_specifiers(set(['x86', 'debug', 'win7'])), ['win7', 'x86', 'debug']) - self.assertEquals(sorter.sort_specifiers(set(['snowleopard', 'x86', 'debug', 'win7'])), ['snowleopard', 'win7', 'x86', 'debug']) - self.assertEquals(sorter.sort_specifiers(set(['x86', 'mac', 'debug', 'win7'])), ['mac', 'win7', 'x86', 'debug']) + self.assertEqual(sorter.sort_specifiers(set()), []) + self.assertEqual(sorter.sort_specifiers(set(['x86'])), ['x86']) + self.assertEqual(sorter.sort_specifiers(set(['x86', 'win7'])), ['win7', 'x86']) + self.assertEqual(sorter.sort_specifiers(set(['x86', 'debug', 'win7'])), ['win7', 'x86', 'debug']) + self.assertEqual(sorter.sort_specifiers(set(['snowleopard', 'x86', 'debug', 'win7'])), ['snowleopard', 'win7', 'x86', 'debug']) + self.assertEqual(sorter.sort_specifiers(set(['x86', 'mac', 'debug', 'win7'])), ['mac', 'win7', 'x86', 'debug']) class TestConfigurationConverterTest(unittest.TestCase): @@ -153,28 +153,28 @@ class TestConfigurationConverterTest(unittest.TestCase): unittest.TestCase.__init__(self, testFunc) def test_symmetric_difference(self): - self.assertEquals(TestConfigurationConverter.symmetric_difference([set(['a', 'b']), set(['b', 'c'])]), set(['a', 'c'])) - self.assertEquals(TestConfigurationConverter.symmetric_difference([set(['a', 'b']), set(['b', 'c']), set(['b', 'd'])]), set(['a', 'c', 'd'])) + self.assertEqual(TestConfigurationConverter.symmetric_difference([set(['a', 'b']), set(['b', 'c'])]), set(['a', 'c'])) + self.assertEqual(TestConfigurationConverter.symmetric_difference([set(['a', 'b']), set(['b', 'c']), set(['b', 'd'])]), set(['a', 'c', 'd'])) def test_to_config_set(self): converter = TestConfigurationConverter(self._all_test_configurations) - self.assertEquals(converter.to_config_set(set()), self._all_test_configurations) + self.assertEqual(converter.to_config_set(set()), self._all_test_configurations) - self.assertEquals(converter.to_config_set(set(['foo'])), set()) + self.assertEqual(converter.to_config_set(set(['foo'])), set()) - self.assertEquals(converter.to_config_set(set(['xp', 'foo'])), set()) + self.assertEqual(converter.to_config_set(set(['xp', 'foo'])), set()) errors = [] - self.assertEquals(converter.to_config_set(set(['xp', 'foo']), errors), set()) - self.assertEquals(errors, ["Unrecognized modifier 'foo'"]) + self.assertEqual(converter.to_config_set(set(['xp', 'foo']), errors), set()) + self.assertEqual(errors, ["Unrecognized modifier 'foo'"]) - self.assertEquals(converter.to_config_set(set(['xp', 'x86_64'])), set()) + self.assertEqual(converter.to_config_set(set(['xp', 'x86_64'])), set()) configs_to_match = set([ TestConfiguration('xp', 'x86', 'release'), ]) - self.assertEquals(converter.to_config_set(set(['xp', 'release'])), configs_to_match) + self.assertEqual(converter.to_config_set(set(['xp', 'release'])), configs_to_match) configs_to_match = set([ TestConfiguration('snowleopard', 'x86', 'release'), @@ -184,13 +184,13 @@ class TestConfigurationConverterTest(unittest.TestCase): TestConfiguration('lucid', 'x86', 'release'), TestConfiguration('lucid', 'x86_64', 'release'), ]) - self.assertEquals(converter.to_config_set(set(['release'])), configs_to_match) + self.assertEqual(converter.to_config_set(set(['release'])), configs_to_match) configs_to_match = set([ TestConfiguration('lucid', 'x86_64', 'release'), TestConfiguration('lucid', 'x86_64', 'debug'), ]) - self.assertEquals(converter.to_config_set(set(['x86_64'])), configs_to_match) + self.assertEqual(converter.to_config_set(set(['x86_64'])), configs_to_match) configs_to_match = set([ TestConfiguration('lucid', 'x86_64', 'release'), @@ -200,7 +200,7 @@ class TestConfigurationConverterTest(unittest.TestCase): TestConfiguration('snowleopard', 'x86', 'release'), TestConfiguration('snowleopard', 'x86', 'debug'), ]) - self.assertEquals(converter.to_config_set(set(['lucid', 'snowleopard'])), configs_to_match) + self.assertEqual(converter.to_config_set(set(['lucid', 'snowleopard'])), configs_to_match) configs_to_match = set([ TestConfiguration('lucid', 'x86', 'release'), @@ -208,14 +208,14 @@ class TestConfigurationConverterTest(unittest.TestCase): TestConfiguration('snowleopard', 'x86', 'release'), TestConfiguration('snowleopard', 'x86', 'debug'), ]) - self.assertEquals(converter.to_config_set(set(['lucid', 'snowleopard', 'x86'])), configs_to_match) + self.assertEqual(converter.to_config_set(set(['lucid', 'snowleopard', 'x86'])), configs_to_match) configs_to_match = set([ TestConfiguration('lucid', 'x86_64', 'release'), TestConfiguration('lucid', 'x86', 'release'), TestConfiguration('snowleopard', 'x86', 'release'), ]) - self.assertEquals(converter.to_config_set(set(['lucid', 'snowleopard', 'release'])), configs_to_match) + self.assertEqual(converter.to_config_set(set(['lucid', 'snowleopard', 'release'])), configs_to_match) def test_macro_expansion(self): converter = TestConfigurationConverter(self._all_test_configurations, MOCK_MACROS) @@ -225,7 +225,7 @@ class TestConfigurationConverterTest(unittest.TestCase): TestConfiguration('vista', 'x86', 'release'), TestConfiguration('win7', 'x86', 'release'), ]) - self.assertEquals(converter.to_config_set(set(['win', 'release'])), configs_to_match) + self.assertEqual(converter.to_config_set(set(['win', 'release'])), configs_to_match) configs_to_match = set([ TestConfiguration('xp', 'x86', 'release'), @@ -234,7 +234,7 @@ class TestConfigurationConverterTest(unittest.TestCase): TestConfiguration('lucid', 'x86', 'release'), TestConfiguration('lucid', 'x86_64', 'release'), ]) - self.assertEquals(converter.to_config_set(set(['win', 'lucid', 'release'])), configs_to_match) + self.assertEqual(converter.to_config_set(set(['win', 'lucid', 'release'])), configs_to_match) configs_to_match = set([ TestConfiguration('xp', 'x86', 'release'), @@ -242,30 +242,30 @@ class TestConfigurationConverterTest(unittest.TestCase): TestConfiguration('win7', 'x86', 'release'), TestConfiguration('snowleopard', 'x86', 'release'), ]) - self.assertEquals(converter.to_config_set(set(['win', 'mac', 'release'])), configs_to_match) + self.assertEqual(converter.to_config_set(set(['win', 'mac', 'release'])), configs_to_match) def test_to_specifier_lists(self): converter = TestConfigurationConverter(self._all_test_configurations, MOCK_MACROS) - self.assertEquals(converter.to_specifiers_list(set(self._all_test_configurations)), [[]]) - self.assertEquals(converter.to_specifiers_list(set()), []) + self.assertEqual(converter.to_specifiers_list(set(self._all_test_configurations)), [[]]) + self.assertEqual(converter.to_specifiers_list(set()), []) configs_to_match = set([ TestConfiguration('xp', 'x86', 'release'), ]) - self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['release', 'xp'])]) + self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['release', 'xp'])]) configs_to_match = set([ TestConfiguration('xp', 'x86', 'release'), TestConfiguration('xp', 'x86', 'debug'), ]) - self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['xp'])]) + self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['xp'])]) configs_to_match = set([ TestConfiguration('lucid', 'x86_64', 'debug'), TestConfiguration('xp', 'x86', 'release'), ]) - self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['release', 'xp']), set(['debug', 'x86_64', 'linux'])]) + self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['release', 'xp']), set(['debug', 'x86_64', 'linux'])]) configs_to_match = set([ TestConfiguration('xp', 'x86', 'release'), @@ -275,7 +275,7 @@ class TestConfigurationConverterTest(unittest.TestCase): TestConfiguration('lucid', 'x86_64', 'debug'), TestConfiguration('lucid', 'x86', 'debug'), ]) - self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['release', 'xp']), set(['debug', 'linux'])]) + self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['release', 'xp']), set(['debug', 'linux'])]) configs_to_match = set([ TestConfiguration('xp', 'x86', 'release'), @@ -285,13 +285,13 @@ class TestConfigurationConverterTest(unittest.TestCase): TestConfiguration('lucid', 'x86', 'release'), TestConfiguration('lucid', 'x86_64', 'release'), ]) - self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['release'])]) + self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['release'])]) configs_to_match = set([ TestConfiguration('xp', 'x86', 'release'), TestConfiguration('snowleopard', 'x86', 'release'), ]) - self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['xp', 'mac', 'release'])]) + self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['xp', 'mac', 'release'])]) configs_to_match = set([ TestConfiguration('xp', 'x86', 'release'), @@ -300,26 +300,26 @@ class TestConfigurationConverterTest(unittest.TestCase): TestConfiguration('win7', 'x86', 'debug'), TestConfiguration('lucid', 'x86', 'release'), ]) - self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['win7']), set(['release', 'linux', 'x86']), set(['release', 'xp', 'mac'])]) + self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win7']), set(['release', 'linux', 'x86']), set(['release', 'xp', 'mac'])]) def test_macro_collapsing(self): macros = {'foo': ['bar', 'baz'], 'people': ['bob', 'alice', 'john']} specifiers_list = [set(['john', 'godzilla', 'bob', 'alice'])] TestConfigurationConverter.collapse_macros(macros, specifiers_list) - self.assertEquals(specifiers_list, [set(['people', 'godzilla'])]) + self.assertEqual(specifiers_list, [set(['people', 'godzilla'])]) specifiers_list = [set(['john', 'godzilla', 'alice'])] TestConfigurationConverter.collapse_macros(macros, specifiers_list) - self.assertEquals(specifiers_list, [set(['john', 'godzilla', 'alice', 'godzilla'])]) + self.assertEqual(specifiers_list, [set(['john', 'godzilla', 'alice', 'godzilla'])]) specifiers_list = [set(['bar', 'godzilla', 'baz', 'bob', 'alice', 'john'])] TestConfigurationConverter.collapse_macros(macros, specifiers_list) - self.assertEquals(specifiers_list, [set(['foo', 'godzilla', 'people'])]) + self.assertEqual(specifiers_list, [set(['foo', 'godzilla', 'people'])]) specifiers_list = [set(['bar', 'godzilla', 'baz', 'bob']), set(['bar', 'baz']), set(['people', 'alice', 'bob', 'john'])] TestConfigurationConverter.collapse_macros(macros, specifiers_list) - self.assertEquals(specifiers_list, [set(['bob', 'foo', 'godzilla']), set(['foo']), set(['people'])]) + self.assertEqual(specifiers_list, [set(['bob', 'foo', 'godzilla']), set(['foo']), set(['people'])]) def test_converter_macro_collapsing(self): converter = TestConfigurationConverter(self._all_test_configurations, MOCK_MACROS) @@ -329,7 +329,7 @@ class TestConfigurationConverterTest(unittest.TestCase): TestConfiguration('vista', 'x86', 'release'), TestConfiguration('win7', 'x86', 'release'), ]) - self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['win', 'release'])]) + self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win', 'release'])]) configs_to_match = set([ TestConfiguration('xp', 'x86', 'release'), @@ -338,7 +338,7 @@ class TestConfigurationConverterTest(unittest.TestCase): TestConfiguration('lucid', 'x86', 'release'), TestConfiguration('lucid', 'x86_64', 'release'), ]) - self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['win', 'linux', 'release'])]) + self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win', 'linux', 'release'])]) configs_to_match = set([ TestConfiguration('xp', 'x86', 'release'), @@ -346,7 +346,7 @@ class TestConfigurationConverterTest(unittest.TestCase): TestConfiguration('win7', 'x86', 'release'), TestConfiguration('snowleopard', 'x86', 'release'), ]) - self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['win', 'mac', 'release'])]) + self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win', 'mac', 'release'])]) configs_to_match = set([ TestConfiguration('xp', 'x86', 'release'), @@ -354,16 +354,16 @@ class TestConfigurationConverterTest(unittest.TestCase): TestConfiguration('win7', 'x86', 'release'), TestConfiguration('snowleopard', 'x86', 'release'), ]) - self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['win', 'mac', 'release'])]) + self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win', 'mac', 'release'])]) configs_to_match = set([ TestConfiguration('xp', 'x86', 'release'), TestConfiguration('vista', 'x86', 'release'), TestConfiguration('win7', 'x86', 'release'), ]) - self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['win', 'release'])]) + self.assertEqual(converter.to_specifiers_list(configs_to_match), [set(['win', 'release'])]) def test_specifier_converter_access(self): specifier_sorter = TestConfigurationConverter(self._all_test_configurations, MOCK_MACROS).specifier_sorter() - self.assertEquals(specifier_sorter.category_for_specifier('snowleopard'), 'version') - self.assertEquals(specifier_sorter.category_for_specifier('mac'), 'version') + self.assertEqual(specifier_sorter.category_for_specifier('snowleopard'), 'version') + self.assertEqual(specifier_sorter.category_for_specifier('mac'), 'version') diff --git a/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py b/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py index d78ae3f2b..bbe031cde 100644 --- a/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py @@ -84,7 +84,7 @@ Bug(test) failures/expected/image.html [ WontFix Mac ] self._exp = TestExpectations(self._port, self.get_basic_tests(), expectations_to_lint=expectations_to_lint) def assert_exp(self, test, result): - self.assertEquals(self._exp.get_expectations(self.get_test(test)), + self.assertEqual(self._exp.get_expectations(self.get_test(test)), set([result])) def assert_bad_expectations(self, expectations, overrides=None): @@ -109,29 +109,29 @@ class MiscTests(Base): def test_result_was_expected(self): # test basics - self.assertEquals(TestExpectations.result_was_expected(PASS, set([PASS]), test_needs_rebaselining=False, test_is_skipped=False), True) - self.assertEquals(TestExpectations.result_was_expected(FAIL, set([PASS]), test_needs_rebaselining=False, test_is_skipped=False), False) + self.assertEqual(TestExpectations.result_was_expected(PASS, set([PASS]), test_needs_rebaselining=False, test_is_skipped=False), True) + self.assertEqual(TestExpectations.result_was_expected(FAIL, set([PASS]), test_needs_rebaselining=False, test_is_skipped=False), False) # test handling of SKIPped tests and results - self.assertEquals(TestExpectations.result_was_expected(SKIP, set([CRASH]), test_needs_rebaselining=False, test_is_skipped=True), True) - self.assertEquals(TestExpectations.result_was_expected(SKIP, set([CRASH]), test_needs_rebaselining=False, test_is_skipped=False), False) + self.assertEqual(TestExpectations.result_was_expected(SKIP, set([CRASH]), test_needs_rebaselining=False, test_is_skipped=True), True) + self.assertEqual(TestExpectations.result_was_expected(SKIP, set([CRASH]), test_needs_rebaselining=False, test_is_skipped=False), False) # test handling of MISSING results and the REBASELINE modifier - self.assertEquals(TestExpectations.result_was_expected(MISSING, set([PASS]), test_needs_rebaselining=True, test_is_skipped=False), True) - self.assertEquals(TestExpectations.result_was_expected(MISSING, set([PASS]), test_needs_rebaselining=False, test_is_skipped=False), False) + self.assertEqual(TestExpectations.result_was_expected(MISSING, set([PASS]), test_needs_rebaselining=True, test_is_skipped=False), True) + self.assertEqual(TestExpectations.result_was_expected(MISSING, set([PASS]), test_needs_rebaselining=False, test_is_skipped=False), False) def test_remove_pixel_failures(self): - self.assertEquals(TestExpectations.remove_pixel_failures(set([FAIL])), set([FAIL])) - self.assertEquals(TestExpectations.remove_pixel_failures(set([PASS])), set([PASS])) - self.assertEquals(TestExpectations.remove_pixel_failures(set([IMAGE])), set([PASS])) - self.assertEquals(TestExpectations.remove_pixel_failures(set([FAIL])), set([FAIL])) - self.assertEquals(TestExpectations.remove_pixel_failures(set([PASS, IMAGE, CRASH])), set([PASS, CRASH])) + self.assertEqual(TestExpectations.remove_pixel_failures(set([FAIL])), set([FAIL])) + self.assertEqual(TestExpectations.remove_pixel_failures(set([PASS])), set([PASS])) + self.assertEqual(TestExpectations.remove_pixel_failures(set([IMAGE])), set([PASS])) + self.assertEqual(TestExpectations.remove_pixel_failures(set([FAIL])), set([FAIL])) + self.assertEqual(TestExpectations.remove_pixel_failures(set([PASS, IMAGE, CRASH])), set([PASS, CRASH])) def test_suffixes_for_expectations(self): - self.assertEquals(TestExpectations.suffixes_for_expectations(set([FAIL])), set(['txt', 'png', 'wav'])) - self.assertEquals(TestExpectations.suffixes_for_expectations(set([IMAGE])), set(['png'])) - self.assertEquals(TestExpectations.suffixes_for_expectations(set([FAIL, IMAGE, CRASH])), set(['txt', 'png', 'wav'])) - self.assertEquals(TestExpectations.suffixes_for_expectations(set()), set()) + self.assertEqual(TestExpectations.suffixes_for_expectations(set([FAIL])), set(['txt', 'png', 'wav'])) + self.assertEqual(TestExpectations.suffixes_for_expectations(set([IMAGE])), set(['png'])) + self.assertEqual(TestExpectations.suffixes_for_expectations(set([FAIL, IMAGE, CRASH])), set(['txt', 'png', 'wav'])) + self.assertEqual(TestExpectations.suffixes_for_expectations(set()), set()) def test_category_expectations(self): # This test checks unknown tests are not present in the @@ -152,7 +152,7 @@ class MiscTests(Base): def test_get_expectations_string(self): self.parse_exp(self.get_basic_expectations()) - self.assertEquals(self._exp.get_expectations_string( + self.assertEqual(self._exp.get_expectations_string( self.get_test('failures/expected/text.html')), 'FAIL') @@ -261,9 +261,9 @@ class SkippedTests(Base): exp = TestExpectations(port, ['failures/expected/text.html'], expectations_to_lint=expectations_to_lint) # Check that the expectation is for BUG_DUMMY SKIP : ... [ Pass ] - self.assertEquals(exp.get_modifiers('failures/expected/text.html'), + self.assertEqual(exp.get_modifiers('failures/expected/text.html'), [TestExpectationParser.DUMMY_BUG_MODIFIER, TestExpectationParser.SKIP_MODIFIER, TestExpectationParser.WONTFIX_MODIFIER]) - self.assertEquals(exp.get_expectations('failures/expected/text.html'), set([PASS])) + self.assertEqual(exp.get_expectations('failures/expected/text.html'), set([PASS])) def test_skipped_tests_work(self): self.check(expectations='', overrides=None, skips=['failures/expected/text.html']) @@ -317,13 +317,13 @@ class ExpectationSyntaxTests(Base): filename = 'TestExpectations' line_number = 1 expectation_line = TestExpectationParser._tokenize_line(filename, line, line_number) - self.assertEquals(expectation_line.warnings, warnings) - self.assertEquals(expectation_line.name, name) - self.assertEquals(expectation_line.filename, filename) - self.assertEquals(expectation_line.line_number, line_number) + self.assertEqual(expectation_line.warnings, warnings) + self.assertEqual(expectation_line.name, name) + self.assertEqual(expectation_line.filename, filename) + self.assertEqual(expectation_line.line_number, line_number) if not warnings: - self.assertEquals(expectation_line.modifiers, modifiers) - self.assertEquals(expectation_line.expectations, expectations) + self.assertEqual(expectation_line.modifiers, modifiers) + self.assertEqual(expectation_line.expectations, expectations) def test_bare_name(self): self.assert_tokenize_exp('foo.html', modifiers=['SKIP'], expectations=['PASS']) @@ -378,7 +378,7 @@ class SemanticTests(Base): self.parse_exp('BUG1234 failures/expected/text.html [ Failure ]', is_lint_mode=True) self.fail('should have raised an error about a bad bug identifier') except ParseError, exp: - self.assertEquals(len(exp.warnings), 1) + self.assertEqual(len(exp.warnings), 1) def test_missing_bugid(self): self.parse_exp('failures/expected/text.html [ Failure ]') @@ -389,7 +389,7 @@ class SemanticTests(Base): self.parse_exp('failures/expected/text.html [ Failure ]') line = self._exp._model.get_expectation_line('failures/expected/text.html') self.assertFalse(line.is_invalid()) - self.assertEquals(line.warnings, ['Test lacks BUG modifier.']) + self.assertEqual(line.warnings, ['Test lacks BUG modifier.']) def test_skip_and_wontfix(self): # Skip and WontFix are not allowed to have other expectations as well, because those @@ -692,9 +692,9 @@ class TestExpectationSerializationTests(unittest.TestCase): add_line(set([TestConfiguration('xp', 'x86', 'release')]), True) add_line(set([TestConfiguration('xp', 'x86', 'release'), TestConfiguration('xp', 'x86', 'debug')]), False) serialized = TestExpectations.list_to_string(lines, self._converter) - self.assertEquals(serialized, "Bug(x) [ XP Release ] Yay [ ImageOnlyFailure ]\nBug(x) [ XP ] Yay [ ImageOnlyFailure ]") + self.assertEqual(serialized, "Bug(x) [ XP Release ] Yay [ ImageOnlyFailure ]\nBug(x) [ XP ] Yay [ ImageOnlyFailure ]") serialized = TestExpectations.list_to_string(lines, self._converter, reconstitute_only_these=reconstitute_only_these) - self.assertEquals(serialized, "Bug(x) [ XP Release ] Yay [ ImageOnlyFailure ]\nNay") + self.assertEqual(serialized, "Bug(x) [ XP Release ] Yay [ ImageOnlyFailure ]\nNay") def test_string_whitespace_stripping(self): self.assert_round_trip('\n', '') diff --git a/Tools/Scripts/webkitpy/layout_tests/models/test_failures_unittest.py b/Tools/Scripts/webkitpy/layout_tests/models/test_failures_unittest.py index 1c8f029a6..74ef8cbb4 100644 --- a/Tools/Scripts/webkitpy/layout_tests/models/test_failures_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/models/test_failures_unittest.py @@ -69,5 +69,5 @@ class TestFailuresTest(unittest.TestCase): self.assertEqual(len(crash_set), 2) def test_crashes(self): - self.assertEquals(FailureCrash().message(), 'DumpRenderTree crashed') - self.assertEquals(FailureCrash(process_name='foo', pid=1234).message(), 'foo crashed [pid=1234]') + self.assertEqual(FailureCrash().message(), 'DumpRenderTree crashed') + self.assertEqual(FailureCrash(process_name='foo', pid=1234).message(), 'foo crashed [pid=1234]') diff --git a/Tools/Scripts/webkitpy/layout_tests/port/apple.py b/Tools/Scripts/webkitpy/layout_tests/port/apple.py index 4b97f419b..d434c8da8 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/apple.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/apple.py @@ -49,6 +49,10 @@ class ApplePort(Port): # It's possible that Apple would want to fix this code to work better with those results. FUTURE_VERSION = 'future' # FIXME: This whole 'future' thing feels like a hack. + # overridden in subclasses + VERSION_FALLBACK_ORDER = [] + ARCHITECTURES = [] + @classmethod def determine_full_port_name(cls, host, options, port_name): # If the port_name matches the (badly named) cls.port_name, that diff --git a/Tools/Scripts/webkitpy/layout_tests/port/base.py b/Tools/Scripts/webkitpy/layout_tests/port/base.py index ea1e9d033..a19af094c 100755 --- a/Tools/Scripts/webkitpy/layout_tests/port/base.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/base.py @@ -54,6 +54,7 @@ from webkitpy.common.memoized import memoized from webkitpy.common.system import path from webkitpy.common.system.executive import ScriptError from webkitpy.common.system.systemhost import SystemHost +from webkitpy.common.webkit_finder import WebKitFinder from webkitpy.layout_tests.models.test_configuration import TestConfiguration from webkitpy.layout_tests.port import config as port_config from webkitpy.layout_tests.port import driver @@ -90,7 +91,7 @@ class Port(object): # Subclasses will usually override this. return cls.port_name - def __init__(self, host, port_name=None, options=None, config=None, **kwargs): + def __init__(self, host, port_name=None, options=None, **kwargs): # This value may be different from cls.port_name by having version modifiers # and other fields appended to it (for example, 'qt-arm' or 'mac-wk2'). @@ -110,7 +111,8 @@ class Port(object): self.host = host self._executive = host.executive self._filesystem = host.filesystem - self._config = config or port_config.Config(self._executive, self._filesystem, self.port_name) + self._webkit_finder = WebKitFinder(host.filesystem) + self._config = port_config.Config(self._executive, self._filesystem, self.port_name) self._helper = None self._http_server = None @@ -571,7 +573,7 @@ class Port(object): reftest_list.append((expectation, path)) return reftest_list - return reftest_list.get(self._filesystem.join(self.layout_tests_dir(), test_name), []) + return reftest_list.get(self._filesystem.join(self.layout_tests_dir(), test_name), []) # pylint: disable-msg=E1103 def tests(self, paths): """Return the list of tests found. Both generic and platform-specific tests matching paths should be returned.""" @@ -683,17 +685,21 @@ class Port(object): """ self._filesystem.write_binary_file(baseline_path, data) - @memoized + # FIXME: update callers to create a finder and call it instead of these next five routines (which should be protected). + def webkit_base(self): + return self._webkit_finder.webkit_base() + + def path_from_webkit_base(self, *comps): + return self._webkit_finder.path_from_webkit_base(*comps) + + def path_to_script(self, script_name): + return self._webkit_finder.path_to_script(script_name) + def layout_tests_dir(self): - """Return the absolute path to the top of the LayoutTests directory.""" - return self._filesystem.normpath(self.path_from_webkit_base('LayoutTests')) + return self._webkit_finder.layout_tests_dir() def perf_tests_dir(self): - """Return the absolute path to the top of the PerformanceTests directory.""" - return self.path_from_webkit_base('PerformanceTests') - - def webkit_base(self): - return self._filesystem.abspath(self.path_from_webkit_base('.')) + return self._webkit_finder.perf_tests_dir() def skipped_layout_tests(self, test_list): """Returns tests skipped outside of the TestExpectations files.""" @@ -764,11 +770,6 @@ class Port(object): def set_option_default(self, name, default_value): return self._options.ensure_value(name, default_value) - def path_from_webkit_base(self, *comps): - """Returns the full path to path made by joining the top of the - WebKit source tree and the list of path components in |*comps|.""" - return self._config.path_from_webkit_base(*comps) - @memoized def path_to_test_expectations_file(self): """Update the test expectations to the passed-in string. @@ -1373,12 +1374,12 @@ class Port(object): return config_args def _run_script(self, script_name, args=None, include_configuration_arguments=True, decode_output=True, env=None): - run_script_command = [self._config.script_path(script_name)] + run_script_command = [self.path_to_script(script_name)] if include_configuration_arguments: run_script_command.extend(self._arguments_for_configuration()) if args: run_script_command.extend(args) - output = self._executive.run_command(run_script_command, cwd=self._config.webkit_base_dir(), decode_output=decode_output, env=env) + output = self._executive.run_command(run_script_command, cwd=self.webkit_base(), decode_output=decode_output, env=env) _log.debug('Output of %s:\n%s' % (run_script_command, output)) return output diff --git a/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py index 1fe75ccd4..77ef04a04 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py @@ -45,9 +45,6 @@ from webkitpy.common.system.systemhost_mock import MockSystemHost from webkitpy.layout_tests.port import Port, Driver, DriverOutput from webkitpy.layout_tests.port.test import add_unit_tests_to_mock_filesystem, TestPort -import config -import config_mock - class PortTest(unittest.TestCase): def make_port(self, executive=None, with_tests=False, **kwargs): host = MockSystemHost() @@ -189,11 +186,6 @@ class PortTest(unittest.TestCase): self.assertTrue('act.txt' in diff) self.assertFalse('nosuchthing' in diff) - def test_default_configuration_notfound(self): - # Test that we delegate to the config object properly. - port = self.make_port(config=config_mock.MockConfig(default_configuration='default')) - self.assertEqual(port.default_configuration(), 'default') - def test_setup_test_run(self): port = self.make_port() # This routine is a no-op. We just test it for coverage. @@ -268,7 +260,7 @@ class PortTest(unittest.TestCase): port = self.make_port(port_name='foo') port.expectations_files = lambda: ['/mock-checkout/LayoutTests/platform/exists/TestExpectations', '/mock-checkout/LayoutTests/platform/nonexistant/TestExpectations'] port._filesystem.write_text_file('/mock-checkout/LayoutTests/platform/exists/TestExpectations', '') - self.assertEquals('\n'.join(port.expectations_dict().keys()), '/mock-checkout/LayoutTests/platform/exists/TestExpectations') + self.assertEqual('\n'.join(port.expectations_dict().keys()), '/mock-checkout/LayoutTests/platform/exists/TestExpectations') def test_additional_expectations(self): port = self.make_port(port_name='foo') @@ -279,19 +271,19 @@ class PortTest(unittest.TestCase): port._filesystem.write_text_file( '/tmp/additional-expectations-2.txt', 'content2\n') - self.assertEquals('\n'.join(port.expectations_dict().values()), '') + self.assertEqual('\n'.join(port.expectations_dict().values()), '') port._options.additional_expectations = [ '/tmp/additional-expectations-1.txt'] - self.assertEquals('\n'.join(port.expectations_dict().values()), '\ncontent1\n') + self.assertEqual('\n'.join(port.expectations_dict().values()), '\ncontent1\n') port._options.additional_expectations = [ '/tmp/nonexistent-file', '/tmp/additional-expectations-1.txt'] - self.assertEquals('\n'.join(port.expectations_dict().values()), '\ncontent1\n') + self.assertEqual('\n'.join(port.expectations_dict().values()), '\ncontent1\n') port._options.additional_expectations = [ '/tmp/additional-expectations-1.txt', '/tmp/additional-expectations-2.txt'] - self.assertEquals('\n'.join(port.expectations_dict().values()), '\ncontent1\n\ncontent2\n') + self.assertEqual('\n'.join(port.expectations_dict().values()), '\ncontent1\n\ncontent2\n') def test_additional_env_var(self): port = self.make_port(options=optparse.Values({'additional_env_var': ['FOO=BAR', 'BAR=FOO']})) diff --git a/Tools/Scripts/webkitpy/layout_tests/port/builders.py b/Tools/Scripts/webkitpy/layout_tests/port/builders.py index 155ac898b..380b5ad31 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/builders.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/builders.py @@ -58,8 +58,7 @@ _exact_matches = { "WebKit Mac10.6 (dbg)": {"port_name": "chromium-mac-snowleopard", "specifiers": set(["snowleopard", "debug"])}, "WebKit Mac10.7": {"port_name": "chromium-mac-lion", "specifiers": set(["lion", "release"])}, "WebKit Mac10.7 (dbg)": {"port_name": "chromium-mac-lion", "specifiers": set(["lion", "debug"])}, - "WebKit Mac10.8": {"port_name": "chromium-mac-mountainlion", "specifiers": set(["mountainlion", "release"]), - "move_overwritten_baselines_to": ["chromium-mac-lion"]}, + "WebKit Mac10.8": {"port_name": "chromium-mac-mountainlion", "specifiers": set(["mountainlion", "release"])}, # These builders are on build.webkit.org. "Apple MountainLion Release WK1 (Tests)": {"port_name": "mac-mountainlion", "specifiers": set(["mountainlion"]), "rebaseline_override_dir": "mac"}, @@ -83,8 +82,9 @@ _exact_matches = { # FIXME: Remove rebaseline_override_dir once there are Qt bots for all the platform/qt-* directories. "Qt Linux Release": {"port_name": "qt-linux", "specifiers": set(["win", "linux", "mac"]), "rebaseline_override_dir": "qt"}, - "EFL Linux 64-bit Debug": {"port_name": "efl", "specifiers": set(["efl", "debug"])}, "EFL Linux 64-bit Release": {"port_name": "efl", "specifiers": set(["efl", "release"])}, + "EFL Linux 64-bit Release WK2": {"port_name": "efl", "specifiers": set(["efl", "wk2", "release"])}, + "EFL Linux 64-bit Debug WK2": {"port_name": "efl", "specifiers": set(["efl", "wk2", "debug"])}, } diff --git a/Tools/Scripts/webkitpy/layout_tests/port/builders_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/builders_unittest.py index 1550df494..74320f2ad 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/builders_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/builders_unittest.py @@ -38,7 +38,7 @@ class BuildersTest(unittest.TestCase): '(.) ': '____', } for name, expected in tests.items(): - self.assertEquals(expected, builders.builder_path_from_name(name)) + self.assertEqual(expected, builders.builder_path_from_name(name)) if __name__ == '__main__': unittest.main() diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium.py index a69f5a822..4e0fbe282 100755 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium.py @@ -77,6 +77,9 @@ class ChromiumPort(Port): DEFAULT_BUILD_DIRECTORIES = ('out',) + # overridden in subclasses. + FALLBACK_PATHS = {} + @classmethod def _static_build_path(cls, filesystem, build_directory, chromium_base, webkit_base, configuration, comps): if build_directory: diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py index b8ac55ac1..2924f24e2 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py @@ -354,10 +354,11 @@ class ChromiumAndroidDriver(driver.Driver): if self._has_setup: return + self._run_adb_command(['root']) self._setup_md5sum_and_push_data_if_needed() self._has_setup = True - self._run_adb_command(['root']) self._setup_performance() + # Required by webkit_support::GetWebKitRootDirFilePath(). # Other directories will be created automatically by adb push. self._run_adb_command(['shell', 'mkdir', '-p', DEVICE_SOURCE_ROOT_DIR + 'chrome']) @@ -488,10 +489,6 @@ class ChromiumAndroidDriver(driver.Driver): self._run_adb_command(['shell', 'echo', original_content, '>', file]) self._original_governors = {} - def _command_wrapper(cls, wrapper_option): - # Ignore command wrapper which is not applicable on Android. - return [] - def _get_crash_log(self, stdout, stderr, newer_than): if not stdout: stdout = '' diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py index fce69c67d..856ac3151 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py @@ -119,11 +119,11 @@ class ChromiumAndroidPortTest(chromium_port_testcase.ChromiumPortTestCase): def test_attributes(self): port = self.make_port() - self.assertEquals(port.baseline_path(), port._webkit_baseline_path('chromium-android')) + self.assertEqual(port.baseline_path(), port._webkit_baseline_path('chromium-android')) def test_default_timeout_ms(self): - self.assertEquals(self.make_port(options=optparse.Values({'configuration': 'Release'})).default_timeout_ms(), 10000) - self.assertEquals(self.make_port(options=optparse.Values({'configuration': 'Debug'})).default_timeout_ms(), 10000) + self.assertEqual(self.make_port(options=optparse.Values({'configuration': 'Release'})).default_timeout_ms(), 10000) + self.assertEqual(self.make_port(options=optparse.Values({'configuration': 'Debug'})).default_timeout_ms(), 10000) def test_expectations_files(self): # FIXME: override this test temporarily while we're still upstreaming the android port and @@ -138,14 +138,14 @@ class ChromiumAndroidPortTest(chromium_port_testcase.ChromiumPortTestCase): def test_get_devices_one_device(self): port = self.make_port() self.mock_run_command.mock_one_device() - self.assertEquals(self.mock_run_command._mock_devices, port._get_devices()) - self.assertEquals(1, port.default_child_processes()) + self.assertEqual(self.mock_run_command._mock_devices, port._get_devices()) + self.assertEqual(1, port.default_child_processes()) def test_get_devices_two_devices(self): port = self.make_port() self.mock_run_command.mock_two_devices() - self.assertEquals(self.mock_run_command._mock_devices, port._get_devices()) - self.assertEquals(2, port.default_child_processes()) + self.assertEqual(self.mock_run_command._mock_devices, port._get_devices()) + self.assertEqual(2, port.default_child_processes()) def test_get_device_serial_no_device(self): port = self.make_port() @@ -155,19 +155,19 @@ class ChromiumAndroidPortTest(chromium_port_testcase.ChromiumPortTestCase): def test_get_device_serial_one_device(self): port = self.make_port() self.mock_run_command.mock_one_device() - self.assertEquals(self.mock_run_command._mock_devices[0], port._get_device_serial(0)) + self.assertEqual(self.mock_run_command._mock_devices[0], port._get_device_serial(0)) self.assertRaises(AssertionError, port._get_device_serial, 1) def test_get_device_serial_two_devices(self): port = self.make_port() self.mock_run_command.mock_two_devices() - self.assertEquals(self.mock_run_command._mock_devices[0], port._get_device_serial(0)) - self.assertEquals(self.mock_run_command._mock_devices[1], port._get_device_serial(1)) + self.assertEqual(self.mock_run_command._mock_devices[0], port._get_device_serial(0)) + self.assertEqual(self.mock_run_command._mock_devices[1], port._get_device_serial(1)) self.assertRaises(AssertionError, port._get_device_serial, 2) def test_must_require_http_server(self): port = self.make_port() - self.assertEquals(port.requires_http_server(), True) + self.assertEqual(port.requires_http_server(), True) class ChromiumAndroidDriverTest(unittest.TestCase): @@ -181,13 +181,13 @@ class ChromiumAndroidDriverTest(unittest.TestCase): def test_get_last_stacktrace(self): self.mock_run_command.mock_no_tombstone_dir() - self.assertEquals(self.driver._get_last_stacktrace(), '') + self.assertEqual(self.driver._get_last_stacktrace(), '') self.mock_run_command.mock_no_tombstone_file() - self.assertEquals(self.driver._get_last_stacktrace(), '') + self.assertEqual(self.driver._get_last_stacktrace(), '') self.mock_run_command.mock_ten_tombstones() - self.assertEquals(self.driver._get_last_stacktrace(), + self.assertEqual(self.driver._get_last_stacktrace(), '-rw------- 1000 1000 45316 2012-04-27 16:33 tombstone_03\n' '/data/tombstones/tombstone_03\nmock_contents\n') @@ -196,7 +196,7 @@ class ChromiumAndroidDriverTest(unittest.TestCase): self.mock_run_command.mock_ten_tombstones() self.driver._crashed_process_name = 'foo' self.driver._crashed_pid = 1234 - self.assertEquals(self.driver._get_crash_log('out bar\nout baz\n', 'err bar\nerr baz\n', newer_than=None), + self.assertEqual(self.driver._get_crash_log('out bar\nout baz\n', 'err bar\nerr baz\n', newer_than=None), ('err bar\n' 'err baz\n' '********* [123456789ABCDEF0] Tombstone file:\n' @@ -217,7 +217,7 @@ class ChromiumAndroidDriverTest(unittest.TestCase): self.driver._crashed_process_name = None self.driver._crashed_pid = None - self.assertEquals(self.driver._get_crash_log(None, None, newer_than=None), + self.assertEqual(self.driver._get_crash_log(None, None, newer_than=None), ('********* [123456789ABCDEF0] Tombstone file:\n' '-rw------- 1000 1000 45316 2012-04-27 16:33 tombstone_03\n' '/data/tombstones/tombstone_03\n' @@ -232,7 +232,7 @@ class ChromiumAndroidDriverTest(unittest.TestCase): def test_cmd_line(self): cmd_line = self.driver.cmd_line(True, ['anything']) - self.assertEquals(['adb', '-s', self.mock_run_command._mock_devices[0], 'shell'], cmd_line) + self.assertEqual(['adb', '-s', self.mock_run_command._mock_devices[0], 'shell'], cmd_line) def test_drt_cmd_line(self): cmd_line = self.driver._drt_cmd_line(True, ['--a']) @@ -242,19 +242,19 @@ class ChromiumAndroidDriverTest(unittest.TestCase): def test_read_prompt(self): self.driver._server_process = driver_unittest.MockServerProcess(lines=['root@android:/ # ']) - self.assertEquals(self.driver._read_prompt(time.time() + 1), None) + self.assertEqual(self.driver._read_prompt(time.time() + 1), None) self.driver._server_process = driver_unittest.MockServerProcess(lines=['$ ']) - self.assertEquals(self.driver._read_prompt(time.time() + 1), None) + self.assertEqual(self.driver._read_prompt(time.time() + 1), None) def test_command_from_driver_input(self): driver_input = driver.DriverInput('foo/bar/test.html', 10, 'checksum', True) expected_command = "/data/local/tmp/third_party/WebKit/LayoutTests/foo/bar/test.html'--pixel-test'checksum\n" if (sys.platform != "cygwin"): - self.assertEquals(self.driver._command_from_driver_input(driver_input), expected_command) + self.assertEqual(self.driver._command_from_driver_input(driver_input), expected_command) driver_input = driver.DriverInput('http/tests/foo/bar/test.html', 10, 'checksum', True) expected_command = "http://127.0.0.1:8000/foo/bar/test.html'--pixel-test'checksum\n" - self.assertEquals(self.driver._command_from_driver_input(driver_input), expected_command) + self.assertEqual(self.driver._command_from_driver_input(driver_input), expected_command) class ChromiumAndroidDriverTwoDriversTest(unittest.TestCase): @@ -268,10 +268,10 @@ class ChromiumAndroidDriverTwoDriversTest(unittest.TestCase): driver1 = chromium_android.ChromiumAndroidDriver(port, worker_number=1, pixel_tests=True) cmd_line0 = driver0.cmd_line(True, ['anything']) - self.assertEquals(['adb', '-s', mock_run_command._mock_devices[0], 'shell'], cmd_line0) + self.assertEqual(['adb', '-s', mock_run_command._mock_devices[0], 'shell'], cmd_line0) cmd_line1 = driver1.cmd_line(True, ['anything']) - self.assertEquals(['adb', '-s', mock_run_command._mock_devices[1], 'shell'], cmd_line1) + self.assertEqual(['adb', '-s', mock_run_command._mock_devices[1], 'shell'], cmd_line1) class ChromiumAndroidTwoPortsTest(unittest.TestCase): @@ -286,8 +286,8 @@ class ChromiumAndroidTwoPortsTest(unittest.TestCase): MockSystemHost(executive=MockExecutive2(run_command_fn=mock_run_command.mock_run_command_fn)), 'chromium-android', options=options) cmd_line = port1.driver_cmd_line() - self.assertEquals(cmd_line.count('--encode-binary'), 1) - self.assertEquals(cmd_line.count('--enable-hardware-gpu'), 1) + self.assertEqual(cmd_line.count('--encode-binary'), 1) + self.assertEqual(cmd_line.count('--enable-hardware-gpu'), 1) if __name__ == '__main__': diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py index 7c37fd17a..dfacf9c08 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py @@ -29,6 +29,7 @@ import logging +from webkitpy.common.webkit_finder import WebKitFinder from webkitpy.layout_tests.port import chromium from webkitpy.layout_tests.port import config @@ -61,7 +62,7 @@ class ChromiumLinuxPort(chromium.ChromiumPort): def _determine_driver_path_statically(cls, host, options): config_object = config.Config(host.executive, host.filesystem) build_directory = getattr(options, 'build_directory', None) - webkit_base = config_object.path_from_webkit_base() + webkit_base = WebKitFinder(host.filesystem).webkit_base() chromium_base = cls._chromium_base_dir(host.filesystem) if hasattr(options, 'configuration') and options.configuration: configuration = options.configuration diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux_unittest.py index 169c2f4f4..4160034e3 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux_unittest.py @@ -47,7 +47,7 @@ class ChromiumLinuxPortTest(chromium_port_testcase.ChromiumPortTestCase): host.executive = executive_mock.MockExecutive2(file_output) port = self.make_port(host, port_name=port_name) - self.assertEquals(port.architecture(), expected_architecture) + self.assertEqual(port.architecture(), expected_architecture) if expected_architecture == 'x86': self.assertTrue(port.baseline_path().endswith('chromium-linux-x86')) self.assertTrue(port.baseline_search_path()[0].endswith('chromium-linux-x86')) @@ -74,14 +74,14 @@ class ChromiumLinuxPortTest(chromium_port_testcase.ChromiumPortTestCase): def test_determine_architecture_fails(self): # Test that we default to 'x86' if the driver doesn't exist. port = self.make_port() - self.assertEquals(port.architecture(), 'x86_64') + self.assertEqual(port.architecture(), 'x86_64') # Test that we default to 'x86' on an unknown architecture. host = MockSystemHost() host.filesystem.exists = lambda x: True host.executive = executive_mock.MockExecutive2('win32') port = self.make_port(host=host) - self.assertEquals(port.architecture(), 'x86_64') + self.assertEqual(port.architecture(), 'x86_64') # Test that we raise errors if something weird happens. host.executive = executive_mock.MockExecutive2(exception=AssertionError) @@ -112,7 +112,7 @@ class ChromiumLinuxPortTest(chromium_port_testcase.ChromiumPortTestCase): self.assertTrue(self.make_port(options=MockOptions(driver_name='OtherDriver'))._path_to_driver().endswith('OtherDriver')) def test_path_to_image_diff(self): - self.assertEquals(self.make_port()._path_to_image_diff(), '/mock-checkout/out/Release/ImageDiff') + self.assertEqual(self.make_port()._path_to_image_diff(), '/mock-checkout/out/Release/ImageDiff') if __name__ == '__main__': port_testcase.main() diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py index 21b7e317f..bd65cd1dc 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py @@ -92,14 +92,6 @@ class ChromiumMacPort(chromium.ChromiumPort): def operating_system(self): return 'mac' - def expectations_files(self): - # FIXME: This is a temporary hack while getting the 10.8 baselines up to date. - # See https://bugs.webkit.org/show_bug.cgi?id=99505 - files = super(ChromiumMacPort, self).expectations_files() - if self.name() == 'chromium-mac-mountainlion': - files.append(self._filesystem.join(self._webkit_baseline_path(self.name()), 'TestExpectations')) - return files - # # PROTECTED METHODS # diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py index b02af5ca1..d10326f0e 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py @@ -41,7 +41,7 @@ class ChromiumMacPortTest(chromium_port_testcase.ChromiumPortTestCase): def assert_name(self, port_name, os_version_string, expected): port = self.make_port(os_version=os_version_string, port_name=port_name) - self.assertEquals(expected, port.name()) + self.assertEqual(expected, port.name()) def test_versions(self): self.assertTrue(self.make_port().name() in ('chromium-mac-snowleopard', 'chromium-mac-lion', 'chromium-mac-mountainlion', 'chromium-mac-future')) @@ -64,16 +64,16 @@ class ChromiumMacPortTest(chromium_port_testcase.ChromiumPortTestCase): def test_baseline_path(self): port = self.make_port(port_name='chromium-mac-snowleopard') - self.assertEquals(port.baseline_path(), port._webkit_baseline_path('chromium-mac-snowleopard')) + self.assertEqual(port.baseline_path(), port._webkit_baseline_path('chromium-mac-snowleopard')) port = self.make_port(port_name='chromium-mac-lion') - self.assertEquals(port.baseline_path(), port._webkit_baseline_path('chromium-mac-lion')) + self.assertEqual(port.baseline_path(), port._webkit_baseline_path('chromium-mac-lion')) port = self.make_port(port_name='chromium-mac-mountainlion') - self.assertEquals(port.baseline_path(), port._webkit_baseline_path('chromium-mac')) + self.assertEqual(port.baseline_path(), port._webkit_baseline_path('chromium-mac')) port = self.make_port(port_name='chromium-mac-future') - self.assertEquals(port.baseline_path(), port._webkit_baseline_path('chromium-mac')) + self.assertEqual(port.baseline_path(), port._webkit_baseline_path('chromium-mac')) def test_operating_system(self): self.assertEqual('mac', self.make_port().operating_system()) @@ -100,11 +100,8 @@ class ChromiumMacPortTest(chromium_port_testcase.ChromiumPortTestCase): self.assertTrue(self.make_port(options=MockOptions(driver_name='OtherDriver'))._path_to_driver().endswith('OtherDriver')) def test_path_to_image_diff(self): - self.assertEquals(self.make_port()._path_to_image_diff(), '/mock-checkout/out/Release/ImageDiff') + self.assertEqual(self.make_port()._path_to_image_diff(), '/mock-checkout/out/Release/ImageDiff') - def test_ml_expectations(self): - self.assertTrue(self.make_port(port_name='chromium-mac-mountainlion').expectations_files()[-1].endswith('-mountainlion/TestExpectations')) - self.assertFalse(self.make_port(port_name='chromium-mac-lion').expectations_files()[-1].endswith('-mountainlion/TestExpectations')) if __name__ == '__main__': port_testcase.main() diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_port_testcase.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_port_testcase.py index a082a131c..dc5706beb 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_port_testcase.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_port_testcase.py @@ -51,16 +51,16 @@ class ChromiumPortTestCase(port_testcase.PortTestCase): def test_default_max_locked_shards(self): port = self.make_port() port.default_child_processes = lambda: 16 - self.assertEquals(port.default_max_locked_shards(), 4) + self.assertEqual(port.default_max_locked_shards(), 4) port.default_child_processes = lambda: 2 - self.assertEquals(port.default_max_locked_shards(), 1) + self.assertEqual(port.default_max_locked_shards(), 1) def test_default_timeout_ms(self): - self.assertEquals(self.make_port(options=MockOptions(configuration='Release')).default_timeout_ms(), 6000) - self.assertEquals(self.make_port(options=MockOptions(configuration='Debug')).default_timeout_ms(), 12000) + self.assertEqual(self.make_port(options=MockOptions(configuration='Release')).default_timeout_ms(), 6000) + self.assertEqual(self.make_port(options=MockOptions(configuration='Debug')).default_timeout_ms(), 12000) def test_default_pixel_tests(self): - self.assertEquals(self.make_port().default_pixel_tests(), True) + self.assertEqual(self.make_port().default_pixel_tests(), True) def test_missing_symbol_to_skipped_tests(self): # Test that we get the chromium skips and not the webkit default skips @@ -72,7 +72,7 @@ class ChromiumPortTestCase(port_testcase.PortTestCase): def test_all_test_configurations(self): """Validate the complete set of configurations this port knows about.""" port = self.make_port() - self.assertEquals(set(port.all_test_configurations()), set([ + self.assertEqual(set(port.all_test_configurations()), set([ TestConfiguration('icecreamsandwich', 'x86', 'debug'), TestConfiguration('icecreamsandwich', 'x86', 'release'), TestConfiguration('snowleopard', 'x86', 'debug'), @@ -103,7 +103,7 @@ class ChromiumPortTestCase(port_testcase.PortTestCase): class TestAndroidPort(chromium_android.ChromiumAndroidPort): def __init__(self, options=None): options = options or MockOptions() - chromium_win.ChromiumAndroidPort.__init__(self, MockSystemHost(os_name='android', os_version='icecreamsandwich'), 'chromium-android', options=options) + chromium_android.ChromiumAndroidPort.__init__(self, MockSystemHost(os_name='android', os_version='icecreamsandwich'), 'chromium-android', options=options) def default_configuration(self): self.default_configuration_called = True @@ -130,12 +130,12 @@ class ChromiumPortTestCase(port_testcase.PortTestCase): def test_default_configuration(self): mock_options = MockOptions() port = ChromiumPortTestCase.TestLinuxPort(options=mock_options) - self.assertEquals(mock_options.configuration, 'default') + self.assertEqual(mock_options.configuration, 'default') # pylint: disable-msg=E1101 self.assertTrue(port.default_configuration_called) mock_options = MockOptions(configuration=None) port = ChromiumPortTestCase.TestLinuxPort(mock_options) - self.assertEquals(mock_options.configuration, 'default') + self.assertEqual(mock_options.configuration, 'default') # pylint: disable-msg=E1101 self.assertTrue(port.default_configuration_called) def test_diff_image(self): @@ -152,11 +152,11 @@ class ChromiumPortTestCase(port_testcase.PortTestCase): # Images are different. port._executive = MockExecutive2(run_command_fn=mock_run_command) - self.assertEquals(mock_image_diff, port.diff_image("EXPECTED", "ACTUAL")[0]) + self.assertEqual(mock_image_diff, port.diff_image("EXPECTED", "ACTUAL")[0]) # Images are the same. port._executive = MockExecutive2(exit_code=0) - self.assertEquals(None, port.diff_image("EXPECTED", "ACTUAL")[0]) + self.assertEqual(None, port.diff_image("EXPECTED", "ACTUAL")[0]) # There was some error running image_diff. port._executive = MockExecutive2(exit_code=2) @@ -170,7 +170,7 @@ class ChromiumPortTestCase(port_testcase.PortTestCase): def test_diff_image_crashed(self): port = ChromiumPortTestCase.TestLinuxPort() port._executive = MockExecutive2(exit_code=2) - self.assertEquals(port.diff_image("EXPECTED", "ACTUAL"), (None, 0, 'image diff returned an exit code of 2')) + self.assertEqual(port.diff_image("EXPECTED", "ACTUAL"), (None, 0, 'image diff returned an exit code of 2')) def test_expectations_files(self): port = self.make_port() @@ -185,15 +185,15 @@ class ChromiumPortTestCase(port_testcase.PortTestCase): port._filesystem.write_text_file(skia_overrides_path, 'dummay text') port._options.builder_name = 'DUMMY_BUILDER_NAME' - self.assertEquals(port.expectations_files(), [expectations_path, skia_overrides_path, chromium_overrides_path]) + self.assertEqual(port.expectations_files(), [expectations_path, skia_overrides_path, chromium_overrides_path]) port._options.builder_name = 'builder (deps)' - self.assertEquals(port.expectations_files(), [expectations_path, skia_overrides_path, chromium_overrides_path]) + self.assertEqual(port.expectations_files(), [expectations_path, skia_overrides_path, chromium_overrides_path]) # A builder which does NOT observe the Chromium test_expectations, # but still observes the Skia test_expectations... port._options.builder_name = 'builder' - self.assertEquals(port.expectations_files(), [expectations_path, skia_overrides_path]) + self.assertEqual(port.expectations_files(), [expectations_path, skia_overrides_path]) def test_expectations_ordering(self): # since we don't implement self.port_name in ChromiumPort. diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py index 87de41c6c..ac9bc90f6 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py @@ -33,7 +33,6 @@ import unittest from webkitpy.common.system import logtesting from webkitpy.common.system.executive_mock import MockExecutive2 from webkitpy.common.system.systemhost_mock import MockSystemHost -from webkitpy.layout_tests.port.config_mock import MockConfig from webkitpy.thirdparty.mock import Mock from webkitpy.tool.mocktool import MockOptions diff --git a/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py index dc184fc14..1c0ddc1fe 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py @@ -59,7 +59,7 @@ class ChromiumWinTest(chromium_port_testcase.ChromiumPortTestCase): def test_setup_environ_for_server_cygpath(self): port = self.make_port() env = port.setup_environ_for_server(port.driver_name()) - self.assertEquals(env['CYGWIN_PATH'], '/mock-checkout/Source/WebKit/chromium/third_party/cygwin/bin') + self.assertEqual(env['CYGWIN_PATH'], '/mock-checkout/Source/WebKit/chromium/third_party/cygwin/bin') def test_setup_environ_for_server_register_cygwin(self): port = self.make_port(options=MockOptions(register_cygwin=True, results_directory='/')) @@ -70,7 +70,7 @@ class ChromiumWinTest(chromium_port_testcase.ChromiumPortTestCase): def assert_name(self, port_name, os_version_string, expected): port = self.make_port(port_name=port_name, os_version=os_version_string) - self.assertEquals(expected, port.name()) + self.assertEqual(expected, port.name()) def test_versions(self): port = self.make_port() @@ -92,10 +92,10 @@ class ChromiumWinTest(chromium_port_testcase.ChromiumPortTestCase): def test_baseline_path(self): port = self.make_port(port_name='chromium-win-xp') - self.assertEquals(port.baseline_path(), port._webkit_baseline_path('chromium-win-xp')) + self.assertEqual(port.baseline_path(), port._webkit_baseline_path('chromium-win-xp')) port = self.make_port(port_name='chromium-win-win7') - self.assertEquals(port.baseline_path(), port._webkit_baseline_path('chromium-win')) + self.assertEqual(port.baseline_path(), port._webkit_baseline_path('chromium-win')) def test_build_path(self): # Test that optional paths are used regardless of whether they exist. @@ -122,4 +122,4 @@ class ChromiumWinTest(chromium_port_testcase.ChromiumPortTestCase): self.assertTrue(self.make_port(options=MockOptions(driver_name='OtherDriver'))._path_to_driver().endswith('OtherDriver.exe')) def test_path_to_image_diff(self): - self.assertEquals(self.make_port()._path_to_image_diff(), '/mock-checkout/out/Release/ImageDiff.exe') + self.assertEqual(self.make_port()._path_to_image_diff(), '/mock-checkout/out/Release/ImageDiff.exe') diff --git a/Tools/Scripts/webkitpy/layout_tests/port/config.py b/Tools/Scripts/webkitpy/layout_tests/port/config.py index dd8f331af..828e2af37 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/config.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/config.py @@ -29,14 +29,14 @@ """Wrapper objects for WebKit-specific utility routines.""" -# FIXME: This file needs to be unified with common/checkout/scm.py and -# common/config/ports.py . +# FIXME: This file needs to be unified with common/config/ports.py . -from webkitpy.common.system import logutils -from webkitpy.common.system import executive +import logging +from webkitpy.common import webkit_finder -_log = logutils.get_logger(__file__) + +_log = logging.getLogger(__name__) # # FIXME: This is used to record if we've already hit the filesystem to look @@ -64,7 +64,7 @@ class Config(object): def __init__(self, executive, filesystem, port_implementation=None): self._executive = executive self._filesystem = filesystem - self._webkit_base_dir = None + self._webkit_finder = webkit_finder.WebKitFinder(self._filesystem) self._default_configuration = None self._build_directories = {} self._port_implementation = port_implementation @@ -81,8 +81,8 @@ class Config(object): flags.append('--' + self._port_implementation) if not self._build_directories.get(configuration): - args = ["perl", self.script_path("webkit-build-directory")] + flags - output = self._executive.run_command(args, cwd=self.webkit_base_dir(), return_stderr=False).rstrip() + args = ["perl", self._webkit_finder.path_to_script("webkit-build-directory")] + flags + output = self._executive.run_command(args, cwd=self._webkit_finder.webkit_base(), return_stderr=False).rstrip() parts = output.split("\n") self._build_directories[configuration] = parts[0] @@ -111,32 +111,6 @@ class Config(object): _log.warn("Scripts may fail. See 'set-webkit-configuration --help'.") return self._default_configuration - def path_from_webkit_base(self, *comps): - return self._filesystem.join(self.webkit_base_dir(), *comps) - - # FIXME: We should only have one implementation of this logic, - # if scm.find_checkout_root() is broken for Chromium, we should fix (or at least wrap) it! - def webkit_base_dir(self): - """Returns the absolute path to the top of the WebKit tree. - - Raises an AssertionError if the top dir can't be determined.""" - # Note: this code somewhat duplicates the code in - # scm.find_checkout_root(). However, that code only works if the top - # of the SCM repository also matches the top of the WebKit tree. The - # Chromium ports, for example, only check out subdirectories like - # Tools/Scripts, and so we still have to do additional work - # to find the top of the tree. - # - # This code will also work if there is no SCM system at all. - if not self._webkit_base_dir: - config_module_path = self._filesystem.path_to_module(self.__module__) - self._webkit_base_dir = config_module_path[0:config_module_path.find('Tools') - 1] - return self._webkit_base_dir - - def script_path(self, script_name): - # This is intentionally relative. Callers should pass the checkout_root/webkit_base_dir to run_command as the cwd. - return self._filesystem.join("Tools", "Scripts", script_name) - def _determine_configuration(self): # This mirrors the logic in webkitdirs.pm:determineConfiguration(). # @@ -162,7 +136,7 @@ class Config(object): configuration_path = self._filesystem.join(self.build_directory(None), "Configuration") if not self._filesystem.exists(configuration_path): return None - except (OSError, executive.ScriptError): + except: return None return self._filesystem.read_text_file(configuration_path).rstrip() diff --git a/Tools/Scripts/webkitpy/layout_tests/port/config_mock.py b/Tools/Scripts/webkitpy/layout_tests/port/config_mock.py deleted file mode 100644 index 5476e4bab..000000000 --- a/Tools/Scripts/webkitpy/layout_tests/port/config_mock.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python -# Copyright (C) 2010 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""Wrapper objects for WebKit-specific utility routines.""" - -from webkitpy.common.system.filesystem_mock import MockFileSystem - - -class MockConfig(object): - _FLAGS_FROM_CONFIGURATIONS = { - "Debug": "--debug", - "Release": "--release", - } - - def __init__(self, filesystem=None, default_configuration='Release', port_implementation=None): - self._filesystem = filesystem or MockFileSystem() - self._default_configuration = default_configuration - self._port_implmentation = port_implementation - - def flag_for_configuration(self, configuration): - return self._FLAGS_FROM_CONFIGURATIONS[configuration] - - def build_directory(self, configuration): - return "/mock-build" - - def build_dumprendertree(self, configuration): - return True - - def default_configuration(self): - return self._default_configuration - - def path_from_webkit_base(self, *comps): - # FIXME: This could use self._filesystem.join, but that doesn't handle empty lists. - return self.webkit_base_dir() + "/" + "/".join(list(comps)) - - def script_path(self, script_name): - # This is intentionally relative. Callers should pass the checkout_root/webkit_base_dir to run_command as the cwd. - return self._filesystem.join("Tools", "Scripts", script_name) - - def webkit_base_dir(self): - return "/mock-checkout" diff --git a/Tools/Scripts/webkitpy/layout_tests/port/config_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/config_unittest.py index 96ba5ff58..4479204ad 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/config_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/config_unittest.py @@ -31,10 +31,11 @@ import sys import unittest from webkitpy.common.system.executive import Executive, ScriptError -from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2 +from webkitpy.common.system.executive_mock import MockExecutive2 from webkitpy.common.system.filesystem import FileSystem from webkitpy.common.system.filesystem_mock import MockFileSystem from webkitpy.common.system.outputcapture import OutputCapture +from webkitpy.common.webkit_finder import WebKitFinder import config @@ -131,12 +132,11 @@ class ConfigTest(unittest.TestCase): e = Executive() fs = FileSystem() c = config.Config(e, fs) - script = c.path_from_webkit_base('Tools', 'Scripts', 'webkitpy', 'layout_tests', 'port', 'config_standalone.py') + script = WebKitFinder(fs).path_from_webkit_base('Tools', 'Scripts', 'webkitpy', 'layout_tests', 'port', 'config_standalone.py') # Note: don't use 'Release' here, since that's the normal default. expected = 'Debug' - # FIXME: Why are we running a python subprocess here?? args = [sys.executable, script, '--mock', expected] actual = e.run_command(args).rstrip() self.assertEqual(actual, expected) @@ -157,32 +157,6 @@ class ConfigTest(unittest.TestCase): actual = c.default_configuration() self.assertEqual(actual, 'Release') - def test_path_from_webkit_base(self): - c = config.Config(MockExecutive(), MockFileSystem()) - self.assertTrue(c.path_from_webkit_base('foo')) - - def test_webkit_base_dir(self): - # FIXME: We use a real filesystem here. Should this move to a mocked one? - executive = Executive() - filesystem = FileSystem() - c = config.Config(executive, filesystem) - base_dir = c.webkit_base_dir() - self.assertTrue(base_dir) - self.assertNotEqual(base_dir[-1], '/') - - # FIXME: Once we use a MockFileSystem for this test we don't need to save the orig_cwd. - orig_cwd = filesystem.getcwd() - if sys.platform == 'win32': - filesystem.chdir(os.environ['USERPROFILE']) - else: - filesystem.chdir(os.environ['HOME']) - c = config.Config(executive, filesystem) - try: - base_dir_2 = c.webkit_base_dir() - self.assertEqual(base_dir, base_dir_2) - finally: - filesystem.chdir(orig_cwd) - if __name__ == '__main__': unittest.main() diff --git a/Tools/Scripts/webkitpy/layout_tests/port/driver_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/driver_unittest.py index 5b11ade2a..6a5481f6a 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/driver_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/driver_unittest.py @@ -36,6 +36,8 @@ from webkitpy.layout_tests.port.server_process_mock import MockServerProcess # FIXME: remove the dependency on TestWebKitPort from webkitpy.layout_tests.port.port_testcase import TestWebKitPort +from webkitpy.tool.mocktool import MockOptions + class DriverOutputTest(unittest.TestCase): def test_strip_metrics(self): @@ -80,7 +82,9 @@ class DriverOutputTest(unittest.TestCase): class DriverTest(unittest.TestCase): def make_port(self): - return Port(MockSystemHost()) + port = Port(MockSystemHost(), MockOptions(configuration='Release')) + port._config.build_directory = lambda configuration: '/mock-build' + return port def _assert_wrapper(self, wrapper_string, expected_wrapper): wrapper = Driver(self.make_port(), None, pixel_tests=False)._command_wrapper(wrapper_string) @@ -119,9 +123,9 @@ class DriverTest(unittest.TestCase): "#EOF", ]) content_block = driver._read_block(0) - self.assertEquals(content_block.content_type, 'my_type') - self.assertEquals(content_block.encoding, 'none') - self.assertEquals(content_block.content_hash, 'foobar') + self.assertEqual(content_block.content_type, 'my_type') + self.assertEqual(content_block.encoding, 'none') + self.assertEqual(content_block.content_hash, 'foobar') driver._server_process = None def test_read_binary_block(self): @@ -136,10 +140,10 @@ class DriverTest(unittest.TestCase): "#EOF", ]) content_block = driver._read_block(0) - self.assertEquals(content_block.content_type, 'image/png') - self.assertEquals(content_block.content_hash, 'actual') - self.assertEquals(content_block.content, '12345678\n') - self.assertEquals(content_block.decoded_content, '12345678\n') + self.assertEqual(content_block.content_type, 'image/png') + self.assertEqual(content_block.content_hash, 'actual') + self.assertEqual(content_block.content, '12345678\n') + self.assertEqual(content_block.decoded_content, '12345678\n') driver._server_process = None def test_read_base64_block(self): @@ -154,16 +158,17 @@ class DriverTest(unittest.TestCase): 'MTIzNDU2NzgK#EOF', ]) content_block = driver._read_block(0) - self.assertEquals(content_block.content_type, 'image/png') - self.assertEquals(content_block.content_hash, 'actual') - self.assertEquals(content_block.encoding, 'base64') - self.assertEquals(content_block.content, 'MTIzNDU2NzgK') - self.assertEquals(content_block.decoded_content, '12345678\n') + self.assertEqual(content_block.content_type, 'image/png') + self.assertEqual(content_block.content_hash, 'actual') + self.assertEqual(content_block.encoding, 'base64') + self.assertEqual(content_block.content, 'MTIzNDU2NzgK') + self.assertEqual(content_block.decoded_content, '12345678\n') def test_no_timeout(self): port = TestWebKitPort() + port._config.build_directory = lambda configuration: '/mock-build' driver = Driver(port, 0, pixel_tests=True, no_timeout=True) - self.assertEquals(driver.cmd_line(True, []), ['/mock-build/DumpRenderTree', '--no-timeout', '-']) + self.assertEqual(driver.cmd_line(True, []), ['/mock-build/DumpRenderTree', '--no-timeout', '-']) def test_check_for_driver_crash(self): port = TestWebKitPort() @@ -186,10 +191,10 @@ class DriverTest(unittest.TestCase): pass def assert_crash(driver, error_line, crashed, name, pid, unresponsive=False): - self.assertEquals(driver._check_for_driver_crash(error_line), crashed) - self.assertEquals(driver._crashed_process_name, name) - self.assertEquals(driver._crashed_pid, pid) - self.assertEquals(driver._subprocess_was_unresponsive, unresponsive) + self.assertEqual(driver._check_for_driver_crash(error_line), crashed) + self.assertEqual(driver._crashed_process_name, name) + self.assertEqual(driver._crashed_pid, pid) + self.assertEqual(driver._subprocess_was_unresponsive, unresponsive) driver.stop() driver._server_process = FakeServerProcess(False) @@ -234,8 +239,8 @@ class DriverTest(unittest.TestCase): def test_creating_a_port_does_not_write_to_the_filesystem(self): port = TestWebKitPort() driver = Driver(port, 0, pixel_tests=True) - self.assertEquals(port._filesystem.written_files, {}) - self.assertEquals(port._filesystem.last_tmpdir, None) + self.assertEqual(port._filesystem.written_files, {}) + self.assertEqual(port._filesystem.last_tmpdir, None) def test_stop_cleans_up_properly(self): port = TestWebKitPort() diff --git a/Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py index 2980c2d23..915c17d89 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py @@ -105,7 +105,7 @@ class FactoryTest(unittest.TestCase): self.assertRaises(NotImplementedError, factory.PortFactory(MockSystemHost(os_name='vms')).get) def test_get_from_builder_name(self): - self.assertEquals(factory.PortFactory(MockSystemHost()).get_from_builder_name('WebKit Mac10.7').name(), + self.assertEqual(factory.PortFactory(MockSystemHost()).get_from_builder_name('WebKit Mac10.7').name(), 'chromium-mac-lion') diff --git a/Tools/Scripts/webkitpy/layout_tests/port/gtk.py b/Tools/Scripts/webkitpy/layout_tests/port/gtk.py index 3d820274e..2ec7d70c4 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/gtk.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/gtk.py @@ -71,9 +71,7 @@ class GtkPort(Port, PulseAudioSanitizer): environment['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path('Libraries', 'libTestRunnerInjectedBundle.la') environment['TEST_RUNNER_TEST_PLUGIN_PATH'] = self._build_path('TestNetscapePlugin', '.libs') environment['WEBKIT_INSPECTOR_PATH'] = self._build_path('Programs', 'resources', 'inspector') - environment['AUDIO_RESOURCES_PATH'] = self._filesystem.join(self._config.webkit_base_dir(), - 'Source', 'WebCore', 'platform', - 'audio', 'resources') + environment['AUDIO_RESOURCES_PATH'] = self.path_from_webkit_base('Source', 'WebCore', 'platform', 'audio', 'resources') self._copy_value_from_environ_if_set(environment, 'WEBKITOUTPUTDIR') return environment diff --git a/Tools/Scripts/webkitpy/layout_tests/port/gtk_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/gtk_unittest.py index f1df6bfa1..6f5fae68d 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/gtk_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/gtk_unittest.py @@ -50,10 +50,10 @@ class GtkPortTest(port_testcase.PortTestCase): OutputCapture().assert_outputs(self, port.show_results_html_file, ["test.html"], expected_stderr=expected_stderr) def test_default_timeout_ms(self): - self.assertEquals(self.make_port(options=MockOptions(configuration='Release')).default_timeout_ms(), 6000) - self.assertEquals(self.make_port(options=MockOptions(configuration='Debug')).default_timeout_ms(), 12000) - self.assertEquals(self.make_port(options=MockOptions(webkit_test_runner=True, configuration='Debug')).default_timeout_ms(), 80000) - self.assertEquals(self.make_port(options=MockOptions(webkit_test_runner=True, configuration='Release')).default_timeout_ms(), 80000) + self.assertEqual(self.make_port(options=MockOptions(configuration='Release')).default_timeout_ms(), 6000) + self.assertEqual(self.make_port(options=MockOptions(configuration='Debug')).default_timeout_ms(), 12000) + self.assertEqual(self.make_port(options=MockOptions(webkit_test_runner=True, configuration='Debug')).default_timeout_ms(), 80000) + self.assertEqual(self.make_port(options=MockOptions(webkit_test_runner=True, configuration='Release')).default_timeout_ms(), 80000) def assertLinesEqual(self, a, b): if hasattr(self, 'assertMultiLineEqual'): diff --git a/Tools/Scripts/webkitpy/layout_tests/port/http_lock_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/http_lock_unittest.py index fbf2d9df3..650a7670f 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/http_lock_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/http_lock_unittest.py @@ -88,7 +88,7 @@ class HttpLockTest(unittest.TestCase): # FIXME: Once Executive wraps getpid, we can mock this and not use a real pid. current_pid = os.getpid() self.http_lock._filesystem.write_text_file(self.lock_file_name, str(current_pid)) - self.assertEquals(self.http_lock._current_lock_pid(), current_pid) + self.assertEqual(self.http_lock._current_lock_pid(), current_pid) def test_extract_lock_number(self): lock_file_list = ( diff --git a/Tools/Scripts/webkitpy/layout_tests/port/image_diff_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/image_diff_unittest.py index 46cc98a11..0e5f0a0ff 100755 --- a/Tools/Scripts/webkitpy/layout_tests/port/image_diff_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/image_diff_unittest.py @@ -49,9 +49,9 @@ class TestImageDiffer(unittest.TestCase): def test_diff_image_failed(self): port = FakePort(['diff: 100% failed\n']) image_differ = ImageDiffer(port) - self.assertEquals(image_differ.diff_image('foo', 'bar', 0.1), ('', 100.0, None)) + self.assertEqual(image_differ.diff_image('foo', 'bar', 0.1), ('', 100.0, None)) def test_diff_image_passed(self): port = FakePort(['diff: 0% passed\n']) image_differ = ImageDiffer(port) - self.assertEquals(image_differ.diff_image('foo', 'bar', 0.1), (None, 0, None)) + self.assertEqual(image_differ.diff_image('foo', 'bar', 0.1), (None, 0, None)) diff --git a/Tools/Scripts/webkitpy/layout_tests/port/leakdetector_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/leakdetector_unittest.py index 7628bb709..09d37d711 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/leakdetector_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/leakdetector_unittest.py @@ -51,7 +51,7 @@ class LeakDetectorTest(unittest.TestCase): detector._callstacks_to_exclude_from_leaks = lambda: ['foo bar', 'BAZ'] detector._types_to_exlude_from_leaks = lambda: ['abcdefg', 'hi jklmno'] expected_args = ['--exclude-callstack=foo bar', '--exclude-callstack=BAZ', '--exclude-type=abcdefg', '--exclude-type=hi jklmno', 1234] - self.assertEquals(detector._leaks_args(1234), expected_args) + self.assertEqual(detector._leaks_args(1234), expected_args) example_leaks_output = """Process 5122: 663744 nodes malloced for 78683 KB Process 5122: 337301 leaks for 6525216 total leaked bytes. @@ -110,18 +110,18 @@ Binary Images: """ def test_parse_leaks_output(self): - self.assertEquals(self._make_detector()._parse_leaks_output(self.example_leaks_output), (337301, 0, 6525216)) - self.assertEquals(self._make_detector()._parse_leaks_output(self.example_leaks_output_with_exclusions), (282, 17, 21920)) + self.assertEqual(self._make_detector()._parse_leaks_output(self.example_leaks_output), (337301, 0, 6525216)) + self.assertEqual(self._make_detector()._parse_leaks_output(self.example_leaks_output_with_exclusions), (282, 17, 21920)) def test_leaks_files_in_directory(self): detector = self._make_detector() - self.assertEquals(detector.leaks_files_in_directory('/bogus-directory'), []) + self.assertEqual(detector.leaks_files_in_directory('/bogus-directory'), []) detector._filesystem = MockFileSystem({ '/mock-results/DumpRenderTree-1234-leaks.txt': '', '/mock-results/DumpRenderTree-23423-leaks.txt': '', '/mock-results/DumpRenderTree-823-leaks.txt': '', }) - self.assertEquals(len(detector.leaks_files_in_directory('/mock-results')), 3) + self.assertEqual(len(detector.leaks_files_in_directory('/mock-results')), 3) def test_count_total_bytes_and_unique_leaks(self): detector = self._make_detector() @@ -138,7 +138,7 @@ total: 5,888 bytes (0 bytes excluded).""" leak_files = ['/mock-results/DumpRenderTree-1234-leaks.txt', '/mock-results/DumpRenderTree-1235-leaks.txt'] expected_stdout = "MOCK _run_script: parse-malloc-history ['--merge-depth', 5, '/mock-results/DumpRenderTree-1234-leaks.txt', '/mock-results/DumpRenderTree-1235-leaks.txt']\n" results_tuple = OutputCapture().assert_outputs(self, detector.count_total_bytes_and_unique_leaks, [leak_files], expected_stdout=expected_stdout) - self.assertEquals(results_tuple, ("5,888 bytes", 2)) + self.assertEqual(results_tuple, ("5,888 bytes", 2)) def test_count_total_leaks(self): detector = self._make_detector() @@ -149,4 +149,4 @@ total: 5,888 bytes (0 bytes excluded).""" '/mock-results/DumpRenderTree-823-leaks.txt': 'Process 12356: 23412 leaks for 18 total leaked bytes.\n', }) leak_file_paths = ['/mock-results/DumpRenderTree-1234-leaks.txt', '/mock-results/DumpRenderTree-23423-leaks.txt', '/mock-results/DumpRenderTree-823-leaks.txt'] - self.assertEquals(detector.count_total_leaks(leak_file_paths), 35765) + self.assertEqual(detector.count_total_leaks(leak_file_paths), 35765) diff --git a/Tools/Scripts/webkitpy/layout_tests/port/mac.py b/Tools/Scripts/webkitpy/layout_tests/port/mac.py index e6fd5bd3c..4415b8a62 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/mac.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/mac.py @@ -168,8 +168,8 @@ class MacPort(ApplePort): # We don't use self._run_script() because we don't want to wait for the script # to exit and we want the output to show up on stdout in case there are errors # launching the browser. - self._executive.popen([self._config.script_path('run-safari')] + self._arguments_for_configuration() + ['--no-saved-state', '-NSOpen', results_filename], - cwd=self._config.webkit_base_dir(), stdout=file(os.devnull), stderr=file(os.devnull)) + self._executive.popen([self.path_to_script('run-safari')] + self._arguments_for_configuration() + ['--no-saved-state', '-NSOpen', results_filename], + cwd=self.webkit_base(), stdout=file(os.devnull), stderr=file(os.devnull)) # FIXME: The next two routines turn off the http locking in order # to work around failures on the bots caused when the slave restarts. diff --git a/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py index c2b26b2f7..511201464 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py @@ -47,7 +47,7 @@ class MacTest(port_testcase.PortTestCase): def test_default_timeout_ms(self): super(MacTest, self).test_default_timeout_ms() - self.assertEquals(self.make_port(options=MockOptions(guard_malloc=True)).default_timeout_ms(), 350000) + self.assertEqual(self.make_port(options=MockOptions(guard_malloc=True)).default_timeout_ms(), 350000) example_skipped_file = u""" @@ -77,7 +77,7 @@ java/ def assert_name(self, port_name, os_version_string, expected): host = MockSystemHost(os_name='mac', os_version=os_version_string) port = self.make_port(host=host, port_name=port_name) - self.assertEquals(expected, port.name()) + self.assertEqual(expected, port.name()) def test_tests_for_other_platforms(self): platforms = ['mac', 'chromium-linux', 'mac-snowleopard'] @@ -115,14 +115,14 @@ java/ def test_setup_environ_for_server(self): port = self.make_port(options=MockOptions(leaks=True, guard_malloc=True)) env = port.setup_environ_for_server(port.driver_name()) - self.assertEquals(env['MallocStackLogging'], '1') - self.assertEquals(env['DYLD_INSERT_LIBRARIES'], '/usr/lib/libgmalloc.dylib') + self.assertEqual(env['MallocStackLogging'], '1') + self.assertEqual(env['DYLD_INSERT_LIBRARIES'], '/usr/lib/libgmalloc.dylib') def _assert_search_path(self, port_name, baseline_path, search_paths, use_webkit2=False): port = self.make_port(port_name=port_name, options=MockOptions(webkit_test_runner=use_webkit2)) absolute_search_paths = map(port._webkit_baseline_path, search_paths) - self.assertEquals(port.baseline_path(), port._webkit_baseline_path(baseline_path)) - self.assertEquals(port.baseline_search_path(), absolute_search_paths) + self.assertEqual(port.baseline_path(), port._webkit_baseline_path(baseline_path)) + self.assertEqual(port.baseline_search_path(), absolute_search_paths) def test_baseline_search_path(self): # Note that we don't need total coverage here, just path coverage, since this is all data driven. @@ -240,18 +240,18 @@ java/ self.args = args port._run_script = run_script - self.assertEquals(port.architecture(), 'x86') + self.assertEqual(port.architecture(), 'x86') port._build_driver() - self.assertEquals(self.args, ['ARCHS=i386']) + self.assertEqual(self.args, ['ARCHS=i386']) def test_64bit(self): # Apple Mac port is 64-bit by default port = self.make_port() - self.assertEquals(port.architecture(), 'x86_64') + self.assertEqual(port.architecture(), 'x86_64') def run_script(script, args=None, env=None): self.args = args port._run_script = run_script port._build_driver() - self.assertEquals(self.args, []) + self.assertEqual(self.args, []) diff --git a/Tools/Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py index 1ac051abd..c4c43f5d8 100755 --- a/Tools/Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py @@ -257,7 +257,7 @@ class MockTestShellTest(MockDRTTest): '\n', '#EOF\n'], host=host) - self.assertEquals(host.filesystem.written_files, + self.assertEqual(host.filesystem.written_files, {'/tmp/png_result0.png': 'image_checksum\x8a-pngtEXtchecksum\x00image_checksum-checksum'}) def test_test_shell_parse_options(self): @@ -265,4 +265,4 @@ class MockTestShellTest(MockDRTTest): '--pixel-tests=/tmp/png_result0.png']) self.assertTrue(options.test_shell) self.assertTrue(options.pixel_tests) - self.assertEquals(options.pixel_path, '/tmp/png_result0.png') + self.assertEqual(options.pixel_path, '/tmp/png_result0.png') diff --git a/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py b/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py index b036f4b0d..e7cd76c92 100755 --- a/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py @@ -41,7 +41,6 @@ from webkitpy.common.system.filesystem_mock import MockFileSystem from webkitpy.common.system.outputcapture import OutputCapture from webkitpy.common.system.systemhost_mock import MockSystemHost from webkitpy.layout_tests.port.base import Port -from webkitpy.layout_tests.port.config_mock import MockConfig from webkitpy.layout_tests.port.server_process_mock import MockServerProcess from webkitpy.layout_tests.servers import http_server_base from webkitpy.tool.mocktool import MockOptions @@ -56,8 +55,7 @@ class TestWebKitPort(Port): **kwargs): self.symbols_string = symbols_string # Passing "" disables all staticly-detectable features. host = host or MockSystemHost() - config = config or MockConfig() - super(TestWebKitPort, self).__init__(host=host, config=config, **kwargs) + super(TestWebKitPort, self).__init__(host=host, **kwargs) def all_test_configurations(self): return [self.test_configuration()] @@ -81,28 +79,30 @@ class PortTestCase(unittest.TestCase): os_name = None os_version = None port_maker = TestWebKitPort + port_name = None - def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=None, config=None, **kwargs): + def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=None, **kwargs): host = host or MockSystemHost(os_name=(os_name or self.os_name), os_version=(os_version or self.os_version)) options = options or MockOptions(configuration='Release') - config = config or MockConfig(filesystem=host.filesystem, default_configuration='Release') port_name = port_name or self.port_name port_name = self.port_maker.determine_full_port_name(host, options, port_name) - return self.port_maker(host, port_name, options=options, config=config, **kwargs) + port = self.port_maker(host, port_name, options=options, **kwargs) + port._config.build_directory = lambda configuration: '/mock-build' + return port def test_default_max_locked_shards(self): port = self.make_port() port.default_child_processes = lambda: 16 - self.assertEquals(port.default_max_locked_shards(), 1) + self.assertEqual(port.default_max_locked_shards(), 1) port.default_child_processes = lambda: 2 - self.assertEquals(port.default_max_locked_shards(), 1) + self.assertEqual(port.default_max_locked_shards(), 1) def test_default_timeout_ms(self): - self.assertEquals(self.make_port(options=MockOptions(configuration='Release')).default_timeout_ms(), 35000) - self.assertEquals(self.make_port(options=MockOptions(configuration='Debug')).default_timeout_ms(), 35000) + self.assertEqual(self.make_port(options=MockOptions(configuration='Release')).default_timeout_ms(), 35000) + self.assertEqual(self.make_port(options=MockOptions(configuration='Debug')).default_timeout_ms(), 35000) def test_default_pixel_tests(self): - self.assertEquals(self.make_port().default_pixel_tests(), False) + self.assertEqual(self.make_port().default_pixel_tests(), False) def test_driver_cmd_line(self): port = self.make_port() @@ -114,9 +114,6 @@ class PortTestCase(unittest.TestCase): self.assertTrue('--foo=bar' in cmd_line) self.assertTrue('--foo=baz' in cmd_line) - def test_expectations_files(self): - self.assertNotEquals(self.make_port().expectations_files(), []) - def test_uses_apache(self): self.assertTrue(self.make_port()._uses_apache()) @@ -270,18 +267,18 @@ class PortTestCase(unittest.TestCase): port._server_process_constructor = make_proc port.setup_test_run() - self.assertEquals(port.diff_image('foo', 'bar'), ('', 100.0, None)) - self.assertEquals(self.proc.cmd[1:3], ["--tolerance", "0.1"]) + self.assertEqual(port.diff_image('foo', 'bar'), ('', 100.0, None)) + self.assertEqual(self.proc.cmd[1:3], ["--tolerance", "0.1"]) - self.assertEquals(port.diff_image('foo', 'bar', None), ('', 100.0, None)) - self.assertEquals(self.proc.cmd[1:3], ["--tolerance", "0.1"]) + self.assertEqual(port.diff_image('foo', 'bar', None), ('', 100.0, None)) + self.assertEqual(self.proc.cmd[1:3], ["--tolerance", "0.1"]) - self.assertEquals(port.diff_image('foo', 'bar', 0), ('', 100.0, None)) - self.assertEquals(self.proc.cmd[1:3], ["--tolerance", "0"]) + self.assertEqual(port.diff_image('foo', 'bar', 0), ('', 100.0, None)) + self.assertEqual(self.proc.cmd[1:3], ["--tolerance", "0"]) port.clean_up_test_run() self.assertTrue(self.proc.stopped) - self.assertEquals(port._image_differ, None) + self.assertEqual(port._image_differ, None) def test_diff_image_crashed(self): port = self.make_port() @@ -293,7 +290,7 @@ class PortTestCase(unittest.TestCase): port._server_process_constructor = make_proc port.setup_test_run() - self.assertEquals(port.diff_image('foo', 'bar'), ('', 0, 'ImageDiff crashed\n')) + self.assertEqual(port.diff_image('foo', 'bar'), ('', 0, 'ImageDiff crashed\n')) port.clean_up_test_run() def test_check_wdiff(self): @@ -389,13 +386,13 @@ class PortTestCase(unittest.TestCase): def test_get_crash_log(self): port = self.make_port() - self.assertEquals(port._get_crash_log(None, None, None, None, newer_than=None), + self.assertEqual(port._get_crash_log(None, None, None, None, newer_than=None), (None, 'crash log for <unknown process name> (pid <unknown>):\n' 'STDOUT: <empty>\n' 'STDERR: <empty>\n')) - self.assertEquals(port._get_crash_log('foo', 1234, 'out bar\nout baz', 'err bar\nerr baz\n', newer_than=None), + self.assertEqual(port._get_crash_log('foo', 1234, 'out bar\nout baz', 'err bar\nerr baz\n', newer_than=None), ('err bar\nerr baz\n', 'crash log for foo (pid 1234):\n' 'STDOUT: out bar\n' @@ -403,13 +400,13 @@ class PortTestCase(unittest.TestCase): 'STDERR: err bar\n' 'STDERR: err baz\n')) - self.assertEquals(port._get_crash_log('foo', 1234, 'foo\xa6bar', 'foo\xa6bar', newer_than=None), + self.assertEqual(port._get_crash_log('foo', 1234, 'foo\xa6bar', 'foo\xa6bar', newer_than=None), ('foo\xa6bar', u'crash log for foo (pid 1234):\n' u'STDOUT: foo\ufffdbar\n' u'STDERR: foo\ufffdbar\n')) - self.assertEquals(port._get_crash_log('foo', 1234, 'foo\xa6bar', 'foo\xa6bar', newer_than=1.0), + self.assertEqual(port._get_crash_log('foo', 1234, 'foo\xa6bar', 'foo\xa6bar', newer_than=1.0), ('foo\xa6bar', u'crash log for foo (pid 1234):\n' u'STDOUT: foo\ufffdbar\n' @@ -419,14 +416,14 @@ class PortTestCase(unittest.TestCase): port = self.make_port(options=options) for directory in dirs: port.host.filesystem.maybe_make_directory(directory) - self.assertEquals(port._build_path(), expected_path) + self.assertEqual(port._build_path(), expected_path) def test_expectations_ordering(self): port = self.make_port() for path in port.expectations_files(): port._filesystem.write_text_file(path, '') ordered_dict = port.expectations_dict() - self.assertEquals(port.path_to_test_expectations_file(), ordered_dict.keys()[0]) + self.assertEqual(port.path_to_test_expectations_file(), ordered_dict.keys()[0]) options = MockOptions(additional_expectations=['/tmp/foo', '/tmp/bar']) port = self.make_port(options=options) @@ -435,8 +432,8 @@ class PortTestCase(unittest.TestCase): port._filesystem.write_text_file('/tmp/foo', 'foo') port._filesystem.write_text_file('/tmp/bar', 'bar') ordered_dict = port.expectations_dict() - self.assertEquals(ordered_dict.keys()[-2:], options.additional_expectations) - self.assertEquals(ordered_dict.values()[-2:], ['foo', 'bar']) + self.assertEqual(ordered_dict.keys()[-2:], options.additional_expectations) # pylint: disable-msg=E1101 + self.assertEqual(ordered_dict.values()[-2:], ['foo', 'bar']) def test_path_to_test_expectations_file(self): port = TestWebKitPort() @@ -562,7 +559,7 @@ class PortTestCase(unittest.TestCase): self.assertFalse(output.assert_outputs(self, port._build_driver, expected_stderr=expected_stderr, expected_logs=expected_logs)) def _assert_config_file_for_platform(self, port, platform, config_file): - self.assertEquals(port._apache_config_file_name_for_platform(platform), config_file) + self.assertEqual(port._apache_config_file_name_for_platform(platform), config_file) def test_linux_distro_detection(self): port = TestWebKitPort() @@ -604,19 +601,19 @@ class PortTestCase(unittest.TestCase): self.assertRaises(IOError, port._path_to_apache_config_file) port._filesystem.write_text_file('/existing/httpd.conf', 'Hello, world!') os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf' - self.assertEquals(port._path_to_apache_config_file(), '/existing/httpd.conf') + self.assertEqual(port._path_to_apache_config_file(), '/existing/httpd.conf') finally: os.environ = saved_environ.copy() # Mock out _apache_config_file_name_for_platform to ignore the passed sys.platform value. port._apache_config_file_name_for_platform = lambda platform: 'httpd.conf' - self.assertEquals(port._path_to_apache_config_file(), '/mock-checkout/LayoutTests/http/conf/httpd.conf') + self.assertEqual(port._path_to_apache_config_file(), '/mock-checkout/LayoutTests/http/conf/httpd.conf') # Check that even if we mock out _apache_config_file_name, the environment variable takes precedence. saved_environ = os.environ.copy() try: os.environ['WEBKIT_HTTP_SERVER_CONF_PATH'] = '/existing/httpd.conf' - self.assertEquals(port._path_to_apache_config_file(), '/existing/httpd.conf') + self.assertEqual(port._path_to_apache_config_file(), '/existing/httpd.conf') finally: os.environ = saved_environ.copy() @@ -646,4 +643,4 @@ class PortTestCase(unittest.TestCase): def test_additional_platform_directory(self): port = self.make_port(options=MockOptions(additional_platform_directory=['/tmp/foo'])) - self.assertEquals(port.baseline_search_path()[0], '/tmp/foo') + self.assertEqual(port.baseline_search_path()[0], '/tmp/foo') diff --git a/Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py index cf09bd8e0..4a558f8dd 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py @@ -69,7 +69,7 @@ class QtPortTest(port_testcase.PortTestCase): port = self.make_port(host=host, qt_version=qt_version, port_name=port_name, options=MockOptions(webkit_test_runner=use_webkit2, platform='qt')) absolute_search_paths = map(port._webkit_baseline_path, search_paths) - self.assertEquals(port.baseline_search_path(), absolute_search_paths) + self.assertEqual(port.baseline_search_path(), absolute_search_paths) def _assert_expectations_files(self, search_paths, os_name, use_webkit2=False, qt_version='4.8'): # FIXME: Port constructors should not "parse" the port name, but @@ -80,7 +80,7 @@ class QtPortTest(port_testcase.PortTestCase): port_name = 'qt-' + os_name port = self.make_port(host=host, qt_version=qt_version, port_name=port_name, options=MockOptions(webkit_test_runner=use_webkit2, platform='qt')) - self.assertEquals(port.expectations_files(), search_paths) + self.assertEqual(port.expectations_files(), search_paths) def _qt_version(self, qt_version): if qt_version in '4.8': @@ -110,7 +110,7 @@ class QtPortTest(port_testcase.PortTestCase): def test_setup_environ_for_server(self): port = self.make_port() env = port.setup_environ_for_server(port.driver_name()) - self.assertEquals(env['QTWEBKIT_PLUGIN_PATH'], '/mock-build/lib/plugins') + self.assertEqual(env['QTWEBKIT_PLUGIN_PATH'], '/mock-build/lib/plugins') def test_operating_system(self): self.assertEqual('linux', self.make_port(port_name='qt-linux', os_name='linux').operating_system()) diff --git a/Tools/Scripts/webkitpy/layout_tests/port/server_process_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/server_process_unittest.py index 7a5ac45d4..cd1db1f96 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/server_process_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/server_process_unittest.py @@ -104,23 +104,23 @@ class TestServerProcess(unittest.TestCase): proc = server_process.ServerProcess(port, 'python', cmd) proc.write('') - self.assertEquals(proc.poll(), None) + self.assertEqual(proc.poll(), None) self.assertFalse(proc.has_crashed()) # check that doing a read after an expired deadline returns # nothing immediately. line = proc.read_stdout_line(now - 1) - self.assertEquals(line, None) + self.assertEqual(line, None) # FIXME: This part appears to be flaky. line should always be non-None. # FIXME: https://bugs.webkit.org/show_bug.cgi?id=88280 line = proc.read_stdout_line(now + 1.0) if line: - self.assertEquals(line.strip(), "stdout") + self.assertEqual(line.strip(), "stdout") line = proc.read_stderr_line(now + 1.0) if line: - self.assertEquals(line.strip(), "stderr") + self.assertEqual(line.strip(), "stderr") proc.stop(0) @@ -141,12 +141,12 @@ class TestServerProcess(unittest.TestCase): server_process.write("should break") self.assertTrue(server_process.has_crashed()) self.assertNotEquals(server_process.pid(), None) - self.assertEquals(server_process._proc, None) - self.assertEquals(server_process.broken_pipes, [server_process.stdin]) + self.assertEqual(server_process._proc, None) + self.assertEqual(server_process.broken_pipes, [server_process.stdin]) port_obj.host.platform.os_name = 'mac' server_process = FakeServerProcess(port_obj=port_obj, name="test", cmd=["test"]) server_process.write("should break") self.assertTrue(server_process.has_crashed()) - self.assertEquals(server_process._proc, None) - self.assertEquals(server_process.broken_pipes, [server_process.stdin]) + self.assertEqual(server_process._proc, None) + self.assertEqual(server_process.broken_pipes, [server_process.stdin]) diff --git a/Tools/Scripts/webkitpy/layout_tests/port/win_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/win_unittest.py index 930dcd8e5..668685f56 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/win_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/win_unittest.py @@ -60,7 +60,7 @@ class WinPortTest(port_testcase.PortTestCase): def _assert_search_path(self, expected_search_paths, version, use_webkit2=False): port = self.make_port(port_name='win', os_version=version, options=MockOptions(webkit_test_runner=use_webkit2)) absolute_search_paths = map(port._webkit_baseline_path, expected_search_paths) - self.assertEquals(port.baseline_search_path(), absolute_search_paths) + self.assertEqual(port.baseline_search_path(), absolute_search_paths) def test_baseline_search_path(self): self._assert_search_path(['win-xp', 'win-vista', 'win-7sp0', 'win', 'mac-lion', 'mac'], 'xp') @@ -74,7 +74,7 @@ class WinPortTest(port_testcase.PortTestCase): def _assert_version(self, port_name, expected_version): host = MockSystemHost(os_name='win', os_version=expected_version) port = WinPort(host, port_name=port_name) - self.assertEquals(port.version(), expected_version) + self.assertEqual(port.version(), expected_version) def test_versions(self): self._assert_version('win-xp', 'xp') @@ -100,10 +100,10 @@ class WinPortTest(port_testcase.PortTestCase): port = self.make_port() port._executive.run_command = lambda command, cwd=None, error_handler=None: "Nonsense" # runtime_features_list returns None when its results are meaningless (it couldn't run DRT or parse the output, etc.) - self.assertEquals(port._runtime_feature_list(), None) + self.assertEqual(port._runtime_feature_list(), None) port._executive.run_command = lambda command, cwd=None, error_handler=None: "SupportedFeatures:foo bar" - self.assertEquals(port._runtime_feature_list(), ['foo', 'bar']) + self.assertEqual(port._runtime_feature_list(), ['foo', 'bar']) def test_expectations_files(self): - self.assertEquals(len(self.make_port().expectations_files()), 2) - self.assertEquals(len(self.make_port(options=MockOptions(webkit_test_runner=True)).expectations_files()), 4) + self.assertEqual(len(self.make_port().expectations_files()), 2) + self.assertEqual(len(self.make_port(options=MockOptions(webkit_test_runner=True, configuration='Release')).expectations_files()), 4) diff --git a/Tools/Scripts/webkitpy/layout_tests/port/xvfbdriver_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/xvfbdriver_unittest.py index 220dd3517..367131039 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/xvfbdriver_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/xvfbdriver_unittest.py @@ -34,14 +34,15 @@ from webkitpy.common.system.executive_mock import MockExecutive2 from webkitpy.common.system.outputcapture import OutputCapture from webkitpy.common.system.systemhost_mock import MockSystemHost from webkitpy.layout_tests.port import Port -from webkitpy.layout_tests.port.config_mock import MockConfig from webkitpy.layout_tests.port.server_process_mock import MockServerProcess from webkitpy.layout_tests.port.xvfbdriver import XvfbDriver +from webkitpy.tool.mocktool import MockOptions class XvfbDriverTest(unittest.TestCase): def make_driver(self, worker_number=0, xorg_running=False, executive=None): - port = Port(host=MockSystemHost(log_executive=True, executive=executive), config=MockConfig()) + port = Port(host=MockSystemHost(log_executive=True, executive=executive), options=MockOptions(configuration='Release')) + port._config.build_directory = lambda configuration: "/mock-build" port._server_process_constructor = MockServerProcess if xorg_running: port._executive._running_pids['Xorg'] = 108 @@ -115,7 +116,7 @@ class XvfbDriverTest(unittest.TestCase): def test_stop(self): filesystem = MockFileSystem(files={'/tmp/.X42-lock': '1234\n'}) - port = Port(host=MockSystemHost(log_executive=True, filesystem=filesystem), config=MockConfig()) + port = Port(host=MockSystemHost(log_executive=True, filesystem=filesystem), options=MockOptions(configuration='Release')) port._executive.kill_process = lambda x: log("MOCK kill_process pid: " + str(x)) driver = XvfbDriver(port, worker_number=0, pixel_tests=True) diff --git a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py index 1c8e7321a..2df57cf6f 100755 --- a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py +++ b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py @@ -207,45 +207,9 @@ def parse_args(args=None): # FIXME: These options should move onto the ChromiumPort. option_group_definitions.append(("Chromium-specific Options", [ - optparse.make_option("--startup-dialog", action="store_true", - default=False, help="create a dialog on DumpRenderTree startup"), - optparse.make_option("--gp-fault-error-box", action="store_true", - default=False, help="enable Windows GP fault error box"), - optparse.make_option("--js-flags", - type="string", help="JavaScript flags to pass to tests"), - optparse.make_option("--stress-opt", action="store_true", - default=False, - help="Enable additional stress test to JavaScript optimization"), - optparse.make_option("--stress-deopt", action="store_true", - default=False, - help="Enable additional stress test to JavaScript optimization"), optparse.make_option("--nocheck-sys-deps", action="store_true", default=False, help="Don't check the system dependencies (themes)"), - optparse.make_option("--accelerated-video", - action="store_true", - help="Use hardware-accelerated compositing for video"), - optparse.make_option("--no-accelerated-video", - action="store_false", - dest="accelerated_video", - help="Don't use hardware-accelerated compositing for video"), - optparse.make_option("--threaded-compositing", - action="store_true", - help="Use threaded compositing for rendering"), - optparse.make_option("--accelerated-2d-canvas", - action="store_true", - help="Use hardware-accelerated 2D Canvas calls"), - optparse.make_option("--no-accelerated-2d-canvas", - action="store_false", - dest="accelerated_2d_canvas", - help="Don't use hardware-accelerated 2D Canvas calls"), - optparse.make_option("--accelerated-painting", - action="store_true", - default=False, - help="Use hardware accelerated painting of composited pages"), - optparse.make_option("--per-tile-painting", - action="store_true", - help="Use per-tile painting of composited pages"), optparse.make_option("--adb-device", action="append", default=[], help="Run Android layout tests on these devices."), diff --git a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py index 0cf42d0ee..de1a21cc5 100755 --- a/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py +++ b/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py @@ -33,6 +33,7 @@ import codecs import itertools import json import logging +import os import platform import Queue import re @@ -241,12 +242,12 @@ class LintTest(unittest.TestCase, StreamTestingMixin): FakePort(host, 'b', 'path-to-b'), FakePort(host, 'b-win', 'path-to-b'))) - self.assertEquals(run_webkit_tests.lint(host.port_factory.ports['a'], MockOptions(platform=None)), 0) - self.assertEquals(host.ports_parsed, ['a', 'b', 'b-win']) + self.assertEqual(run_webkit_tests.lint(host.port_factory.ports['a'], MockOptions(platform=None)), 0) + self.assertEqual(host.ports_parsed, ['a', 'b', 'b-win']) host.ports_parsed = [] - self.assertEquals(run_webkit_tests.lint(host.port_factory.ports['a'], MockOptions(platform='a')), 0) - self.assertEquals(host.ports_parsed, ['a']) + self.assertEqual(run_webkit_tests.lint(host.port_factory.ports['a'], MockOptions(platform='a')), 0) + self.assertEqual(host.ports_parsed, ['a']) def test_lint_test_files(self): res, out, err, user = logging_run(['--lint-test-files']) @@ -286,19 +287,9 @@ class MainTest(unittest.TestCase, StreamTestingMixin): # properly on cygwin (bug 63846). self.should_test_processes = not self._platform.is_win() - def test_accelerated_compositing(self): - # This just tests that we recognize the command line args - self.assertTrue(passing_run(['--accelerated-video'])) - self.assertTrue(passing_run(['--no-accelerated-video'])) - - def test_accelerated_2d_canvas(self): - # This just tests that we recognize the command line args - self.assertTrue(passing_run(['--accelerated-2d-canvas'])) - self.assertTrue(passing_run(['--no-accelerated-2d-canvas'])) - def test_all(self): res, out, err, user = logging_run([], tests_included=True) - self.assertEquals(res, unexpected_tests_count) + self.assertEqual(res, unexpected_tests_count) def test_basic(self): self.assertTrue(passing_run()) @@ -309,10 +300,19 @@ class MainTest(unittest.TestCase, StreamTestingMixin): self.assertTrue(len(batch) <= 2, '%s had too many tests' % ', '.join(batch)) def test_max_locked_shards(self): + # Tests for the default of using one locked shard even in the case of more than one child process. if not self.should_test_processes: return + save_env_webkit_test_max_locked_shards = None + if "WEBKIT_TEST_MAX_LOCKED_SHARDS" in os.environ: + save_env_webkit_test_max_locked_shards = os.environ["WEBKIT_TEST_MAX_LOCKED_SHARDS"] + del os.environ["WEBKIT_TEST_MAX_LOCKED_SHARDS"] _, _, regular_output, _ = logging_run(['--debug-rwt-logging', '--child-processes', '2'], shared_port=False) - self.assertTrue(any(['(1 locked)' in line for line in regular_output.buflist])) + try: + self.assertTrue(any(['(1 locked)' in line for line in regular_output.buflist])) + finally: + if save_env_webkit_test_max_locked_shards: + os.environ["WEBKIT_TEST_MAX_LOCKED_SHARDS"] = save_env_webkit_test_max_locked_shards def test_child_processes_2(self): if self.should_test_processes: @@ -405,7 +405,7 @@ class MainTest(unittest.TestCase, StreamTestingMixin): def test_repeat_each(self): tests_to_run = ['passes/image.html', 'passes/text.html'] tests_run = get_tests_run(['--repeat-each', '2'] + tests_to_run, tests_included=True, flatten_batches=True) - self.assertEquals(tests_run, ['passes/image.html', 'passes/image.html', 'passes/text.html', 'passes/text.html']) + self.assertEqual(tests_run, ['passes/image.html', 'passes/image.html', 'passes/text.html', 'passes/text.html']) def test_ignore_flag(self): # Note that passes/image.html is expected to be run since we specified it directly. @@ -419,26 +419,26 @@ class MainTest(unittest.TestCase, StreamTestingMixin): num_tests_run_by_default = len(tests_run) # Check that nothing changes when we specify skipped=default. - self.assertEquals(len(get_tests_run(['--skipped=default', 'passes'], tests_included=True, flatten_batches=True)), + self.assertEqual(len(get_tests_run(['--skipped=default', 'passes'], tests_included=True, flatten_batches=True)), num_tests_run_by_default) # Now check that we run one more test (the skipped one). tests_run = get_tests_run(['--skipped=ignore', 'passes'], tests_included=True, flatten_batches=True) self.assertTrue('passes/skipped/skip.html' in tests_run) - self.assertEquals(len(tests_run), num_tests_run_by_default + 1) + self.assertEqual(len(tests_run), num_tests_run_by_default + 1) # Now check that we only run the skipped test. - self.assertEquals(get_tests_run(['--skipped=only', 'passes'], tests_included=True, flatten_batches=True), + self.assertEqual(get_tests_run(['--skipped=only', 'passes'], tests_included=True, flatten_batches=True), ['passes/skipped/skip.html']) # Now check that we don't run anything. - self.assertEquals(get_tests_run(['--skipped=always', 'passes/skipped/skip.html'], tests_included=True, flatten_batches=True), + self.assertEqual(get_tests_run(['--skipped=always', 'passes/skipped/skip.html'], tests_included=True, flatten_batches=True), []) def test_iterations(self): tests_to_run = ['passes/image.html', 'passes/text.html'] tests_run = get_tests_run(['--iterations', '2'] + tests_to_run, tests_included=True, flatten_batches=True) - self.assertEquals(tests_run, ['passes/image.html', 'passes/text.html', 'passes/image.html', 'passes/text.html']) + self.assertEqual(tests_run, ['passes/image.html', 'passes/text.html', 'passes/image.html', 'passes/text.html']) def test_repeat_each_iterations_num_tests(self): # The total number of tests should be: number_of_tests * @@ -456,12 +456,12 @@ class MainTest(unittest.TestCase, StreamTestingMixin): # Test that we actually select the right chunk all_tests_run = get_tests_run(flatten_batches=True) chunk_tests_run = get_tests_run(['--run-chunk', '1:4'], flatten_batches=True) - self.assertEquals(all_tests_run[4:8], chunk_tests_run) + self.assertEqual(all_tests_run[4:8], chunk_tests_run) # Test that we wrap around if the number of tests is not evenly divisible by the chunk size tests_to_run = ['passes/error.html', 'passes/image.html', 'passes/platform_image.html', 'passes/text.html'] chunk_tests_run = get_tests_run(['--run-chunk', '1:3'] + tests_to_run, tests_included=True, flatten_batches=True) - self.assertEquals(['passes/text.html', 'passes/error.html', 'passes/image.html'], chunk_tests_run) + self.assertEqual(['passes/text.html', 'passes/error.html', 'passes/image.html'], chunk_tests_run) def test_run_force(self): # This raises an exception because we run @@ -474,18 +474,18 @@ class MainTest(unittest.TestCase, StreamTestingMixin): # Test that we actually select the right part tests_to_run = ['passes/error.html', 'passes/image.html', 'passes/platform_image.html', 'passes/text.html'] tests_run = get_tests_run(['--run-part', '1:2'] + tests_to_run, tests_included=True, flatten_batches=True) - self.assertEquals(['passes/error.html', 'passes/image.html'], tests_run) + self.assertEqual(['passes/error.html', 'passes/image.html'], tests_run) # Test that we wrap around if the number of tests is not evenly divisible by the chunk size # (here we end up with 3 parts, each with 2 tests, and we only have 4 tests total, so the # last part repeats the first two tests). chunk_tests_run = get_tests_run(['--run-part', '3:3'] + tests_to_run, tests_included=True, flatten_batches=True) - self.assertEquals(['passes/error.html', 'passes/image.html'], chunk_tests_run) + self.assertEqual(['passes/error.html', 'passes/image.html'], chunk_tests_run) def test_run_singly(self): batch_tests_run = get_tests_run(['--run-singly']) for batch in batch_tests_run: - self.assertEquals(len(batch), 1, '%s had too many tests' % ', '.join(batch)) + self.assertEqual(len(batch), 1, '%s had too many tests' % ', '.join(batch)) def test_skip_failing_tests(self): # This tests that we skip both known failing and known flaky tests. Because there are @@ -503,28 +503,28 @@ class MainTest(unittest.TestCase, StreamTestingMixin): def test_run_singly_actually_runs_tests(self): res, _, _, _ = logging_run(['--run-singly', 'failures/unexpected']) - self.assertEquals(res, unexpected_failures) + self.assertEqual(res, unexpected_failures) def test_single_file(self): # FIXME: We should consider replacing more of the get_tests_run()-style tests # with tests that read the tests_run* files, like this one. host = MockHost() tests_run = passing_run(['passes/text.html'], tests_included=True, host=host) - self.assertEquals(host.filesystem.read_text_file('/tmp/layout-test-results/tests_run0.txt'), + self.assertEqual(host.filesystem.read_text_file('/tmp/layout-test-results/tests_run0.txt'), 'passes/text.html\n') def test_single_file_with_prefix(self): tests_run = get_tests_run(['LayoutTests/passes/text.html'], tests_included=True, flatten_batches=True) - self.assertEquals(['passes/text.html'], tests_run) + self.assertEqual(['passes/text.html'], tests_run) def test_single_skipped_file(self): tests_run = get_tests_run(['failures/expected/keybaord.html'], tests_included=True, flatten_batches=True) - self.assertEquals([], tests_run) + self.assertEqual([], tests_run) def test_stderr_is_saved(self): host = MockHost() self.assertTrue(passing_run(host=host)) - self.assertEquals(host.filesystem.read_text_file('/tmp/layout-test-results/passes/error-stderr.txt'), + self.assertEqual(host.filesystem.read_text_file('/tmp/layout-test-results/passes/error-stderr.txt'), 'stuff going to stderr') def test_test_list(self): @@ -532,7 +532,7 @@ class MainTest(unittest.TestCase, StreamTestingMixin): filename = '/tmp/foo.txt' host.filesystem.write_text_file(filename, 'passes/text.html') tests_run = get_tests_run(['--test-list=%s' % filename], tests_included=True, flatten_batches=True, host=host) - self.assertEquals(['passes/text.html'], tests_run) + self.assertEqual(['passes/text.html'], tests_run) host.filesystem.remove(filename) res, out, err, user = logging_run(['--test-list=%s' % filename], tests_included=True, host=host) @@ -544,7 +544,7 @@ class MainTest(unittest.TestCase, StreamTestingMixin): filename = '/tmp/foo.txt' host.filesystem.write_text_file(filename, 'LayoutTests/passes/text.html') tests_run = get_tests_run(['--test-list=%s' % filename], tests_included=True, flatten_batches=True, host=host) - self.assertEquals(['passes/text.html'], tests_run) + self.assertEqual(['passes/text.html'], tests_run) def test_unexpected_failures(self): # Run tests including the unexpected failures. @@ -567,7 +567,7 @@ class MainTest(unittest.TestCase, StreamTestingMixin): tests_included=True, host=host, record_results=True) file_list = host.filesystem.written_files.keys() file_list.remove('/tmp/layout-test-results/tests_run0.txt') - self.assertEquals(res, 1) + self.assertEqual(res, 1) expected_token = '"unexpected":{"text-image-checksum.html":{"expected":"PASS","actual":"IMAGE+TEXT","image_diff_percent":1},"missing_text.html":{"expected":"PASS","is_missing_text":true,"actual":"MISSING"}' json_string = host.filesystem.read_text_file('/tmp/layout-test-results/full_results.json') self.assertTrue(json_string.find(expected_token) != -1) @@ -584,7 +584,7 @@ class MainTest(unittest.TestCase, StreamTestingMixin): 'failures/unexpected/image_not_in_pixeldir.html'] res, out, err, _ = logging_run(extra_args=args, host=host, record_results=True, tests_included=True) - self.assertEquals(res, 1) + self.assertEqual(res, 1) expected_token = '"unexpected":{"pixeldir":{"image_in_pixeldir.html":{"expected":"PASS","actual":"IMAGE"' json_string = host.filesystem.read_text_file('/tmp/layout-test-results/full_results.json') self.assertTrue(json_string.find(expected_token) != -1) @@ -604,7 +604,7 @@ class MainTest(unittest.TestCase, StreamTestingMixin): 'failures/unexpected/missing_text.html', 'failures/unexpected/text-image-checksum.html'], tests_included=True, host=host, record_results=True, port_obj=test_port) - self.assertEquals(res, 2) + self.assertEqual(res, 2) def test_crash_with_stderr(self): host = MockHost() @@ -641,7 +641,7 @@ class MainTest(unittest.TestCase, StreamTestingMixin): record_results=True, host=host) expected_crash_log = mock_crash_report - self.assertEquals(host.filesystem.read_text_file('/tmp/layout-test-results/failures/unexpected/crash-with-stderr-crash-log.txt'), expected_crash_log) + self.assertEqual(host.filesystem.read_text_file('/tmp/layout-test-results/failures/unexpected/crash-with-stderr-crash-log.txt'), expected_crash_log) def test_web_process_crash_log(self): # FIXME: Need to rewrite these tests to not be mac-specific, or move them elsewhere. @@ -657,7 +657,7 @@ class MainTest(unittest.TestCase, StreamTestingMixin): tests_included=True, record_results=True, host=host) - self.assertEquals(host.filesystem.read_text_file('/tmp/layout-test-results/failures/unexpected/web-process-crash-with-stderr-crash-log.txt'), mock_crash_report) + self.assertEqual(host.filesystem.read_text_file('/tmp/layout-test-results/failures/unexpected/web-process-crash-with-stderr-crash-log.txt'), mock_crash_report) def test_exit_after_n_failures_upload(self): host = MockHost() @@ -674,7 +674,7 @@ class MainTest(unittest.TestCase, StreamTestingMixin): self.assertFalse(host.filesystem.exists('/tmp/layout-test-results/incremental_results.json')) # This checks that we report only the number of tests that actually failed. - self.assertEquals(res, 1) + self.assertEqual(res, 1) # This checks that passes/text.html is considered SKIPped. self.assertTrue('"skipped":1' in host.filesystem.read_text_file('/tmp/layout-test-results/full_results.json')) @@ -695,7 +695,7 @@ class MainTest(unittest.TestCase, StreamTestingMixin): ], tests_included=True, flatten_batches=True) - self.assertEquals(['failures/unexpected/text-image-checksum.html'], tests_run) + self.assertEqual(['failures/unexpected/text-image-checksum.html'], tests_run) # But we'll keep going for expected ones. tests_run = get_tests_run([ @@ -705,7 +705,7 @@ class MainTest(unittest.TestCase, StreamTestingMixin): ], tests_included=True, flatten_batches=True) - self.assertEquals(['failures/expected/text.html', 'passes/text.html'], tests_run) + self.assertEqual(['failures/expected/text.html', 'passes/text.html'], tests_run) def test_exit_after_n_crashes(self): # Unexpected crashes should result in tests stopping. @@ -716,7 +716,7 @@ class MainTest(unittest.TestCase, StreamTestingMixin): ], tests_included=True, flatten_batches=True) - self.assertEquals(['failures/unexpected/crash.html'], tests_run) + self.assertEqual(['failures/unexpected/crash.html'], tests_run) # Same with timeouts. tests_run = get_tests_run([ @@ -726,7 +726,7 @@ class MainTest(unittest.TestCase, StreamTestingMixin): ], tests_included=True, flatten_batches=True) - self.assertEquals(['failures/unexpected/timeout.html'], tests_run) + self.assertEqual(['failures/unexpected/timeout.html'], tests_run) # But we'll keep going for expected ones. tests_run = get_tests_run([ @@ -736,7 +736,7 @@ class MainTest(unittest.TestCase, StreamTestingMixin): ], tests_included=True, flatten_batches=True) - self.assertEquals(['failures/expected/crash.html', 'passes/text.html'], tests_run) + self.assertEqual(['failures/expected/crash.html', 'passes/text.html'], tests_run) def test_results_directory_absolute(self): # We run a configuration that should fail, to generate output, then @@ -769,7 +769,7 @@ class MainTest(unittest.TestCase, StreamTestingMixin): def test_retrying_and_flaky_tests(self): host = MockHost() res, out, err, _ = logging_run(['--debug-rwt-logging', 'failures/flaky'], tests_included=True, host=host) - self.assertEquals(res, 0) + self.assertEqual(res, 0) self.assertTrue('Retrying' in err.getvalue()) self.assertTrue('Unexpected flakiness' in out.getvalue()) self.assertTrue(host.filesystem.exists('/tmp/layout-test-results/failures/flaky/text-actual.txt')) @@ -780,7 +780,7 @@ class MainTest(unittest.TestCase, StreamTestingMixin): # and that we don't retry again. host = MockHost() res, out, err, _ = logging_run(['--no-retry-failures', '--clobber-old-results', 'failures/flaky'], tests_included=True, host=host) - self.assertEquals(res, 1) + self.assertEqual(res, 1) self.assertTrue('Clobbering old results' in err.getvalue()) self.assertTrue('flaky/text.html' in err.getvalue()) self.assertTrue('Unexpected text-only failures' in out.getvalue()) @@ -793,10 +793,10 @@ class MainTest(unittest.TestCase, StreamTestingMixin): # order per directory. HTTP tests are sharded separately from other tests, # so we have to test both. tests_run = get_tests_run(['-i', 'passes/passes', 'passes'], tests_included=True, flatten_batches=True) - self.assertEquals(tests_run, sorted(tests_run)) + self.assertEqual(tests_run, sorted(tests_run)) tests_run = get_tests_run(['http/tests/passes'], tests_included=True, flatten_batches=True) - self.assertEquals(tests_run, sorted(tests_run)) + self.assertEqual(tests_run, sorted(tests_run)) def test_tolerance(self): class ImageDiffTestPort(TestPort): @@ -831,29 +831,29 @@ class MainTest(unittest.TestCase, StreamTestingMixin): def test_reftest_run(self): tests_run = get_tests_run(['passes/reftest.html'], tests_included=True, flatten_batches=True) - self.assertEquals(['passes/reftest.html'], tests_run) + self.assertEqual(['passes/reftest.html'], tests_run) def test_reftest_run_reftests_if_pixel_tests_are_disabled(self): tests_run = get_tests_run(['--no-pixel-tests', 'passes/reftest.html'], tests_included=True, flatten_batches=True) - self.assertEquals(['passes/reftest.html'], tests_run) + self.assertEqual(['passes/reftest.html'], tests_run) def test_reftest_skip_reftests_if_no_ref_tests(self): tests_run = get_tests_run(['--no-ref-tests', 'passes/reftest.html'], tests_included=True, flatten_batches=True) - self.assertEquals([], tests_run) + self.assertEqual([], tests_run) tests_run = get_tests_run(['--no-ref-tests', '--no-pixel-tests', 'passes/reftest.html'], tests_included=True, flatten_batches=True) - self.assertEquals([], tests_run) + self.assertEqual([], tests_run) def test_reftest_expected_html_should_be_ignored(self): tests_run = get_tests_run(['passes/reftest-expected.html'], tests_included=True, flatten_batches=True) - self.assertEquals([], tests_run) + self.assertEqual([], tests_run) def test_reftest_driver_should_run_expected_html(self): tests_run = get_tests_run(['passes/reftest.html'], tests_included=True, flatten_batches=True, include_reference_html=True) - self.assertEquals(['passes/reftest.html', 'passes/reftest-expected.html'], tests_run) + self.assertEqual(['passes/reftest.html', 'passes/reftest-expected.html'], tests_run) def test_reftest_driver_should_run_expected_mismatch_html(self): tests_run = get_tests_run(['passes/mismatch.html'], tests_included=True, flatten_batches=True, include_reference_html=True) - self.assertEquals(['passes/mismatch.html', 'passes/mismatch-expected-mismatch.html'], tests_run) + self.assertEqual(['passes/mismatch.html', 'passes/mismatch-expected-mismatch.html'], tests_run) def test_reftest_should_not_use_naming_convention_if_not_listed_in_reftestlist(self): host = MockHost() @@ -916,8 +916,8 @@ class MainTest(unittest.TestCase, StreamTestingMixin): full_results_text = host.filesystem.read_text_file('/tmp/layout-test-results/full_results.json') full_results = json.loads(full_results_text.replace("ADD_RESULTS(", "").replace(");", "")) - self.assertEquals(full_results['has_wdiff'], False) - self.assertEquals(full_results['has_pretty_patch'], False) + self.assertEqual(full_results['has_wdiff'], False) + self.assertEqual(full_results['has_pretty_patch'], False) def test_unsupported_platform(self): oc = outputcapture.OutputCapture() @@ -927,12 +927,12 @@ class MainTest(unittest.TestCase, StreamTestingMixin): finally: stdout, stderr, logs = oc.restore_output() - self.assertEquals(res, run_webkit_tests.EXCEPTIONAL_EXIT_STATUS) - self.assertEquals(stdout, '') + self.assertEqual(res, run_webkit_tests.EXCEPTIONAL_EXIT_STATUS) + self.assertEqual(stdout, '') self.assertTrue('unsupported platform' in stderr) # This is empty because we don't even get a chance to configure the logger before failing. - self.assertEquals(logs, '') + self.assertEqual(logs, '') def test_verbose_in_child_processes(self): # When we actually run multiple processes, we may have to reconfigure logging in the @@ -964,11 +964,11 @@ class EndToEndTest(unittest.TestCase): host = MockHost() res, out, err, user = logging_run(record_results=True, tests_included=True, host=host) - self.assertEquals(res, unexpected_tests_count) + self.assertEqual(res, unexpected_tests_count) results = self.parse_full_results(host.filesystem.read_text_file('/tmp/layout-test-results/full_results.json')) # Check to ensure we're passing back image diff %age correctly. - self.assertEquals(results['tests']['failures']['expected']['image.html']['image_diff_percent'], 1) + self.assertEqual(results['tests']['failures']['expected']['image.html']['image_diff_percent'], 1) # Check that we attempted to display the results page in a browser. self.assertTrue(user.opened_urls) @@ -1016,7 +1016,7 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin): tests_included=True, host=host, new_results=True) file_list = host.filesystem.written_files.keys() file_list.remove('/tmp/layout-test-results/tests_run0.txt') - self.assertEquals(res, 0) + self.assertEqual(res, 0) self.assertEmpty(out) self.assertEqual(len(file_list), 4) self.assertBaselines(file_list, "passes/image", [".txt", ".png"], err) @@ -1034,7 +1034,7 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin): tests_included=True, host=host, new_results=True) file_list = host.filesystem.written_files.keys() file_list.remove('/tmp/layout-test-results/tests_run0.txt') - self.assertEquals(res, 0) + self.assertEqual(res, 0) self.assertNotEmpty(out) self.assertEqual(len(file_list), 6) self.assertBaselines(file_list, "failures/unexpected/missing_text", [".txt"], err) @@ -1052,7 +1052,7 @@ class RebaselineTest(unittest.TestCase, StreamTestingMixin): tests_included=True, host=host, new_results=True) file_list = host.filesystem.written_files.keys() file_list.remove('/tmp/layout-test-results/tests_run0.txt') - self.assertEquals(res, 0) + self.assertEqual(res, 0) self.assertEmpty(out) self.assertEqual(len(file_list), 4) self.assertBaselines(file_list, diff --git a/Tools/Scripts/webkitpy/layout_tests/servers/http_server_base.py b/Tools/Scripts/webkitpy/layout_tests/servers/http_server_base.py index c1c3da827..6a0ce58b0 100755 --- a/Tools/Scripts/webkitpy/layout_tests/servers/http_server_base.py +++ b/Tools/Scripts/webkitpy/layout_tests/servers/http_server_base.py @@ -194,7 +194,7 @@ class HttpServerBase(object): except IOError, e: if e.errno in (errno.EALREADY, errno.EADDRINUSE): raise ServerError('Port %d is already in use.' % port) - elif sys.platform == 'win32' and e.errno in (errno.WSAEACCES,): + elif sys.platform == 'win32' and e.errno in (errno.WSAEACCES,): # pylint: disable-msg=E1101 raise ServerError('Port %d is already in use.' % port) else: raise diff --git a/Tools/Scripts/webkitpy/layout_tests/servers/http_server_integrationtest.py b/Tools/Scripts/webkitpy/layout_tests/servers/http_server_integrationtest.py index 237d689ce..37faa6429 100755 --- a/Tools/Scripts/webkitpy/layout_tests/servers/http_server_integrationtest.py +++ b/Tools/Scripts/webkitpy/layout_tests/servers/http_server_integrationtest.py @@ -80,9 +80,9 @@ class BaseTest(unittest.TestCase): return self.assert_servers_are_down() - self.assertEquals(self.run_script(['--server', 'start']), 0) + self.assertEqual(self.run_script(['--server', 'start']), 0) self.assert_servers_are_up() - self.assertEquals(self.run_script(['--server', 'stop']), 0) + self.assertEqual(self.run_script(['--server', 'stop']), 0) self.assert_servers_are_down() def integration_test_server__fails(self): @@ -99,13 +99,13 @@ class BaseTest(unittest.TestCase): if e.errno in (errno.EADDRINUSE, errno.EALREADY): self.fail('could not bind to port %d: %s' % (port_number, str(e))) raise - self.assertEquals(self.run_script(['--server', 'start']), 1) + self.assertEqual(self.run_script(['--server', 'start']), 1) finally: self.run_script(['--server', 'stop']) test_socket.close() # Test that calling stop() twice is harmless. - self.assertEquals(self.run_script(['--server', 'stop']), 0) + self.assertEqual(self.run_script(['--server', 'stop']), 0) def maybe_make_dir(self, *comps): try: @@ -124,9 +124,9 @@ class BaseTest(unittest.TestCase): self.maybe_make_dir(tmpdir, 'media') self.assert_servers_are_down([18000]) - self.assertEquals(self.run_script(['--server', 'start', '--port=18000', '--root', tmpdir]), 0) + self.assertEqual(self.run_script(['--server', 'start', '--port=18000', '--root', tmpdir]), 0) self.assert_servers_are_up([18000]) - self.assertEquals(self.run_script(['--server', 'stop']), 0) + self.assertEqual(self.run_script(['--server', 'stop']), 0) self.assert_servers_are_down([18000]) diff --git a/Tools/Scripts/webkitpy/layout_tests/servers/http_server_unittest.py b/Tools/Scripts/webkitpy/layout_tests/servers/http_server_unittest.py index 7a14526d1..5cc4a6ee0 100644 --- a/Tools/Scripts/webkitpy/layout_tests/servers/http_server_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/servers/http_server_unittest.py @@ -56,7 +56,7 @@ class TestHttpServer(unittest.TestCase): self.assertRaises(ServerError, server.start) config_file = host.filesystem.read_text_file("/mock/output_dir/lighttpd.conf") - self.assertEquals(re.findall(r"alias.url.+", config_file), [ + self.assertEqual(re.findall(r"alias.url.+", config_file), [ 'alias.url = ( "/js-test-resources" => "/test.checkout/LayoutTests/fast/js/resources" )', 'alias.url += ( "/mock/one-additional-dir" => "/mock-checkout/one-additional-dir" )', 'alias.url += ( "/mock/another-additional-dir" => "/mock-checkout/one-additional-dir" )', diff --git a/Tools/Scripts/webkitpy/layout_tests/views/metered_stream_unittest.py b/Tools/Scripts/webkitpy/layout_tests/views/metered_stream_unittest.py index b388ec608..6620cbb04 100644 --- a/Tools/Scripts/webkitpy/layout_tests/views/metered_stream_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/views/metered_stream_unittest.py @@ -76,7 +76,7 @@ class RegularTest(unittest.TestCase): self.meter.write_throttled_update('foo') self.meter.write_update('bar') self.meter.write('baz') - self.assertEquals(logging_stream.buflist, []) + self.assertEqual(logging_stream.buflist, []) finally: root_logger.removeHandler(handler) root_logger.setLevel(orig_level) @@ -88,12 +88,12 @@ class RegularTest(unittest.TestCase): self.meter.write_throttled_update('baz') self.meter.write_throttled_update('baz 2') self.meter.writeln('done') - self.assertEquals(self.times, []) + self.assertEqual(self.times, []) return self.buflist def test_basic(self): buflist = self._basic([0, 1, 2, 13, 14]) - self.assertEquals(buflist, ['foo\n', 'bar\n', 'baz 2\n', 'done\n']) + self.assertEqual(buflist, ['foo\n', 'bar\n', 'baz 2\n', 'done\n']) def _log_after_update(self): self.meter.write_update('foo') @@ -102,11 +102,11 @@ class RegularTest(unittest.TestCase): def test_log_after_update(self): buflist = self._log_after_update() - self.assertEquals(buflist, ['foo\n', 'bar\n']) + self.assertEqual(buflist, ['foo\n', 'bar\n']) def test_log_args(self): self.logger.info('foo %s %d', 'bar', 2) - self.assertEquals(self.buflist, ['foo bar 2\n']) + self.assertEqual(self.buflist, ['foo bar 2\n']) class TtyTest(RegularTest): verbose = False @@ -114,14 +114,14 @@ class TtyTest(RegularTest): def test_basic(self): buflist = self._basic([0, 1, 1.05, 1.1, 2]) - self.assertEquals(buflist, ['foo', + self.assertEqual(buflist, ['foo', MeteredStream._erasure('foo'), 'bar', MeteredStream._erasure('bar'), 'baz 2', MeteredStream._erasure('baz 2'), 'done\n']) def test_log_after_update(self): buflist = self._log_after_update() - self.assertEquals(buflist, ['foo', + self.assertEqual(buflist, ['foo', MeteredStream._erasure('foo'), 'bar\n']) @@ -137,7 +137,7 @@ class VerboseTest(RegularTest): self.assertTrue(re.match('\d\d:\d\d:01.000 8675 bar\n', buflist[1])) self.assertTrue(re.match('\d\d:\d\d:13.000 8675 baz 2\n', buflist[2])) self.assertTrue(re.match('\d\d:\d\d:14.123 8675 done\n', buflist[3])) - self.assertEquals(len(buflist), 4) + self.assertEqual(len(buflist), 4) def test_log_after_update(self): buflist = self._log_after_update() @@ -146,11 +146,11 @@ class VerboseTest(RegularTest): # The second argument should have a real timestamp and pid, so we just check the format. self.assertTrue(re.match('\d\d:\d\d:\d\d.\d\d\d \d+ bar\n', buflist[1])) - self.assertEquals(len(buflist), 2) + self.assertEqual(len(buflist), 2) def test_log_args(self): self.logger.info('foo %s %d', 'bar', 2) - self.assertEquals(len(self.buflist), 1) + self.assertEqual(len(self.buflist), 1) self.assertTrue(self.buflist[0].endswith('foo bar 2\n')) diff --git a/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py b/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py index bc30092f4..c0b928b0c 100644 --- a/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py @@ -67,7 +67,7 @@ class Testprinter(unittest.TestCase): self.assertTrue(stream.getvalue()) def assertWritten(self, stream, contents): - self.assertEquals(stream.buflist, contents) + self.assertEqual(stream.buflist, contents) def reset(self, stream): stream.buflist = [] @@ -259,27 +259,27 @@ BUGX : failures/expected/timeout.html = TIMEOUT printer, _, _ = self.get_printer() printer._meter.number_of_columns = lambda: 80 actual = printer._test_status_line('fast/dom/HTMLFormElement/associated-elements-after-index-assertion-fail1.html', ' passed') - self.assertEquals(80, len(actual)) - self.assertEquals(actual, '[0/0] fast/dom/HTMLFormElement/associa...after-index-assertion-fail1.html passed') + self.assertEqual(80, len(actual)) + self.assertEqual(actual, '[0/0] fast/dom/HTMLFormElement/associa...after-index-assertion-fail1.html passed') printer._meter.number_of_columns = lambda: 89 actual = printer._test_status_line('fast/dom/HTMLFormElement/associated-elements-after-index-assertion-fail1.html', ' passed') - self.assertEquals(89, len(actual)) - self.assertEquals(actual, '[0/0] fast/dom/HTMLFormElement/associated-...ents-after-index-assertion-fail1.html passed') + self.assertEqual(89, len(actual)) + self.assertEqual(actual, '[0/0] fast/dom/HTMLFormElement/associated-...ents-after-index-assertion-fail1.html passed') printer._meter.number_of_columns = lambda: sys.maxint actual = printer._test_status_line('fast/dom/HTMLFormElement/associated-elements-after-index-assertion-fail1.html', ' passed') - self.assertEquals(90, len(actual)) - self.assertEquals(actual, '[0/0] fast/dom/HTMLFormElement/associated-elements-after-index-assertion-fail1.html passed') + self.assertEqual(90, len(actual)) + self.assertEqual(actual, '[0/0] fast/dom/HTMLFormElement/associated-elements-after-index-assertion-fail1.html passed') printer._meter.number_of_columns = lambda: 18 actual = printer._test_status_line('fast/dom/HTMLFormElement/associated-elements-after-index-assertion-fail1.html', ' passed') - self.assertEquals(18, len(actual)) - self.assertEquals(actual, '[0/0] f...l passed') + self.assertEqual(18, len(actual)) + self.assertEqual(actual, '[0/0] f...l passed') printer._meter.number_of_columns = lambda: 10 actual = printer._test_status_line('fast/dom/HTMLFormElement/associated-elements-after-index-assertion-fail1.html', ' passed') - self.assertEquals(actual, '[0/0] associated-elements-after-index-assertion-fail1.html passed') + self.assertEqual(actual, '[0/0] associated-elements-after-index-assertion-fail1.html passed') def test_details(self): printer, err, _ = self.get_printer(['--details']) diff --git a/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py b/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py index 9c9295f63..62e7353df 100755 --- a/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py +++ b/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py @@ -47,7 +47,7 @@ from webkitpy.performance_tests.perftestsrunner import PerfTestsRunner class MainTest(unittest.TestCase): def assertWritten(self, stream, contents): - self.assertEquals(stream.buflist, contents) + self.assertEqual(stream.buflist, contents) def normalizeFinishedTime(self, log): return re.sub(r'Finished: [0-9\.]+ s', 'Finished: 0.1 s', log) diff --git a/Tools/Scripts/webkitpy/style/checker.py b/Tools/Scripts/webkitpy/style/checker.py index 9f27c36da..282c33b70 100644 --- a/Tools/Scripts/webkitpy/style/checker.py +++ b/Tools/Scripts/webkitpy/style/checker.py @@ -106,6 +106,9 @@ _BASE_FILTER_RULES = [ # with the 79 character limit, or some higher limit that is # agreeable to the WebKit project. '-pep8/E501', + + # FIXME: Move the pylint rules from the pylintrc to here. This will + # also require us to re-work lint-webkitpy to produce the equivalent output. ] diff --git a/Tools/Scripts/webkitpy/style/checker_unittest.py b/Tools/Scripts/webkitpy/style/checker_unittest.py index d834fd557..3de39ebb0 100755 --- a/Tools/Scripts/webkitpy/style/checker_unittest.py +++ b/Tools/Scripts/webkitpy/style/checker_unittest.py @@ -169,7 +169,7 @@ class GlobalVariablesTest(unittest.TestCase): # Also do some additional checks. for rule in base_filter_rules: # Check no leading or trailing white space. - self.assertEquals(rule, rule.strip()) + self.assertEqual(rule, rule.strip()) # All categories are on by default, so defaults should # begin with -. self.assertTrue(rule.startswith('-')) @@ -335,8 +335,8 @@ class CheckerDispatcherSkipTest(unittest.TestCase): handle_style_error=None, min_confidence=3) message = 'while checking: %s' % path - self.assertEquals(checker is None, is_checker_none, message) - self.assertEquals(self._dispatcher.should_skip_without_warning(path), + self.assertEqual(checker is None, is_checker_none, message) + self.assertEqual(self._dispatcher.should_skip_without_warning(path), expected, message) def test_should_skip_without_warning__true(self): @@ -378,7 +378,7 @@ class CheckerDispatcherCarriageReturnTest(unittest.TestCase): dispatcher = CheckerDispatcher() for file_path, expected_result in files.items(): - self.assertEquals(dispatcher.should_check_and_strip_carriage_returns(file_path), expected_result, 'Checking: %s' % file_path) + self.assertEqual(dispatcher.should_check_and_strip_carriage_returns(file_path), expected_result, 'Checking: %s' % file_path) class CheckerDispatcherDispatchTest(unittest.TestCase): @@ -403,7 +403,7 @@ class CheckerDispatcherDispatchTest(unittest.TestCase): """Assert the type of the dispatched checker.""" checker = self.dispatch(file_path) got_class = checker.__class__ - self.assertEquals(got_class, expected_class, + self.assertEqual(got_class, expected_class, 'For path "%(file_path)s" got %(got_class)s when ' "expecting %(expected_class)s." % {"file_path": file_path, @@ -449,8 +449,8 @@ class CheckerDispatcherDispatchTest(unittest.TestCase): file_path = "ChangeLog" self.assert_checker_changelog(file_path) checker = self.dispatch(file_path) - self.assertEquals(checker.file_path, file_path) - self.assertEquals(checker.handle_style_error, + self.assertEqual(checker.file_path, file_path) + self.assertEqual(checker.handle_style_error, self.mock_handle_style_error) def test_cpp_paths(self): @@ -471,18 +471,18 @@ class CheckerDispatcherDispatchTest(unittest.TestCase): file_path = file_base + "." + file_extension self.assert_checker_cpp(file_path) checker = self.dispatch(file_path) - self.assertEquals(checker.file_extension, file_extension) - self.assertEquals(checker.file_path, file_path) - self.assertEquals(checker.handle_style_error, self.mock_handle_style_error) - self.assertEquals(checker.min_confidence, 3) + self.assertEqual(checker.file_extension, file_extension) + self.assertEqual(checker.file_path, file_path) + self.assertEqual(checker.handle_style_error, self.mock_handle_style_error) + self.assertEqual(checker.min_confidence, 3) # Check "-" for good measure. file_base = "-" file_extension = "" file_path = file_base self.assert_checker_cpp(file_path) checker = self.dispatch(file_path) - self.assertEquals(checker.file_extension, file_extension) - self.assertEquals(checker.file_path, file_path) + self.assertEqual(checker.file_extension, file_extension) + self.assertEqual(checker.file_path, file_path) def test_json_paths(self): """Test paths that should be checked as JSON.""" @@ -500,7 +500,7 @@ class CheckerDispatcherDispatchTest(unittest.TestCase): file_path = file_base + "." + file_extension self.assert_checker_json(file_path) checker = self.dispatch(file_path) - self.assertEquals(checker._handle_style_error, + self.assertEqual(checker._handle_style_error, self.mock_handle_style_error) def test_python_paths(self): @@ -519,8 +519,8 @@ class CheckerDispatcherDispatchTest(unittest.TestCase): file_path = file_base + "." + file_extension self.assert_checker_text(file_path) checker = self.dispatch(file_path) - self.assertEquals(checker.file_path, file_path) - self.assertEquals(checker.handle_style_error, + self.assertEqual(checker.file_path, file_path) + self.assertEqual(checker.handle_style_error, self.mock_handle_style_error) def test_text_paths(self): @@ -563,8 +563,8 @@ class CheckerDispatcherDispatchTest(unittest.TestCase): file_path = file_base + "." + file_extension self.assert_checker_text(file_path) checker = self.dispatch(file_path) - self.assertEquals(checker.file_path, file_path) - self.assertEquals(checker.handle_style_error, self.mock_handle_style_error) + self.assertEqual(checker.file_path, file_path) + self.assertEqual(checker.handle_style_error, self.mock_handle_style_error) def test_xml_paths(self): """Test paths that should be checked as XML.""" @@ -582,7 +582,7 @@ class CheckerDispatcherDispatchTest(unittest.TestCase): file_path = file_base + "." + file_extension self.assert_checker_xml(file_path) checker = self.dispatch(file_path) - self.assertEquals(checker._handle_style_error, + self.assertEqual(checker._handle_style_error, self.mock_handle_style_error) def test_none_paths(self): @@ -625,10 +625,10 @@ class StyleProcessorConfigurationTest(unittest.TestCase): configuration = self._style_checker_configuration() # Check that __init__ sets the "public" data attributes correctly. - self.assertEquals(configuration.max_reports_per_category, + self.assertEqual(configuration.max_reports_per_category, {"whitespace/newline": 1}) - self.assertEquals(configuration.stderr_write, self._mock_stderr_write) - self.assertEquals(configuration.min_confidence, 3) + self.assertEqual(configuration.stderr_write, self._mock_stderr_write) + self.assertEqual(configuration.min_confidence, 3) def test_is_reportable(self): """Test the is_reportable() method.""" @@ -653,13 +653,13 @@ class StyleProcessorConfigurationTest(unittest.TestCase): def test_write_style_error_emacs(self): """Test the write_style_error() method.""" self._call_write_style_error("emacs") - self.assertEquals(self._error_messages, + self.assertEqual(self._error_messages, ["foo.h:100: message [whitespace/tab] [5]\n"]) def test_write_style_error_vs7(self): """Test the write_style_error() method.""" self._call_write_style_error("vs7") - self.assertEquals(self._error_messages, + self.assertEqual(self._error_messages, ["foo.h(100): message [whitespace/tab] [5]\n"]) @@ -685,8 +685,8 @@ class StyleProcessor_EndToEndTest(LoggingTestCase): stderr_write=self._mock_stderr_write) processor = StyleProcessor(configuration) - self.assertEquals(processor.error_count, 0) - self.assertEquals(self._messages, []) + self.assertEqual(processor.error_count, 0) + self.assertEqual(self._messages, []) def test_process(self): configuration = StyleProcessorConfiguration( @@ -699,10 +699,10 @@ class StyleProcessor_EndToEndTest(LoggingTestCase): processor.process(lines=['line1', 'Line with tab:\t'], file_path='foo.txt') - self.assertEquals(processor.error_count, 1) + self.assertEqual(processor.error_count, 1) expected_messages = ['foo.txt(2): Line contains tab character. ' '[whitespace/tab] [5]\n'] - self.assertEquals(self._messages, expected_messages) + self.assertEqual(self._messages, expected_messages) class StyleProcessor_CodeCoverageTest(LoggingTestCase): @@ -861,18 +861,18 @@ class StyleProcessor_CodeCoverageTest(LoggingTestCase): # Check that the carriage-return checker was instantiated correctly # and was passed lines correctly. carriage_checker = self.carriage_checker - self.assertEquals(carriage_checker.style_error_handler, + self.assertEqual(carriage_checker.style_error_handler, expected_error_handler) - self.assertEquals(carriage_checker.lines, ['line1', 'line2']) + self.assertEqual(carriage_checker.lines, ['line1', 'line2']) # Check that the style checker was dispatched correctly and was # passed lines correctly. checker = self._mock_dispatcher.dispatched_checker - self.assertEquals(checker.file_path, 'foo.txt') - self.assertEquals(checker.min_confidence, 3) - self.assertEquals(checker.style_error_handler, expected_error_handler) + self.assertEqual(checker.file_path, 'foo.txt') + self.assertEqual(checker.min_confidence, 3) + self.assertEqual(checker.style_error_handler, expected_error_handler) - self.assertEquals(checker.lines, ['line1', 'line2']) + self.assertEqual(checker.lines, ['line1', 'line2']) def test_process__no_checker_dispatched(self): """Test the process() method for a path with no dispatched checker.""" diff --git a/Tools/Scripts/webkitpy/style/checkers/changelog_unittest.py b/Tools/Scripts/webkitpy/style/checkers/changelog_unittest.py index 9fe8a60bc..315cd91b2 100644 --- a/Tools/Scripts/webkitpy/style/checkers/changelog_unittest.py +++ b/Tools/Scripts/webkitpy/style/checkers/changelog_unittest.py @@ -44,8 +44,8 @@ class ChangeLogCheckerTest(unittest.TestCase): def handle_style_error(line_number, category, confidence, message): self.had_error = True - self.assertEquals(expected_line_number, line_number) - self.assertEquals(expected_category, category) + self.assertEqual(expected_line_number, line_number) + self.assertEqual(expected_category, category) self.lines_to_check = set(lines_to_check) checker = changelog.ChangeLogChecker('ChangeLog', handle_style_error, self.mock_should_line_be_checked) checker.check(changelog_data.split('\n')) @@ -59,9 +59,9 @@ class ChangeLogCheckerTest(unittest.TestCase): def test_init(self): checker = changelog.ChangeLogChecker('ChangeLog', self.mock_handle_style_error, self.mock_should_line_be_checked) - self.assertEquals(checker.file_path, 'ChangeLog') - self.assertEquals(checker.handle_style_error, self.mock_handle_style_error) - self.assertEquals(checker.should_line_be_checked, self.mock_should_line_be_checked) + self.assertEqual(checker.file_path, 'ChangeLog') + self.assertEqual(checker.handle_style_error, self.mock_handle_style_error) + self.assertEqual(checker.should_line_be_checked, self.mock_should_line_be_checked) def test_missing_bug_number(self): self.assert_error(1, range(1, 20), 'changelog/bugnumber', diff --git a/Tools/Scripts/webkitpy/style/checkers/common_unittest.py b/Tools/Scripts/webkitpy/style/checkers/common_unittest.py index 1fe126372..df4707730 100644 --- a/Tools/Scripts/webkitpy/style/checkers/common_unittest.py +++ b/Tools/Scripts/webkitpy/style/checkers/common_unittest.py @@ -59,12 +59,12 @@ class CarriageReturnCheckerTest(unittest.TestCase): output_lines = checker.check(input_lines) # Check both the return value and error messages. - self.assertEquals(output_lines, expected_lines) + self.assertEqual(output_lines, expected_lines) expected_errors = [(line_number, self._category, self._confidence, self._expected_message) for line_number in error_lines] - self.assertEquals(self._style_errors, expected_errors) + self.assertEqual(self._style_errors, expected_errors) def test_ends_with_carriage(self): self.assert_carriage_return(["carriage return\r"], @@ -110,7 +110,7 @@ class TabCheckerTest(unittest.TestCase): checker = TabChecker('', style_error_handler) checker.check(input_lines) - self.assertEquals(self._error_lines, error_lines) + self.assertEqual(self._error_lines, error_lines) def test_notab(self): self.assert_tab([''], []) diff --git a/Tools/Scripts/webkitpy/style/checkers/cpp.py b/Tools/Scripts/webkitpy/style/checkers/cpp.py index a1447e2fb..f9d534b8c 100644 --- a/Tools/Scripts/webkitpy/style/checkers/cpp.py +++ b/Tools/Scripts/webkitpy/style/checkers/cpp.py @@ -1078,7 +1078,7 @@ def check_posix_threading(clean_lines, line_number, error): line = clean_lines.elided[line_number] for single_thread_function, multithread_safe_function in _THREADING_LIST: index = line.find(single_thread_function) - # Comparisons made explicit for clarity -- pylint: disable-msg=C6403 + # Comparisons made explicit for clarity if index >= 0 and (index == 0 or (not line[index - 1].isalnum() and line[index - 1] not in ('_', '.', '>'))): error(line_number, 'runtime/threadsafe_fn', 2, @@ -1793,7 +1793,7 @@ def check_spacing(file_extension, clean_lines, line_number, error): comment_position = line.find('//') if comment_position != -1: # Check if the // may be in quotes. If so, ignore it - # Comparisons made explicit for clarity -- pylint: disable-msg=C6403 + # Comparisons made explicit for clarity if (line.count('"', 0, comment_position) - line.count('\\"', 0, comment_position)) % 2 == 0: # not in quotes # Allow one space before end of line comment. if (not match(r'^\s*$', line[:comment_position]) diff --git a/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py b/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py index 552220101..6de7df619 100644 --- a/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py +++ b/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py @@ -116,17 +116,17 @@ class CppFunctionsTest(unittest.TestCase): """Supports testing functions that do not need CppStyleTestBase.""" def test_convert_to_lower_with_underscores(self): - self.assertEquals(cpp_style._convert_to_lower_with_underscores('ABC'), 'abc') - self.assertEquals(cpp_style._convert_to_lower_with_underscores('aB'), 'a_b') - self.assertEquals(cpp_style._convert_to_lower_with_underscores('isAName'), 'is_a_name') - self.assertEquals(cpp_style._convert_to_lower_with_underscores('AnotherTest'), 'another_test') - self.assertEquals(cpp_style._convert_to_lower_with_underscores('PassRefPtr<MyClass>'), 'pass_ref_ptr<my_class>') - self.assertEquals(cpp_style._convert_to_lower_with_underscores('_ABC'), '_abc') + self.assertEqual(cpp_style._convert_to_lower_with_underscores('ABC'), 'abc') + self.assertEqual(cpp_style._convert_to_lower_with_underscores('aB'), 'a_b') + self.assertEqual(cpp_style._convert_to_lower_with_underscores('isAName'), 'is_a_name') + self.assertEqual(cpp_style._convert_to_lower_with_underscores('AnotherTest'), 'another_test') + self.assertEqual(cpp_style._convert_to_lower_with_underscores('PassRefPtr<MyClass>'), 'pass_ref_ptr<my_class>') + self.assertEqual(cpp_style._convert_to_lower_with_underscores('_ABC'), '_abc') def test_create_acronym(self): - self.assertEquals(cpp_style._create_acronym('ABC'), 'ABC') - self.assertEquals(cpp_style._create_acronym('IsAName'), 'IAN') - self.assertEquals(cpp_style._create_acronym('PassRefPtr<MyClass>'), 'PRP<MC>') + self.assertEqual(cpp_style._create_acronym('ABC'), 'ABC') + self.assertEqual(cpp_style._create_acronym('IsAName'), 'IAN') + self.assertEqual(cpp_style._create_acronym('PassRefPtr<MyClass>'), 'PRP<MC>') def test_is_c_or_objective_c(self): clean_lines = cpp_style.CleansedLines(['']) @@ -141,68 +141,68 @@ class CppFunctionsTest(unittest.TestCase): def test_parameter(self): # Test type. parameter = cpp_style.Parameter('ExceptionCode', 13, 1) - self.assertEquals(parameter.type, 'ExceptionCode') - self.assertEquals(parameter.name, '') - self.assertEquals(parameter.row, 1) + self.assertEqual(parameter.type, 'ExceptionCode') + self.assertEqual(parameter.name, '') + self.assertEqual(parameter.row, 1) # Test type and name. parameter = cpp_style.Parameter('PassRefPtr<MyClass> parent', 19, 1) - self.assertEquals(parameter.type, 'PassRefPtr<MyClass>') - self.assertEquals(parameter.name, 'parent') - self.assertEquals(parameter.row, 1) + self.assertEqual(parameter.type, 'PassRefPtr<MyClass>') + self.assertEqual(parameter.name, 'parent') + self.assertEqual(parameter.row, 1) # Test type, no name, with default value. parameter = cpp_style.Parameter('MyClass = 0', 7, 0) - self.assertEquals(parameter.type, 'MyClass') - self.assertEquals(parameter.name, '') - self.assertEquals(parameter.row, 0) + self.assertEqual(parameter.type, 'MyClass') + self.assertEqual(parameter.name, '') + self.assertEqual(parameter.row, 0) # Test type, name, and default value. parameter = cpp_style.Parameter('MyClass a = 0', 7, 0) - self.assertEquals(parameter.type, 'MyClass') - self.assertEquals(parameter.name, 'a') - self.assertEquals(parameter.row, 0) + self.assertEqual(parameter.type, 'MyClass') + self.assertEqual(parameter.name, 'a') + self.assertEqual(parameter.row, 0) def test_single_line_view(self): start_position = cpp_style.Position(row=1, column=1) end_position = cpp_style.Position(row=3, column=1) single_line_view = cpp_style.SingleLineView(['0', 'abcde', 'fgh', 'i'], start_position, end_position) - self.assertEquals(single_line_view.single_line, 'bcde fgh i') - self.assertEquals(single_line_view.convert_column_to_row(0), 1) - self.assertEquals(single_line_view.convert_column_to_row(4), 1) - self.assertEquals(single_line_view.convert_column_to_row(5), 2) - self.assertEquals(single_line_view.convert_column_to_row(8), 2) - self.assertEquals(single_line_view.convert_column_to_row(9), 3) - self.assertEquals(single_line_view.convert_column_to_row(100), 3) + self.assertEqual(single_line_view.single_line, 'bcde fgh i') + self.assertEqual(single_line_view.convert_column_to_row(0), 1) + self.assertEqual(single_line_view.convert_column_to_row(4), 1) + self.assertEqual(single_line_view.convert_column_to_row(5), 2) + self.assertEqual(single_line_view.convert_column_to_row(8), 2) + self.assertEqual(single_line_view.convert_column_to_row(9), 3) + self.assertEqual(single_line_view.convert_column_to_row(100), 3) start_position = cpp_style.Position(row=0, column=3) end_position = cpp_style.Position(row=0, column=4) single_line_view = cpp_style.SingleLineView(['abcdef'], start_position, end_position) - self.assertEquals(single_line_view.single_line, 'd') + self.assertEqual(single_line_view.single_line, 'd') def test_create_skeleton_parameters(self): - self.assertEquals(cpp_style.create_skeleton_parameters(''), '') - self.assertEquals(cpp_style.create_skeleton_parameters(' '), ' ') - self.assertEquals(cpp_style.create_skeleton_parameters('long'), 'long,') - self.assertEquals(cpp_style.create_skeleton_parameters('const unsigned long int'), ' int,') - self.assertEquals(cpp_style.create_skeleton_parameters('long int*'), ' int ,') - self.assertEquals(cpp_style.create_skeleton_parameters('PassRefPtr<Foo> a'), 'PassRefPtr a,') - self.assertEquals(cpp_style.create_skeleton_parameters( + self.assertEqual(cpp_style.create_skeleton_parameters(''), '') + self.assertEqual(cpp_style.create_skeleton_parameters(' '), ' ') + self.assertEqual(cpp_style.create_skeleton_parameters('long'), 'long,') + self.assertEqual(cpp_style.create_skeleton_parameters('const unsigned long int'), ' int,') + self.assertEqual(cpp_style.create_skeleton_parameters('long int*'), ' int ,') + self.assertEqual(cpp_style.create_skeleton_parameters('PassRefPtr<Foo> a'), 'PassRefPtr a,') + self.assertEqual(cpp_style.create_skeleton_parameters( 'ComplexTemplate<NestedTemplate1<MyClass1, MyClass2>, NestedTemplate1<MyClass1, MyClass2> > param, int second'), 'ComplexTemplate param, int second,') - self.assertEquals(cpp_style.create_skeleton_parameters('int = 0, Namespace::Type& a'), 'int , Type a,') + self.assertEqual(cpp_style.create_skeleton_parameters('int = 0, Namespace::Type& a'), 'int , Type a,') # Create skeleton parameters is a bit too aggressive with function variables, but # it allows for parsing other parameters and declarations like this are rare. - self.assertEquals(cpp_style.create_skeleton_parameters('void (*fn)(int a, int b), Namespace::Type& a'), + self.assertEqual(cpp_style.create_skeleton_parameters('void (*fn)(int a, int b), Namespace::Type& a'), 'void , Type a,') # This doesn't look like functions declarations but the simplifications help to eliminate false positives. - self.assertEquals(cpp_style.create_skeleton_parameters('b{d}'), 'b ,') + self.assertEqual(cpp_style.create_skeleton_parameters('b{d}'), 'b ,') def test_find_parameter_name_index(self): - self.assertEquals(cpp_style.find_parameter_name_index(' int a '), 5) - self.assertEquals(cpp_style.find_parameter_name_index(' PassRefPtr '), 16) - self.assertEquals(cpp_style.find_parameter_name_index('double'), 6) + self.assertEqual(cpp_style.find_parameter_name_index(' int a '), 5) + self.assertEqual(cpp_style.find_parameter_name_index(' PassRefPtr '), 16) + self.assertEqual(cpp_style.find_parameter_name_index('double'), 6) def test_parameter_list(self): elided_lines = ['int blah(PassRefPtr<MyClass> paramName,', @@ -219,17 +219,17 @@ class CppFunctionsTest(unittest.TestCase): index = 0 for parameter in cpp_style.parameter_list(elided_lines, start_position, end_position): expected_parameter = expected_parameters[index] - self.assertEquals(parameter.type, expected_parameter['type']) - self.assertEquals(parameter.name, expected_parameter['name']) - self.assertEquals(parameter.row, expected_parameter['row']) + self.assertEqual(parameter.type, expected_parameter['type']) + self.assertEqual(parameter.name, expected_parameter['name']) + self.assertEqual(parameter.row, expected_parameter['row']) index += 1 - self.assertEquals(index, len(expected_parameters)) + self.assertEqual(index, len(expected_parameters)) def test_check_parameter_against_text(self): - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) parameter = cpp_style.Parameter('FooF ooF', 4, 1) self.assertFalse(cpp_style._check_parameter_name_against_text(parameter, 'FooF', error_collector)) - self.assertEquals(error_collector.results(), + self.assertEqual(error_collector.results(), 'The parameter name "ooF" adds no information, so it should be removed. [readability/parameter_name] [5]') class CppStyleTestBase(unittest.TestCase): @@ -253,7 +253,7 @@ class CppStyleTestBase(unittest.TestCase): error, self.min_confidence, unit_test_config) def perform_lint(self, code, filename, basic_error_rules, unit_test_config={}, lines_to_check=None): - error_collector = ErrorCollector(self.assert_, FilterConfiguration(basic_error_rules), lines_to_check) + error_collector = ErrorCollector(self.assertTrue, FilterConfiguration(basic_error_rules), lines_to_check) lines = code.split('\n') extension = filename.split('.')[1] self.process_file_data(filename, extension, lines, error_collector, unit_test_config) @@ -313,7 +313,7 @@ class CppStyleTestBase(unittest.TestCase): # Perform lint and compare the error message with "expected_message". def assert_lint(self, code, expected_message, file_name='foo.cpp'): - self.assertEquals(expected_message, self.perform_single_line_lint(code, file_name)) + self.assertEqual(expected_message, self.perform_single_line_lint(code, file_name)) def assert_lint_one_of_many_errors_re(self, code, expected_message_re, file_name='foo.cpp'): messages = self.perform_single_line_lint(code, file_name) @@ -321,11 +321,11 @@ class CppStyleTestBase(unittest.TestCase): if re.search(expected_message_re, message): return - self.assertEquals(expected_message_re, messages) + self.assertEqual(expected_message_re, messages) def assert_multi_line_lint(self, code, expected_message, file_name='foo.h'): file_extension = file_name[file_name.rfind('.') + 1:] - self.assertEquals(expected_message, self.perform_multi_line_lint(code, file_extension)) + self.assertEqual(expected_message, self.perform_multi_line_lint(code, file_extension)) def assert_multi_line_lint_re(self, code, expected_message_re, file_name='foo.h'): file_extension = file_name[file_name.rfind('.') + 1:] @@ -334,22 +334,22 @@ class CppStyleTestBase(unittest.TestCase): self.fail('Message was:\n' + message + 'Expected match to "' + expected_message_re + '"') def assert_language_rules_check(self, file_name, code, expected_message, lines_to_check=None): - self.assertEquals(expected_message, + self.assertEqual(expected_message, self.perform_language_rules_check(file_name, code, lines_to_check)) def assert_include_what_you_use(self, code, expected_message): - self.assertEquals(expected_message, + self.assertEqual(expected_message, self.perform_include_what_you_use(code)) def assert_blank_lines_check(self, lines, start_errors, end_errors): - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data('foo.cpp', 'cpp', lines, error_collector) - self.assertEquals( + self.assertEqual( start_errors, error_collector.results().count( 'Blank line at the start of a code block. Is this needed?' ' [whitespace/blank_line] [2]')) - self.assertEquals( + self.assertEqual( end_errors, error_collector.results().count( 'Blank line at the end of a code block. Is this needed?' @@ -360,7 +360,7 @@ class CppStyleTestBase(unittest.TestCase): position: a cpp_style.Position object. tuple_position: a tuple (row, column) to compare against.""" - self.assertEquals(position, cpp_style.Position(tuple_position[0], tuple_position[1]), + self.assertEqual(position, cpp_style.Position(tuple_position[0], tuple_position[1]), 'position %s, tuple_position %s' % (position, tuple_position)) @@ -368,16 +368,16 @@ class FunctionDetectionTest(CppStyleTestBase): def perform_function_detection(self, lines, function_information, detection_line=0): clean_lines = cpp_style.CleansedLines(lines) function_state = cpp_style._FunctionState(5) - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) cpp_style.detect_functions(clean_lines, detection_line, function_state, error_collector) if not function_information: - self.assertEquals(function_state.in_a_function, False) + self.assertEqual(function_state.in_a_function, False) return - self.assertEquals(function_state.in_a_function, True) - self.assertEquals(function_state.current_function, function_information['name'] + '()') - self.assertEquals(function_state.modifiers_and_return_type(), function_information['modifiers_and_return_type']) - self.assertEquals(function_state.is_pure, function_information['is_pure']) - self.assertEquals(function_state.is_declaration, function_information['is_declaration']) + self.assertEqual(function_state.in_a_function, True) + self.assertEqual(function_state.current_function, function_information['name'] + '()') + self.assertEqual(function_state.modifiers_and_return_type(), function_information['modifiers_and_return_type']) + self.assertEqual(function_state.is_pure, function_information['is_pure']) + self.assertEqual(function_state.is_declaration, function_information['is_declaration']) self.assert_positions_equal(function_state.function_name_start_position, function_information['function_name_start_position']) self.assert_positions_equal(function_state.parameter_start_position, function_information['parameter_start_position']) self.assert_positions_equal(function_state.parameter_end_position, function_information['parameter_end_position']) @@ -386,13 +386,13 @@ class FunctionDetectionTest(CppStyleTestBase): expected_parameters = function_information.get('parameter_list') if expected_parameters: actual_parameters = function_state.parameter_list() - self.assertEquals(len(actual_parameters), len(expected_parameters)) + self.assertEqual(len(actual_parameters), len(expected_parameters)) for index in range(len(expected_parameters)): actual_parameter = actual_parameters[index] expected_parameter = expected_parameters[index] - self.assertEquals(actual_parameter.type, expected_parameter['type']) - self.assertEquals(actual_parameter.name, expected_parameter['name']) - self.assertEquals(actual_parameter.row, expected_parameter['row']) + self.assertEqual(actual_parameter.type, expected_parameter['type']) + self.assertEqual(actual_parameter.name, expected_parameter['name']) + self.assertEqual(actual_parameter.row, expected_parameter['row']) def test_basic_function_detection(self): self.perform_function_detection( @@ -634,54 +634,54 @@ class CppStyleTest(CppStyleTestBase): # Test get line width. def test_get_line_width(self): - self.assertEquals(0, cpp_style.get_line_width('')) - self.assertEquals(10, cpp_style.get_line_width(u'x' * 10)) - self.assertEquals(16, cpp_style.get_line_width(u'都|道|府|県|支庁')) + self.assertEqual(0, cpp_style.get_line_width('')) + self.assertEqual(10, cpp_style.get_line_width(u'x' * 10)) + self.assertEqual(16, cpp_style.get_line_width(u'都|道|府|県|支庁')) def test_find_next_multi_line_comment_start(self): - self.assertEquals(1, cpp_style.find_next_multi_line_comment_start([''], 0)) + self.assertEqual(1, cpp_style.find_next_multi_line_comment_start([''], 0)) lines = ['a', 'b', '/* c'] - self.assertEquals(2, cpp_style.find_next_multi_line_comment_start(lines, 0)) + self.assertEqual(2, cpp_style.find_next_multi_line_comment_start(lines, 0)) lines = ['char a[] = "/*";'] # not recognized as comment. - self.assertEquals(1, cpp_style.find_next_multi_line_comment_start(lines, 0)) + self.assertEqual(1, cpp_style.find_next_multi_line_comment_start(lines, 0)) def test_find_next_multi_line_comment_end(self): - self.assertEquals(1, cpp_style.find_next_multi_line_comment_end([''], 0)) + self.assertEqual(1, cpp_style.find_next_multi_line_comment_end([''], 0)) lines = ['a', 'b', ' c */'] - self.assertEquals(2, cpp_style.find_next_multi_line_comment_end(lines, 0)) + self.assertEqual(2, cpp_style.find_next_multi_line_comment_end(lines, 0)) def test_remove_multi_line_comments_from_range(self): lines = ['a', ' /* comment ', ' * still comment', ' comment */ ', 'b'] cpp_style.remove_multi_line_comments_from_range(lines, 1, 4) - self.assertEquals(['a', '// dummy', '// dummy', '// dummy', 'b'], lines) + self.assertEqual(['a', '// dummy', '// dummy', '// dummy', 'b'], lines) def test_position(self): position = cpp_style.Position(3, 4) self.assert_positions_equal(position, (3, 4)) - self.assertEquals(position.row, 3) + self.assertEqual(position.row, 3) self.assertTrue(position > cpp_style.Position(position.row - 1, position.column + 1)) self.assertTrue(position > cpp_style.Position(position.row, position.column - 1)) self.assertTrue(position < cpp_style.Position(position.row, position.column + 1)) self.assertTrue(position < cpp_style.Position(position.row + 1, position.column - 1)) - self.assertEquals(position.__str__(), '(3, 4)') + self.assertEqual(position.__str__(), '(3, 4)') def test_rfind_in_lines(self): not_found_position = cpp_style.Position(10, 11) start_position = cpp_style.Position(2, 2) lines = ['ab', 'ace', 'test'] - self.assertEquals(not_found_position, cpp_style._rfind_in_lines('st', lines, start_position, not_found_position)) + self.assertEqual(not_found_position, cpp_style._rfind_in_lines('st', lines, start_position, not_found_position)) self.assertTrue(cpp_style.Position(1, 1) == cpp_style._rfind_in_lines('a', lines, start_position, not_found_position)) - self.assertEquals(cpp_style.Position(2, 2), cpp_style._rfind_in_lines('(te|a)', lines, start_position, not_found_position)) + self.assertEqual(cpp_style.Position(2, 2), cpp_style._rfind_in_lines('(te|a)', lines, start_position, not_found_position)) def test_close_expression(self): - self.assertEquals(cpp_style.Position(1, -1), cpp_style.close_expression([')('], cpp_style.Position(0, 1))) - self.assertEquals(cpp_style.Position(1, -1), cpp_style.close_expression([') ()'], cpp_style.Position(0, 1))) - self.assertEquals(cpp_style.Position(0, 4), cpp_style.close_expression([')[)]'], cpp_style.Position(0, 1))) - self.assertEquals(cpp_style.Position(0, 5), cpp_style.close_expression(['}{}{}'], cpp_style.Position(0, 3))) - self.assertEquals(cpp_style.Position(1, 1), cpp_style.close_expression(['}{}{', '}'], cpp_style.Position(0, 3))) - self.assertEquals(cpp_style.Position(2, -1), cpp_style.close_expression(['][][', ' '], cpp_style.Position(0, 3))) + self.assertEqual(cpp_style.Position(1, -1), cpp_style.close_expression([')('], cpp_style.Position(0, 1))) + self.assertEqual(cpp_style.Position(1, -1), cpp_style.close_expression([') ()'], cpp_style.Position(0, 1))) + self.assertEqual(cpp_style.Position(0, 4), cpp_style.close_expression([')[)]'], cpp_style.Position(0, 1))) + self.assertEqual(cpp_style.Position(0, 5), cpp_style.close_expression(['}{}{}'], cpp_style.Position(0, 3))) + self.assertEqual(cpp_style.Position(1, 1), cpp_style.close_expression(['}{}{', '}'], cpp_style.Position(0, 3))) + self.assertEqual(cpp_style.Position(2, -1), cpp_style.close_expression(['][][', ' '], cpp_style.Position(0, 3))) def test_spaces_at_end_of_line(self): self.assert_lint( @@ -864,10 +864,10 @@ class CppStyleTest(CppStyleTestBase): def test_include_what_you_use_no_implementation_files(self): code = 'std::vector<int> foo;' - self.assertEquals('Add #include <vector> for vector<>' + self.assertEqual('Add #include <vector> for vector<>' ' [build/include_what_you_use] [4]', self.perform_include_what_you_use(code, 'foo.h')) - self.assertEquals('', + self.assertEqual('', self.perform_include_what_you_use(code, 'foo.cpp')) def test_include_what_you_use(self): @@ -1003,7 +1003,7 @@ class CppStyleTest(CppStyleTestBase): '#include "blah/a.h"\n', filename='blah/a.cpp', io=MockIo(mock_header_contents)) - self.assertEquals(message, '') + self.assertEqual(message, '') mock_header_contents = ['#include <set>'] message = self.perform_include_what_you_use( @@ -1013,7 +1013,7 @@ class CppStyleTest(CppStyleTestBase): std::set<int> foo;''', filename='blah/a.cpp', io=MockIo(mock_header_contents)) - self.assertEquals(message, '') + self.assertEqual(message, '') # If there's just a .cpp and the header can't be found then it's ok. message = self.perform_include_what_you_use( @@ -1022,7 +1022,7 @@ class CppStyleTest(CppStyleTestBase): std::set<int> foo;''', filename='blah/a.cpp') - self.assertEquals(message, '') + self.assertEqual(message, '') # Make sure we find the headers with relative paths. mock_header_contents = [''] @@ -1033,40 +1033,40 @@ class CppStyleTest(CppStyleTestBase): std::set<int> foo;''' % (os.path.basename(os.getcwd()), os.path.sep), filename='a.cpp', io=MockIo(mock_header_contents)) - self.assertEquals(message, 'Add #include <set> for set<> ' + self.assertEqual(message, 'Add #include <set> for set<> ' '[build/include_what_you_use] [4]') def test_files_belong_to_same_module(self): f = cpp_style.files_belong_to_same_module - self.assertEquals((True, ''), f('a.cpp', 'a.h')) - self.assertEquals((True, ''), f('base/google.cpp', 'base/google.h')) - self.assertEquals((True, ''), f('base/google_test.cpp', 'base/google.h')) - self.assertEquals((True, ''), + self.assertEqual((True, ''), f('a.cpp', 'a.h')) + self.assertEqual((True, ''), f('base/google.cpp', 'base/google.h')) + self.assertEqual((True, ''), f('base/google_test.cpp', 'base/google.h')) + self.assertEqual((True, ''), f('base/google_unittest.cpp', 'base/google.h')) - self.assertEquals((True, ''), + self.assertEqual((True, ''), f('base/internal/google_unittest.cpp', 'base/public/google.h')) - self.assertEquals((True, 'xxx/yyy/'), + self.assertEqual((True, 'xxx/yyy/'), f('xxx/yyy/base/internal/google_unittest.cpp', 'base/public/google.h')) - self.assertEquals((True, 'xxx/yyy/'), + self.assertEqual((True, 'xxx/yyy/'), f('xxx/yyy/base/google_unittest.cpp', 'base/public/google.h')) - self.assertEquals((True, ''), + self.assertEqual((True, ''), f('base/google_unittest.cpp', 'base/google-inl.h')) - self.assertEquals((True, '/home/build/google3/'), + self.assertEqual((True, '/home/build/google3/'), f('/home/build/google3/base/google.cpp', 'base/google.h')) - self.assertEquals((False, ''), + self.assertEqual((False, ''), f('/home/build/google3/base/google.cpp', 'basu/google.h')) - self.assertEquals((False, ''), f('a.cpp', 'b.h')) + self.assertEqual((False, ''), f('a.cpp', 'b.h')) def test_cleanse_line(self): - self.assertEquals('int foo = 0; ', + self.assertEqual('int foo = 0; ', cpp_style.cleanse_comments('int foo = 0; // danger!')) - self.assertEquals('int o = 0;', + self.assertEqual('int o = 0;', cpp_style.cleanse_comments('int /* foo */ o = 0;')) - self.assertEquals('foo(int a, int b);', + self.assertEqual('foo(int a, int b);', cpp_style.cleanse_comments('foo(int a /* abc */, int b);')) self.assertEqual('f(a, b);', cpp_style.cleanse_comments('f(a, /* name */ b);')) @@ -1113,12 +1113,12 @@ class CppStyleTest(CppStyleTestBase): file_path = 'mydir/foo.cpp' - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data(file_path, 'cpp', ['const char* str = "This is a\\', ' multiline string.";'], error_collector) - self.assertEquals( + self.assertEqual( 2, # One per line. error_collector.result_list().count(multiline_string_error_message)) @@ -1902,11 +1902,11 @@ class CppStyleTest(CppStyleTestBase): def test_newline_at_eof(self): def do_test(self, data, is_missing_eof): - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data('foo.cpp', 'cpp', data.split('\n'), error_collector) # The warning appears only once. - self.assertEquals( + self.assertEqual( int(is_missing_eof), error_collector.results().count( 'Could not find a newline character at the end of the file.' @@ -1917,12 +1917,12 @@ class CppStyleTest(CppStyleTestBase): def test_invalid_utf8(self): def do_test(self, raw_bytes, has_invalid_utf8): - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data('foo.cpp', 'cpp', unicode(raw_bytes, 'utf8', 'replace').split('\n'), error_collector) # The warning appears only once. - self.assertEquals( + self.assertEqual( int(has_invalid_utf8), error_collector.results().count( 'Line contains invalid UTF-8' @@ -1937,11 +1937,11 @@ class CppStyleTest(CppStyleTestBase): do_test(self, '\xef\xbf\xbd\n', True) def test_is_blank_line(self): - self.assert_(cpp_style.is_blank_line('')) - self.assert_(cpp_style.is_blank_line(' ')) - self.assert_(cpp_style.is_blank_line(' \t\r\n')) - self.assert_(not cpp_style.is_blank_line('int a;')) - self.assert_(not cpp_style.is_blank_line('{')) + self.assertTrue(cpp_style.is_blank_line('')) + self.assertTrue(cpp_style.is_blank_line(' ')) + self.assertTrue(cpp_style.is_blank_line(' \t\r\n')) + self.assertTrue(not cpp_style.is_blank_line('int a;')) + self.assertTrue(not cpp_style.is_blank_line('{')) def test_blank_lines_check(self): self.assert_blank_lines_check(['{\n', '\n', '\n', '}\n'], 1, 1) @@ -1952,16 +1952,16 @@ class CppStyleTest(CppStyleTestBase): self.assert_blank_lines_check(['\n', ' if (foo) { return 0; }\n', '\n'], 0, 0) def test_allow_blank_line_before_closing_namespace(self): - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data('foo.cpp', 'cpp', ['namespace {', '', '} // namespace'], error_collector) - self.assertEquals(0, error_collector.results().count( + self.assertEqual(0, error_collector.results().count( 'Blank line at the end of a code block. Is this needed?' ' [whitespace/blank_line] [3]')) def test_allow_blank_line_before_if_else_chain(self): - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data('foo.cpp', 'cpp', ['if (hoge) {', '', # No warning @@ -1973,12 +1973,12 @@ class CppStyleTest(CppStyleTestBase): '', # Warning on this line '}'], error_collector) - self.assertEquals(1, error_collector.results().count( + self.assertEqual(1, error_collector.results().count( 'Blank line at the end of a code block. Is this needed?' ' [whitespace/blank_line] [3]')) def test_else_on_same_line_as_closing_braces(self): - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data('foo.cpp', 'cpp', ['if (hoge) {', '', @@ -1987,7 +1987,7 @@ class CppStyleTest(CppStyleTestBase): '', '}'], error_collector) - self.assertEquals(1, error_collector.results().count( + self.assertEqual(1, error_collector.results().count( 'An else should appear on the same line as the preceding }' ' [whitespace/newline] [4]')) @@ -2144,7 +2144,7 @@ class CppStyleTest(CppStyleTestBase): # side of things, so just parse out the suggested header guard. This # doesn't allow us to test the suggested header guard, but it does let us # test all the other header tests. - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data(file_path, 'h', [], error_collector) expected_guard = '' matcher = re.compile( @@ -2159,10 +2159,10 @@ class CppStyleTest(CppStyleTestBase): self.assertNotEqual(expected_guard, '') # Wrong guard - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data(file_path, 'h', ['#ifndef FOO_H', '#define FOO_H'], error_collector) - self.assertEquals( + self.assertEqual( 1, error_collector.result_list().count( '#ifndef header guard has wrong style, please use: %s' @@ -2170,10 +2170,10 @@ class CppStyleTest(CppStyleTestBase): error_collector.result_list()) # No define - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data(file_path, 'h', ['#ifndef %s' % expected_guard], error_collector) - self.assertEquals( + self.assertEqual( 1, error_collector.result_list().count( 'No #ifndef header guard found, suggested CPP variable is: %s' @@ -2181,12 +2181,12 @@ class CppStyleTest(CppStyleTestBase): error_collector.result_list()) # Mismatched define - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data(file_path, 'h', ['#ifndef %s' % expected_guard, '#define FOO_H'], error_collector) - self.assertEquals( + self.assertEqual( 1, error_collector.result_list().count( 'No #ifndef header guard found, suggested CPP variable is: %s' @@ -2194,7 +2194,7 @@ class CppStyleTest(CppStyleTestBase): error_collector.result_list()) # No header guard errors - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data(file_path, 'h', ['#ifndef %s' % expected_guard, '#define %s' % expected_guard, @@ -2205,13 +2205,13 @@ class CppStyleTest(CppStyleTestBase): self.fail('Unexpected error: %s' % line) # Completely incorrect header guard - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data(file_path, 'h', ['#ifndef FOO', '#define FOO', '#endif // FOO'], error_collector) - self.assertEquals( + self.assertEqual( 1, error_collector.result_list().count( '#ifndef header guard has wrong style, please use: %s' @@ -2219,7 +2219,7 @@ class CppStyleTest(CppStyleTestBase): error_collector.result_list()) # Special case for flymake - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data('mydir/Foo_flymake.h', 'h', ['#ifndef %s' % expected_guard, '#define %s' % expected_guard, @@ -2229,9 +2229,9 @@ class CppStyleTest(CppStyleTestBase): if line.find('build/header_guard') != -1: self.fail('Unexpected error: %s' % line) - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data('mydir/Foo_flymake.h', 'h', [], error_collector) - self.assertEquals( + self.assertEqual( 1, error_collector.result_list().count( 'No #ifndef header guard found, suggested CPP variable is: %s' @@ -2243,27 +2243,27 @@ class CppStyleTest(CppStyleTestBase): # Allow the WTF_ prefix for files in that directory. header_guard_filter = FilterConfiguration(('-', '+build/header_guard')) - error_collector = ErrorCollector(self.assert_, header_guard_filter) + error_collector = ErrorCollector(self.assertTrue, header_guard_filter) self.process_file_data('Source/JavaScriptCore/wtf/TestName.h', 'h', ['#ifndef WTF_TestName_h', '#define WTF_TestName_h'], error_collector) - self.assertEquals(0, len(error_collector.result_list()), + self.assertEqual(0, len(error_collector.result_list()), error_collector.result_list()) # Also allow the non WTF_ prefix for files in that directory. - error_collector = ErrorCollector(self.assert_, header_guard_filter) + error_collector = ErrorCollector(self.assertTrue, header_guard_filter) self.process_file_data('Source/JavaScriptCore/wtf/TestName.h', 'h', ['#ifndef TestName_h', '#define TestName_h'], error_collector) - self.assertEquals(0, len(error_collector.result_list()), + self.assertEqual(0, len(error_collector.result_list()), error_collector.result_list()) # Verify that we suggest the WTF prefix version. - error_collector = ErrorCollector(self.assert_, header_guard_filter) + error_collector = ErrorCollector(self.assertTrue, header_guard_filter) self.process_file_data('Source/JavaScriptCore/wtf/TestName.h', 'h', ['#ifndef BAD_TestName_h', '#define BAD_TestName_h'], error_collector) - self.assertEquals( + self.assertEqual( 1, error_collector.result_list().count( '#ifndef header guard has wrong style, please use: WTF_TestName_h' @@ -2403,29 +2403,29 @@ class CppStyleTest(CppStyleTestBase): file_path = 'mydir/googleclient/foo.cpp' # There should be a copyright message in the first 10 lines - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data(file_path, 'cpp', [], error_collector) - self.assertEquals( + self.assertEqual( 1, error_collector.result_list().count(legal_copyright_message)) - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data( file_path, 'cpp', ['' for unused_i in range(10)] + [copyright_line], error_collector) - self.assertEquals( + self.assertEqual( 1, error_collector.result_list().count(legal_copyright_message)) # Test that warning isn't issued if Copyright line appears early enough. - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data(file_path, 'cpp', [copyright_line], error_collector) for message in error_collector.result_list(): if message.find('legal/copyright') != -1: self.fail('Unexpected error: %s' % message) - error_collector = ErrorCollector(self.assert_) + error_collector = ErrorCollector(self.assertTrue) self.process_file_data( file_path, 'cpp', ['' for unused_i in range(9)] + [copyright_line], @@ -2457,16 +2457,16 @@ class CleansedLinesTest(unittest.TestCase): 'Line 4 "foo"'] clean_lines = cpp_style.CleansedLines(lines) - self.assertEquals(lines, clean_lines.raw_lines) - self.assertEquals(4, clean_lines.num_lines()) + self.assertEqual(lines, clean_lines.raw_lines) + self.assertEqual(4, clean_lines.num_lines()) - self.assertEquals(['Line 1', + self.assertEqual(['Line 1', 'Line 2', 'Line 3 ', 'Line 4 "foo"'], clean_lines.lines) - self.assertEquals(['Line 1', + self.assertEqual(['Line 1', 'Line 2', 'Line 3 ', 'Line 4 ""'], @@ -2474,33 +2474,33 @@ class CleansedLinesTest(unittest.TestCase): def test_init_empty(self): clean_lines = cpp_style.CleansedLines([]) - self.assertEquals([], clean_lines.raw_lines) - self.assertEquals(0, clean_lines.num_lines()) + self.assertEqual([], clean_lines.raw_lines) + self.assertEqual(0, clean_lines.num_lines()) def test_collapse_strings(self): collapse = cpp_style.CleansedLines.collapse_strings - self.assertEquals('""', collapse('""')) # "" (empty) - self.assertEquals('"""', collapse('"""')) # """ (bad) - self.assertEquals('""', collapse('"xyz"')) # "xyz" (string) - self.assertEquals('""', collapse('"\\\""')) # "\"" (string) - self.assertEquals('""', collapse('"\'"')) # "'" (string) - self.assertEquals('"\"', collapse('"\"')) # "\" (bad) - self.assertEquals('""', collapse('"\\\\"')) # "\\" (string) - self.assertEquals('"', collapse('"\\\\\\"')) # "\\\" (bad) - self.assertEquals('""', collapse('"\\\\\\\\"')) # "\\\\" (string) - - self.assertEquals('\'\'', collapse('\'\'')) # '' (empty) - self.assertEquals('\'\'', collapse('\'a\'')) # 'a' (char) - self.assertEquals('\'\'', collapse('\'\\\'\'')) # '\'' (char) - self.assertEquals('\'', collapse('\'\\\'')) # '\' (bad) - self.assertEquals('', collapse('\\012')) # '\012' (char) - self.assertEquals('', collapse('\\xfF0')) # '\xfF0' (char) - self.assertEquals('', collapse('\\n')) # '\n' (char) - self.assertEquals('\#', collapse('\\#')) # '\#' (bad) - - self.assertEquals('StringReplace(body, "", "");', + self.assertEqual('""', collapse('""')) # "" (empty) + self.assertEqual('"""', collapse('"""')) # """ (bad) + self.assertEqual('""', collapse('"xyz"')) # "xyz" (string) + self.assertEqual('""', collapse('"\\\""')) # "\"" (string) + self.assertEqual('""', collapse('"\'"')) # "'" (string) + self.assertEqual('"\"', collapse('"\"')) # "\" (bad) + self.assertEqual('""', collapse('"\\\\"')) # "\\" (string) + self.assertEqual('"', collapse('"\\\\\\"')) # "\\\" (bad) + self.assertEqual('""', collapse('"\\\\\\\\"')) # "\\\\" (string) + + self.assertEqual('\'\'', collapse('\'\'')) # '' (empty) + self.assertEqual('\'\'', collapse('\'a\'')) # 'a' (char) + self.assertEqual('\'\'', collapse('\'\\\'\'')) # '\'' (char) + self.assertEqual('\'', collapse('\'\\\'')) # '\' (bad) + self.assertEqual('', collapse('\\012')) # '\012' (char) + self.assertEqual('', collapse('\\xfF0')) # '\xfF0' (char) + self.assertEqual('', collapse('\\n')) # '\n' (char) + self.assertEqual('\#', collapse('\\#')) # '\#' (bad) + + self.assertEqual('StringReplace(body, "", "");', collapse('StringReplace(body, "\\\\", "\\\\\\\\");')) - self.assertEquals('\'\' ""', + self.assertEqual('\'\' ""', collapse('\'"\' "foo"')) @@ -2890,7 +2890,7 @@ class CheckForFunctionLengthsTest(CppStyleTestBase): code: C++ source code expected to generate a warning message. expected_message: Message expected to be generated by the C++ code. """ - self.assertEquals(expected_message, + self.assertEqual(expected_message, self.perform_function_lengths_check(code)) def trigger_lines(self, error_level): @@ -3346,7 +3346,7 @@ class PassPtrTest(CppStyleTestBase): code: C++ source code expected to generate a warning message. expected_message: Message expected to be generated by the C++ code. """ - self.assertEquals(expected_message, + self.assertEqual(expected_message, self.perform_pass_ptr_check(code)) def test_pass_ref_ptr_in_function(self): @@ -3461,7 +3461,7 @@ class LeakyPatternTest(CppStyleTestBase): code: C++ source code expected to generate a warning message. expected_message: Message expected to be generated by the C++ code. """ - self.assertEquals(expected_message, + self.assertEqual(expected_message, self.perform_leaky_pattern_check(code)) def test_get_dc(self): @@ -4688,45 +4688,45 @@ class WebKitStyleTest(CppStyleTestBase): parameter_error_rules = ('-', '+readability/parameter_name') # No variable name, so no error. - self.assertEquals('', + self.assertEqual('', self.perform_lint('void func(int);', 'test.cpp', parameter_error_rules)) # Verify that copying the name of the set function causes the error (with some odd casing). - self.assertEquals(meaningless_variable_name_error_message % 'itemCount', + self.assertEqual(meaningless_variable_name_error_message % 'itemCount', self.perform_lint('void setItemCount(size_t itemCount);', 'test.cpp', parameter_error_rules)) - self.assertEquals(meaningless_variable_name_error_message % 'abcCount', + self.assertEqual(meaningless_variable_name_error_message % 'abcCount', self.perform_lint('void setABCCount(size_t abcCount);', 'test.cpp', parameter_error_rules)) # Verify that copying a type name will trigger the warning (even if the type is a template parameter). - self.assertEquals(meaningless_variable_name_error_message % 'context', + self.assertEqual(meaningless_variable_name_error_message % 'context', self.perform_lint('void funct(PassRefPtr<ScriptExecutionContext> context);', 'test.cpp', parameter_error_rules)) # Verify that acronyms as variable names trigger the error (for both set functions and type names). - self.assertEquals(meaningless_variable_name_error_message % 'ec', + self.assertEqual(meaningless_variable_name_error_message % 'ec', self.perform_lint('void setExceptionCode(int ec);', 'test.cpp', parameter_error_rules)) - self.assertEquals(meaningless_variable_name_error_message % 'ec', + self.assertEqual(meaningless_variable_name_error_message % 'ec', self.perform_lint('void funct(ExceptionCode ec);', 'test.cpp', parameter_error_rules)) # 'object' alone, appended, or as part of an acronym is meaningless. - self.assertEquals(meaningless_variable_name_error_message % 'object', + self.assertEqual(meaningless_variable_name_error_message % 'object', self.perform_lint('void funct(RenderView object);', 'test.cpp', parameter_error_rules)) - self.assertEquals(meaningless_variable_name_error_message % 'viewObject', + self.assertEqual(meaningless_variable_name_error_message % 'viewObject', self.perform_lint('void funct(RenderView viewObject);', 'test.cpp', parameter_error_rules)) - self.assertEquals(meaningless_variable_name_error_message % 'rvo', + self.assertEqual(meaningless_variable_name_error_message % 'rvo', self.perform_lint('void funct(RenderView rvo);', 'test.cpp', parameter_error_rules)) # Check that r, g, b, and a are allowed. - self.assertEquals('', + self.assertEqual('', self.perform_lint('void setRGBAValues(int r, int g, int b, int a);', 'test.cpp', parameter_error_rules)) # Verify that a simple substring match isn't done which would cause false positives. - self.assertEquals('', + self.assertEqual('', self.perform_lint('void setNateLateCount(size_t elate);', 'test.cpp', parameter_error_rules)) - self.assertEquals('', + self.assertEqual('', self.perform_lint('void funct(NateLate elate);', 'test.cpp', parameter_error_rules)) # Don't have generate warnings for functions (only declarations). - self.assertEquals('', + self.assertEqual('', self.perform_lint('void funct(PassRefPtr<ScriptExecutionContext> context)\n' '{\n' '}\n', 'test.cpp', parameter_error_rules)) @@ -4743,33 +4743,33 @@ class WebKitStyleTest(CppStyleTestBase): def test_webkit_export_check(self): webkit_export_error_rules = ('-', '+readability/webkit_export') - self.assertEquals('', + self.assertEqual('', self.perform_lint('WEBKIT_EXPORT int foo();\n', 'WebKit/chromium/public/test.h', webkit_export_error_rules)) - self.assertEquals('', + self.assertEqual('', self.perform_lint('WEBKIT_EXPORT int foo();\n', 'WebKit/chromium/tests/test.h', webkit_export_error_rules)) - self.assertEquals('WEBKIT_EXPORT should only be used in header files. [readability/webkit_export] [5]', + self.assertEqual('WEBKIT_EXPORT should only be used in header files. [readability/webkit_export] [5]', self.perform_lint('WEBKIT_EXPORT int foo();\n', 'WebKit/chromium/public/test.cpp', webkit_export_error_rules)) - self.assertEquals('WEBKIT_EXPORT should only appear in the chromium public (or tests) directory. [readability/webkit_export] [5]', + self.assertEqual('WEBKIT_EXPORT should only appear in the chromium public (or tests) directory. [readability/webkit_export] [5]', self.perform_lint('WEBKIT_EXPORT int foo();\n', 'WebKit/chromium/src/test.h', webkit_export_error_rules)) - self.assertEquals('WEBKIT_EXPORT should not be used on a function with a body. [readability/webkit_export] [5]', + self.assertEqual('WEBKIT_EXPORT should not be used on a function with a body. [readability/webkit_export] [5]', self.perform_lint('WEBKIT_EXPORT int foo() { }\n', 'WebKit/chromium/public/test.h', webkit_export_error_rules)) - self.assertEquals('WEBKIT_EXPORT should not be used on a function with a body. [readability/webkit_export] [5]', + self.assertEqual('WEBKIT_EXPORT should not be used on a function with a body. [readability/webkit_export] [5]', self.perform_lint('WEBKIT_EXPORT inline int foo()\n' '{\n' '}\n', 'WebKit/chromium/public/test.h', webkit_export_error_rules)) - self.assertEquals('WEBKIT_EXPORT should not be used with a pure virtual function. [readability/webkit_export] [5]', + self.assertEqual('WEBKIT_EXPORT should not be used with a pure virtual function. [readability/webkit_export] [5]', self.perform_lint('{}\n' 'WEBKIT_EXPORT\n' 'virtual\n' @@ -4777,7 +4777,7 @@ class WebKitStyleTest(CppStyleTestBase): 'foo() = 0;\n', 'WebKit/chromium/public/test.h', webkit_export_error_rules)) - self.assertEquals('', + self.assertEqual('', self.perform_lint('{}\n' 'WEBKIT_EXPORT\n' 'virtual\n' @@ -4804,10 +4804,10 @@ class CppCheckerTest(unittest.TestCase): def test_init(self): """Test __init__ constructor.""" checker = self._checker() - self.assertEquals(checker.file_extension, "h") - self.assertEquals(checker.file_path, "foo") - self.assertEquals(checker.handle_style_error, self.mock_handle_style_error) - self.assertEquals(checker.min_confidence, 3) + self.assertEqual(checker.file_extension, "h") + self.assertEqual(checker.file_path, "foo") + self.assertEqual(checker.handle_style_error, self.mock_handle_style_error) + self.assertEqual(checker.min_confidence, 3) def test_eq(self): """Test __eq__ equality function.""" diff --git a/Tools/Scripts/webkitpy/style/checkers/jsonchecker_unittest.py b/Tools/Scripts/webkitpy/style/checkers/jsonchecker_unittest.py index 973c67384..e7fbbb42c 100755 --- a/Tools/Scripts/webkitpy/style/checkers/jsonchecker_unittest.py +++ b/Tools/Scripts/webkitpy/style/checkers/jsonchecker_unittest.py @@ -67,8 +67,8 @@ class JSONCheckerTest(unittest.TestCase): def assert_error(self, expected_line_number, expected_category, json_data): def handle_style_error(mock_error_handler, line_number, category, confidence, message): mock_error_handler.had_error = True - self.assertEquals(expected_line_number, line_number) - self.assertEquals(expected_category, category) + self.assertEqual(expected_line_number, line_number) + self.assertEqual(expected_category, category) self.assertTrue(category in jsonchecker.JSONChecker.categories) error_handler = MockErrorHandler(handle_style_error) @@ -91,7 +91,7 @@ class JSONCheckerTest(unittest.TestCase): def test_init(self): error_handler = MockErrorHandler(self.mock_handle_style_error) checker = jsonchecker.JSONChecker('foo.json', error_handler) - self.assertEquals(checker._handle_style_error, error_handler) + self.assertEqual(checker._handle_style_error, error_handler) def test_no_error(self): self.assert_no_error("""{ diff --git a/Tools/Scripts/webkitpy/style/checkers/png_unittest.py b/Tools/Scripts/webkitpy/style/checkers/png_unittest.py index 764c28591..92b5ba448 100644 --- a/Tools/Scripts/webkitpy/style/checkers/png_unittest.py +++ b/Tools/Scripts/webkitpy/style/checkers/png_unittest.py @@ -52,8 +52,8 @@ class PNGCheckerTest(unittest.TestCase): pass checker = PNGChecker("test/config", mock_handle_style_error, MockSCMDetector('git'), MockSystemHost()) - self.assertEquals(checker._file_path, "test/config") - self.assertEquals(checker._handle_style_error, mock_handle_style_error) + self.assertEqual(checker._file_path, "test/config") + self.assertEqual(checker._handle_style_error, mock_handle_style_error) def test_check(self): errors = [] @@ -69,8 +69,8 @@ class PNGCheckerTest(unittest.TestCase): scm = MockSCMDetector('svn') checker = PNGChecker(file_path, mock_handle_style_error, scm, MockSystemHost(filesystem=fs)) checker.check() - self.assertEquals(len(errors), 1) - self.assertEquals(errors[0], + self.assertEqual(len(errors), 1) + self.assertEqual(errors[0], (0, 'image/png', 5, 'Set the svn:mime-type property (svn propset svn:mime-type image/png ).')) files = {'/Users/mock/.subversion/config': 'enable-auto-props = yes\n*.png = svn:mime-type=image/png'} @@ -79,7 +79,7 @@ class PNGCheckerTest(unittest.TestCase): errors = [] checker = PNGChecker("config", mock_handle_style_error, scm, MockSystemHost(os_name='linux', filesystem=fs)) checker.check() - self.assertEquals(len(errors), 0) + self.assertEqual(len(errors), 0) files = {'/Users/mock/.subversion/config': '#enable-auto-props = yes'} fs = MockFileSystem(files) @@ -87,7 +87,7 @@ class PNGCheckerTest(unittest.TestCase): errors = [] checker = PNGChecker("config", mock_handle_style_error, scm, MockSystemHost(os_name='linux', filesystem=fs)) checker.check() - self.assertEquals(len(errors), 1) + self.assertEqual(len(errors), 1) files = {'/Users/mock/.subversion/config': 'enable-auto-props = yes\n#enable-auto-props = yes\n*.png = svn:mime-type=image/png'} fs = MockFileSystem(files) @@ -95,7 +95,7 @@ class PNGCheckerTest(unittest.TestCase): errors = [] checker = PNGChecker("config", mock_handle_style_error, scm, MockSystemHost(os_name='linux', filesystem=fs)) checker.check() - self.assertEquals(len(errors), 0) + self.assertEqual(len(errors), 0) files = {'/Users/mock/.subversion/config': '#enable-auto-props = yes\nenable-auto-props = yes\n*.png = svn:mime-type=image/png'} fs = MockFileSystem(files) @@ -103,7 +103,7 @@ class PNGCheckerTest(unittest.TestCase): errors = [] checker = PNGChecker("config", mock_handle_style_error, scm, MockSystemHost(os_name='linux', filesystem=fs)) checker.check() - self.assertEquals(len(errors), 0) + self.assertEqual(len(errors), 0) files = {'/Users/mock/.subversion/config': 'enable-auto-props = no'} fs = MockFileSystem(files) @@ -111,7 +111,7 @@ class PNGCheckerTest(unittest.TestCase): errors = [] checker = PNGChecker("config", mock_handle_style_error, scm, MockSystemHost(os_name='linux', filesystem=fs)) checker.check() - self.assertEquals(len(errors), 1) + self.assertEqual(len(errors), 1) file_path = "foo.png" fs.write_binary_file(file_path, "Dummy binary data") @@ -119,7 +119,7 @@ class PNGCheckerTest(unittest.TestCase): errors = [] checker = PNGChecker(file_path, mock_handle_style_error, scm, MockSystemHost(os_name='linux', filesystem=fs)) checker.check() - self.assertEquals(len(errors), 1) + self.assertEqual(len(errors), 1) file_path = "foo-expected.png" fs.write_binary_file(file_path, "Dummy binary data") @@ -127,8 +127,8 @@ class PNGCheckerTest(unittest.TestCase): errors = [] checker = PNGChecker(file_path, mock_handle_style_error, scm, MockSystemHost(os_name='linux', filesystem=fs)) checker.check() - self.assertEquals(len(errors), 2) - self.assertEquals(errors[0], (0, 'image/png', 5, 'Image lacks a checksum. Generate pngs using run-webkit-tests to ensure they have a checksum.')) + self.assertEqual(len(errors), 2) + self.assertEqual(errors[0], (0, 'image/png', 5, 'Image lacks a checksum. Generate pngs using run-webkit-tests to ensure they have a checksum.')) if __name__ == '__main__': unittest.main() diff --git a/Tools/Scripts/webkitpy/style/checkers/python.py b/Tools/Scripts/webkitpy/style/checkers/python.py index 8cfd1b2d3..9fc436f3d 100644 --- a/Tools/Scripts/webkitpy/style/checkers/python.py +++ b/Tools/Scripts/webkitpy/style/checkers/python.py @@ -22,23 +22,32 @@ """Supports checking WebKit style in Python files.""" +import re +from StringIO import StringIO + +from webkitpy.common.system.filesystem import FileSystem +from webkitpy.common.webkit_finder import WebKitFinder from webkitpy.thirdparty.autoinstalled import pep8 +from webkitpy.thirdparty.autoinstalled.pylint import lint +from webkitpy.thirdparty.autoinstalled.pylint.reporters.text import ParseableTextReporter class PythonChecker(object): - """Processes text lines for checking style.""" - def __init__(self, file_path, handle_style_error): self._file_path = file_path self._handle_style_error = handle_style_error def check(self, lines): + self._check_pep8(lines) + self._check_pylint(lines) + + def _check_pep8(self, lines): # Initialize pep8.options, which is necessary for # Checker.check_all() to execute. pep8.process_options(arglist=[self._file_path]) - checker = pep8.Checker(self._file_path) + pep8_checker = pep8.Checker(self._file_path) def _pep8_handle_error(line_number, offset, text, check): # FIXME: Incorporate the character offset into the error output. @@ -51,6 +60,69 @@ class PythonChecker(object): self._handle_style_error(line_number, category, 5, pep8_message) - checker.report_error = _pep8_handle_error + pep8_checker.report_error = _pep8_handle_error + pep8_errors = pep8_checker.check_all() + + def _check_pylint(self, lines): + pylinter = Pylinter() + + # FIXME: for now, we only report pylint errors, but we should be catching and + # filtering warnings using the rules in style/checker.py instead. + output = pylinter.run(['-E', self._file_path]) + + lint_regex = re.compile('([^:]+):([^:]+): \[([^]]+)\] (.*)') + for error in output.getvalue().splitlines(): + match_obj = lint_regex.match(error) + assert(match_obj) + line_number = int(match_obj.group(2)) + category_and_method = match_obj.group(3).split(', ') + category = 'pylint/' + (category_and_method[0]) + if len(category_and_method) > 1: + message = '[%s] %s' % (category_and_method[1], match_obj.group(4)) + else: + message = match_obj.group(4) + self._handle_style_error(line_number, category, 5, message) + + +class Pylinter(object): + # We filter out these messages because they are bugs in pylint that produce false positives. + # FIXME: Does it make sense to combine these rules with the rules in style/checker.py somehow? + FALSE_POSITIVES = [ + # possibly http://www.logilab.org/ticket/98613 ? + "Instance of 'Popen' has no 'poll' member", + "Instance of 'Popen' has no 'returncode' member", + "Instance of 'Popen' has no 'stdin' member", + "Instance of 'Popen' has no 'stdout' member", + "Instance of 'Popen' has no 'stderr' member", + "Instance of 'Popen' has no 'wait' member", + ] + + def __init__(self): + self._pylintrc = WebKitFinder(FileSystem()).path_from_webkit_base('Tools', 'Scripts', 'webkitpy', 'pylintrc') + + def run(self, argv): + output = _FilteredStringIO(self.FALSE_POSITIVES) + lint.Run(['--rcfile', self._pylintrc] + argv, reporter=ParseableTextReporter(output=output), exit=False) + return output + + +class _FilteredStringIO(StringIO): + def __init__(self, bad_messages): + StringIO.__init__(self) + self.dropped_last_msg = False + self.bad_messages = bad_messages + + def write(self, msg=''): + if not self._filter(msg): + StringIO.write(self, msg) - errors = checker.check_all() + def _filter(self, msg): + if any(bad_message in msg for bad_message in self.bad_messages): + self.dropped_last_msg = True + return True + if self.dropped_last_msg: + # We drop the newline after a dropped message as well. + self.dropped_last_msg = False + if msg == '\n': + return True + return False diff --git a/Tools/Scripts/webkitpy/style/checkers/python_unittest.py b/Tools/Scripts/webkitpy/style/checkers/python_unittest.py index e003eb86d..73bda76e2 100644 --- a/Tools/Scripts/webkitpy/style/checkers/python_unittest.py +++ b/Tools/Scripts/webkitpy/style/checkers/python_unittest.py @@ -38,8 +38,8 @@ class PythonCheckerTest(unittest.TestCase): pass checker = PythonChecker("foo.txt", _mock_handle_style_error) - self.assertEquals(checker._file_path, "foo.txt") - self.assertEquals(checker._handle_style_error, + self.assertEqual(checker._file_path, "foo.txt") + self.assertEqual(checker._handle_style_error, _mock_handle_style_error) def test_check(self): @@ -57,6 +57,7 @@ class PythonCheckerTest(unittest.TestCase): checker = PythonChecker(file_path, _mock_handle_style_error) checker.check(lines=[]) - self.assertEquals(len(errors), 1) - self.assertEquals(errors[0], - (2, "pep8/W291", 5, "trailing whitespace")) + self.assertEqual(errors, [ + (4, "pep8/W291", 5, "trailing whitespace"), + (4, "pylint/E0602", 5, "Undefined variable 'error'"), + ]) diff --git a/Tools/Scripts/webkitpy/style/checkers/python_unittest_input.py b/Tools/Scripts/webkitpy/style/checkers/python_unittest_input.py index 9f1d11848..afa1d4e22 100644 --- a/Tools/Scripts/webkitpy/style/checkers/python_unittest_input.py +++ b/Tools/Scripts/webkitpy/style/checkers/python_unittest_input.py @@ -1,2 +1,4 @@ -# This file is sample input for python_unittest.py and includes a single -# error which is an extra space at the end of this line. +# This file is sample input for python_unittest.py and includes two +# problems, one that will generate a PEP-8 warning for trailing whitespace +# and one that will generate a pylint error for an undefined variable. +print error() diff --git a/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py b/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py index 1516de797..b1d7f77f4 100644 --- a/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py +++ b/Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py @@ -71,7 +71,7 @@ class TestExpectationsTestCase(unittest.TestCase): if port: self.assertTrue(port.name().startswith(expected_port_implementation)) else: - self.assertEquals(None, expected_port_implementation) + self.assertEqual(None, expected_port_implementation) def test_determine_port_from_expectations_path(self): self._expect_port_for_expectations_path(None, '/') @@ -95,7 +95,7 @@ class TestExpectationsTestCase(unittest.TestCase): self._error_collector, host=host) # We should have failed to find a valid port object for that path. - self.assertEquals(checker._port_obj, None) + self.assertEqual(checker._port_obj, None) # Now use a test port so we can check the lines. checker._port_obj = host.port_factory.get('test-mac-leopard') @@ -105,7 +105,7 @@ class TestExpectationsTestCase(unittest.TestCase): if should_pass: self.assertEqual('', self._error_collector.get_errors()) elif expected_output: - self.assertEquals(expected_output, self._error_collector.get_errors()) + self.assertEqual(expected_output, self._error_collector.get_errors()) else: self.assertNotEquals('', self._error_collector.get_errors()) self.assertTrue(self._error_collector.turned_off_filtering) diff --git a/Tools/Scripts/webkitpy/style/checkers/text_unittest.py b/Tools/Scripts/webkitpy/style/checkers/text_unittest.py index ced49a943..18db6ad3d 100644 --- a/Tools/Scripts/webkitpy/style/checkers/text_unittest.py +++ b/Tools/Scripts/webkitpy/style/checkers/text_unittest.py @@ -46,7 +46,7 @@ class TextStyleTestCase(unittest.TestCase): self.had_error = True text_style.process_file_data('', lines, error_for_test) - self.assert_(not self.had_error, '%s should not have any errors.' % lines) + self.assertTrue(not self.had_error, '%s should not have any errors.' % lines) def assertError(self, lines, expected_line_number): """Asserts that the specified lines has an error.""" @@ -54,12 +54,12 @@ class TextStyleTestCase(unittest.TestCase): def error_for_test(line_number, category, confidence, message): """Checks if the expected error occurs.""" - self.assertEquals(expected_line_number, line_number) - self.assertEquals('whitespace/tab', category) + self.assertEqual(expected_line_number, line_number) + self.assertEqual('whitespace/tab', category) self.had_error = True text_style.process_file_data('', lines, error_for_test) - self.assert_(self.had_error, '%s should have an error [whitespace/tab].' % lines) + self.assertTrue(self.had_error, '%s should have an error [whitespace/tab].' % lines) def test_no_error(self): @@ -86,8 +86,8 @@ class TextCheckerTest(unittest.TestCase): def test_init(self): """Test __init__ constructor.""" checker = TextChecker("foo.txt", self.mock_handle_style_error) - self.assertEquals(checker.file_path, "foo.txt") - self.assertEquals(checker.handle_style_error, self.mock_handle_style_error) + self.assertEqual(checker.file_path, "foo.txt") + self.assertEqual(checker.handle_style_error, self.mock_handle_style_error) if __name__ == '__main__': diff --git a/Tools/Scripts/webkitpy/style/checkers/watchlist_unittest.py b/Tools/Scripts/webkitpy/style/checkers/watchlist_unittest.py index c8d29db02..ff3a315f1 100644 --- a/Tools/Scripts/webkitpy/style/checkers/watchlist_unittest.py +++ b/Tools/Scripts/webkitpy/style/checkers/watchlist_unittest.py @@ -56,8 +56,8 @@ class WatchListTest(unittest.TestCase): def test_basic_error_message(self): def handle_style_error(mock_error_handler, line_number, category, confidence, message): mock_error_handler.had_error = True - self.assertEquals(0, line_number) - self.assertEquals('watchlist/general', category) + self.assertEqual(0, line_number) + self.assertEqual('watchlist/general', category) error_handler = MockErrorHandler(handle_style_error) error_handler.had_error = False diff --git a/Tools/Scripts/webkitpy/style/checkers/xcodeproj_unittest.py b/Tools/Scripts/webkitpy/style/checkers/xcodeproj_unittest.py index 9799ec016..9713fd154 100644 --- a/Tools/Scripts/webkitpy/style/checkers/xcodeproj_unittest.py +++ b/Tools/Scripts/webkitpy/style/checkers/xcodeproj_unittest.py @@ -62,7 +62,7 @@ class XcodeProjectFileCheckerTest(unittest.TestCase): error_handler = TestErrorHandler(handler) checker = xcodeproj.XcodeProjectFileChecker('', error_handler) checker.check(lines) - self.assert_(self.had_error, '%s should have error: %s.' % (lines, expected_message)) + self.assertTrue(self.had_error, '%s should have error: %s.' % (lines, expected_message)) def test_detect_development_region(self): self.assert_no_error(['developmentRegion = English;']) diff --git a/Tools/Scripts/webkitpy/style/checkers/xml_unittest.py b/Tools/Scripts/webkitpy/style/checkers/xml_unittest.py index e486f5fe4..7055a4f92 100644 --- a/Tools/Scripts/webkitpy/style/checkers/xml_unittest.py +++ b/Tools/Scripts/webkitpy/style/checkers/xml_unittest.py @@ -57,8 +57,8 @@ class XMLCheckerTest(unittest.TestCase): def assert_error(self, expected_line_number, expected_category, xml_data): def handle_style_error(mock_error_handler, line_number, category, confidence, message): mock_error_handler.had_error = True - self.assertEquals(expected_line_number, line_number) - self.assertEquals(expected_category, category) + self.assertEqual(expected_line_number, line_number) + self.assertEqual(expected_category, category) error_handler = MockErrorHandler(handle_style_error) error_handler.had_error = False @@ -80,7 +80,7 @@ class XMLCheckerTest(unittest.TestCase): def test_init(self): error_handler = MockErrorHandler(self.mock_handle_style_error) checker = xml.XMLChecker('foo.xml', error_handler) - self.assertEquals(checker._handle_style_error, error_handler) + self.assertEqual(checker._handle_style_error, error_handler) def test_missing_closing_tag(self): self.assert_error(3, 'xml/syntax', '<foo>\n<bar>\n</foo>\n') diff --git a/Tools/Scripts/webkitpy/style/error_handlers_unittest.py b/Tools/Scripts/webkitpy/style/error_handlers_unittest.py index 864bc0f7a..c02143178 100644 --- a/Tools/Scripts/webkitpy/style/error_handlers_unittest.py +++ b/Tools/Scripts/webkitpy/style/error_handlers_unittest.py @@ -70,8 +70,8 @@ class DefaultStyleErrorHandlerTest(unittest.TestCase): def _check_initialized(self): """Check that count and error messages are initialized.""" - self.assertEquals(0, self._error_count) - self.assertEquals(0, len(self._error_messages)) + self.assertEqual(0, self._error_count) + self.assertEqual(0, len(self._error_messages)) def _call_error_handler(self, handle_error, confidence, line_number=100): """Call the given error handler with a test error.""" @@ -131,8 +131,8 @@ class DefaultStyleErrorHandlerTest(unittest.TestCase): error_handler = self._error_handler(configuration) self._call_error_handler(error_handler, confidence) - self.assertEquals(0, self._error_count) - self.assertEquals([], self._error_messages) + self.assertEqual(0, self._error_count) + self.assertEqual([], self._error_messages) # Also serves as a reportable error test. def test_max_reports_per_category(self): @@ -145,27 +145,27 @@ class DefaultStyleErrorHandlerTest(unittest.TestCase): # First call: usual reporting. self._call_error_handler(error_handler, confidence) - self.assertEquals(1, self._error_count) - self.assertEquals(1, len(self._error_messages)) - self.assertEquals(self._error_messages, + self.assertEqual(1, self._error_count) + self.assertEqual(1, len(self._error_messages)) + self.assertEqual(self._error_messages, ["foo.h(100): message [whitespace/tab] [5]\n"]) # Second call: suppression message reported. self._call_error_handler(error_handler, confidence) # The "Suppressing further..." message counts as an additional # message (but not as an addition to the error count). - self.assertEquals(2, self._error_count) - self.assertEquals(3, len(self._error_messages)) - self.assertEquals(self._error_messages[-2], + self.assertEqual(2, self._error_count) + self.assertEqual(3, len(self._error_messages)) + self.assertEqual(self._error_messages[-2], "foo.h(100): message [whitespace/tab] [5]\n") - self.assertEquals(self._error_messages[-1], + self.assertEqual(self._error_messages[-1], "Suppressing further [whitespace/tab] reports " "for this file.\n") # Third call: no report. self._call_error_handler(error_handler, confidence) - self.assertEquals(3, self._error_count) - self.assertEquals(3, len(self._error_messages)) + self.assertEqual(3, self._error_count) + self.assertEqual(3, len(self._error_messages)) def test_line_numbers(self): """Test the line_numbers parameter.""" @@ -177,20 +177,20 @@ class DefaultStyleErrorHandlerTest(unittest.TestCase): # Error on non-modified line: no error. self._call_error_handler(error_handler, confidence, line_number=60) - self.assertEquals(0, self._error_count) - self.assertEquals([], self._error_messages) + self.assertEqual(0, self._error_count) + self.assertEqual([], self._error_messages) # Error on modified line: error. self._call_error_handler(error_handler, confidence, line_number=50) - self.assertEquals(1, self._error_count) - self.assertEquals(self._error_messages, + self.assertEqual(1, self._error_count) + self.assertEqual(self._error_messages, ["foo.h(50): message [whitespace/tab] [5]\n"]) # Error on non-modified line after turning off line filtering: error. error_handler.turn_off_line_filtering() self._call_error_handler(error_handler, confidence, line_number=60) - self.assertEquals(2, self._error_count) - self.assertEquals(self._error_messages, + self.assertEqual(2, self._error_count) + self.assertEqual(self._error_messages, ['foo.h(50): message [whitespace/tab] [5]\n', 'foo.h(60): message [whitespace/tab] [5]\n', 'Suppressing further [whitespace/tab] reports for this file.\n']) diff --git a/Tools/Scripts/webkitpy/style/filereader_unittest.py b/Tools/Scripts/webkitpy/style/filereader_unittest.py index bcf94f33e..d728c463a 100644 --- a/Tools/Scripts/webkitpy/style/filereader_unittest.py +++ b/Tools/Scripts/webkitpy/style/filereader_unittest.py @@ -74,14 +74,14 @@ class TextFileReaderTest(LoggingTestCase): def _assert_file_reader(self, passed_to_processor, file_count): """Assert the state of the file reader.""" - self.assertEquals(passed_to_processor, self._passed_to_processor()) - self.assertEquals(file_count, self._file_reader.file_count) + self.assertEqual(passed_to_processor, self._passed_to_processor()) + self.assertEqual(file_count, self._file_reader.file_count) def test_process_file__does_not_exist(self): try: self._file_reader.process_file('does_not_exist.txt') except SystemExit, err: - self.assertEquals(str(err), '1') + self.assertEqual(str(err), '1') else: self.fail('No Exception raised.') self._assert_file_reader([], 1) @@ -152,4 +152,4 @@ class TextFileReaderTest(LoggingTestCase): def test_count_delete_only_file(self): self._file_reader.count_delete_only_file() delete_only_file_count = self._file_reader.delete_only_file_count - self.assertEquals(delete_only_file_count, 1) + self.assertEqual(delete_only_file_count, 1) diff --git a/Tools/Scripts/webkitpy/style/filter_unittest.py b/Tools/Scripts/webkitpy/style/filter_unittest.py index 7b8a5402a..c20d9981a 100644 --- a/Tools/Scripts/webkitpy/style/filter_unittest.py +++ b/Tools/Scripts/webkitpy/style/filter_unittest.py @@ -30,7 +30,7 @@ from filter import FilterConfiguration # On Testing __eq__() and __ne__(): # -# In the tests below, we deliberately do not use assertEquals() or +# In the tests below, we deliberately do not use assertEqual() or # assertNotEquals() to test __eq__() or __ne__(). We do this to be # very explicit about what we are testing, especially in the case # of assertNotEquals(). @@ -88,17 +88,17 @@ class CategoryFilterTest(unittest.TestCase): """Test __init__ method.""" # Test that the attributes are getting set correctly. filter = CategoryFilter(["+"]) - self.assertEquals(["+"], filter._filter_rules) + self.assertEqual(["+"], filter._filter_rules) def test_init_default_arguments(self): """Test __init__ method default arguments.""" filter = CategoryFilter() - self.assertEquals([], filter._filter_rules) + self.assertEqual([], filter._filter_rules) def test_str(self): """Test __str__ "to string" operator.""" filter = CategoryFilter(["+a", "-b"]) - self.assertEquals(str(filter), "+a,-b") + self.assertEqual(str(filter), "+a,-b") def test_eq(self): """Test __eq__ equality function.""" @@ -162,17 +162,17 @@ class FilterConfigurationTest(unittest.TestCase): config = self._config(base_rules, path_specific, user_rules) - self.assertEquals(base_rules, config._base_rules) - self.assertEquals(path_specific, config._path_specific) - self.assertEquals(user_rules, config._user_rules) + self.assertEqual(base_rules, config._base_rules) + self.assertEqual(path_specific, config._path_specific) + self.assertEqual(user_rules, config._user_rules) def test_default_arguments(self): # Test that the attributes are getting set correctly to the defaults. config = FilterConfiguration() - self.assertEquals([], config._base_rules) - self.assertEquals([], config._path_specific) - self.assertEquals([], config._user_rules) + self.assertEqual([], config._base_rules) + self.assertEqual([], config._path_specific) + self.assertEqual([], config._user_rules) def test_eq(self): """Test __eq__ method.""" diff --git a/Tools/Scripts/webkitpy/style/main_unittest.py b/Tools/Scripts/webkitpy/style/main_unittest.py index 545783300..e0191687a 100644 --- a/Tools/Scripts/webkitpy/style/main_unittest.py +++ b/Tools/Scripts/webkitpy/style/main_unittest.py @@ -43,9 +43,9 @@ class ChangeDirectoryTest(unittest.TestCase): def _assert_result(self, actual_return_value, expected_return_value, expected_log_messages, expected_current_directory): - self.assertEquals(actual_return_value, expected_return_value) + self.assertEqual(actual_return_value, expected_return_value) self._log.assertMessages(expected_log_messages) - self.assertEquals(self.filesystem.getcwd(), expected_current_directory) + self.assertEqual(self.filesystem.getcwd(), expected_current_directory) def test_paths_none(self): paths = self._change_directory(checkout_root=self._checkout_root, paths=None) diff --git a/Tools/Scripts/webkitpy/style/optparser.py b/Tools/Scripts/webkitpy/style/optparser.py index f4e99237b..4b638c055 100644 --- a/Tools/Scripts/webkitpy/style/optparser.py +++ b/Tools/Scripts/webkitpy/style/optparser.py @@ -345,7 +345,7 @@ class ArgumentParser(object): # Override OptionParser's print_help() method so that help output # does not render to the screen while running unit tests. print_help = parser.print_help - parser.print_help = lambda: print_help(file=stderr) + parser.print_help = lambda file=stderr: print_help(file=file) return parser diff --git a/Tools/Scripts/webkitpy/style/optparser_unittest.py b/Tools/Scripts/webkitpy/style/optparser_unittest.py index a6b64da42..979b31d1a 100644 --- a/Tools/Scripts/webkitpy/style/optparser_unittest.py +++ b/Tools/Scripts/webkitpy/style/optparser_unittest.py @@ -49,14 +49,14 @@ class ArgumentPrinterTest(unittest.TestCase): def test_to_flag_string(self): options = self._create_options('vs7', 5, ['+foo', '-bar'], 'git') - self.assertEquals('--filter=+foo,-bar --git-commit=git ' + self.assertEqual('--filter=+foo,-bar --git-commit=git ' '--min-confidence=5 --output=vs7', self._printer.to_flag_string(options)) # This is to check that --filter and --git-commit do not # show up when not user-specified. options = self._create_options() - self.assertEquals('--min-confidence=3 --output=emacs', + self.assertEqual('--min-confidence=3 --output=emacs', self._printer.to_flag_string(options)) @@ -142,53 +142,53 @@ class ArgumentParserTest(LoggingTestCase): (files, options) = parse([]) - self.assertEquals(files, []) + self.assertEqual(files, []) - self.assertEquals(options.filter_rules, []) - self.assertEquals(options.git_commit, None) - self.assertEquals(options.diff_files, False) - self.assertEquals(options.is_verbose, False) - self.assertEquals(options.min_confidence, 3) - self.assertEquals(options.output_format, 'vs7') + self.assertEqual(options.filter_rules, []) + self.assertEqual(options.git_commit, None) + self.assertEqual(options.diff_files, False) + self.assertEqual(options.is_verbose, False) + self.assertEqual(options.min_confidence, 3) + self.assertEqual(options.output_format, 'vs7') def test_parse_explicit_arguments(self): parse = self._parse # Pass non-default explicit values. (files, options) = parse(['--min-confidence=4']) - self.assertEquals(options.min_confidence, 4) + self.assertEqual(options.min_confidence, 4) (files, options) = parse(['--output=emacs']) - self.assertEquals(options.output_format, 'emacs') + self.assertEqual(options.output_format, 'emacs') (files, options) = parse(['-g', 'commit']) - self.assertEquals(options.git_commit, 'commit') + self.assertEqual(options.git_commit, 'commit') (files, options) = parse(['--git-commit=commit']) - self.assertEquals(options.git_commit, 'commit') + self.assertEqual(options.git_commit, 'commit') (files, options) = parse(['--git-diff=commit']) - self.assertEquals(options.git_commit, 'commit') + self.assertEqual(options.git_commit, 'commit') (files, options) = parse(['--verbose']) - self.assertEquals(options.is_verbose, True) + self.assertEqual(options.is_verbose, True) (files, options) = parse(['--diff-files', 'file.txt']) - self.assertEquals(options.diff_files, True) + self.assertEqual(options.diff_files, True) # Pass user_rules. (files, options) = parse(['--filter=+build,-whitespace']) - self.assertEquals(options.filter_rules, + self.assertEqual(options.filter_rules, ["+build", "-whitespace"]) # Pass spurious white space in user rules. (files, options) = parse(['--filter=+build, -whitespace']) - self.assertEquals(options.filter_rules, + self.assertEqual(options.filter_rules, ["+build", "-whitespace"]) def test_parse_files(self): parse = self._parse (files, options) = parse(['foo.cpp']) - self.assertEquals(files, ['foo.cpp']) + self.assertEqual(files, ['foo.cpp']) # Pass multiple files. (files, options) = parse(['--output=emacs', 'foo.cpp', 'bar.cpp']) - self.assertEquals(files, ['foo.cpp', 'bar.cpp']) + self.assertEqual(files, ['foo.cpp', 'bar.cpp']) class CommandOptionValuesTest(unittest.TestCase): @@ -199,11 +199,11 @@ class CommandOptionValuesTest(unittest.TestCase): """Test __init__ constructor.""" # Check default parameters. options = ProcessorOptions() - self.assertEquals(options.filter_rules, []) - self.assertEquals(options.git_commit, None) - self.assertEquals(options.is_verbose, False) - self.assertEquals(options.min_confidence, 1) - self.assertEquals(options.output_format, "emacs") + self.assertEqual(options.filter_rules, []) + self.assertEqual(options.git_commit, None) + self.assertEqual(options.is_verbose, False) + self.assertEqual(options.min_confidence, 1) + self.assertEqual(options.output_format, "emacs") # Check argument validation. self.assertRaises(ValueError, ProcessorOptions, output_format="bad") @@ -220,11 +220,11 @@ class CommandOptionValuesTest(unittest.TestCase): is_verbose=True, min_confidence=3, output_format="vs7") - self.assertEquals(options.filter_rules, ["+"]) - self.assertEquals(options.git_commit, "commit") - self.assertEquals(options.is_verbose, True) - self.assertEquals(options.min_confidence, 3) - self.assertEquals(options.output_format, "vs7") + self.assertEqual(options.filter_rules, ["+"]) + self.assertEqual(options.git_commit, "commit") + self.assertEqual(options.is_verbose, True) + self.assertEqual(options.min_confidence, 3) + self.assertEqual(options.output_format, "vs7") def test_eq(self): """Test __eq__ equality function.""" diff --git a/Tools/Scripts/webkitpy/style/patchreader_unittest.py b/Tools/Scripts/webkitpy/style/patchreader_unittest.py index eb26d4761..983b609e4 100644 --- a/Tools/Scripts/webkitpy/style/patchreader_unittest.py +++ b/Tools/Scripts/webkitpy/style/patchreader_unittest.py @@ -64,9 +64,9 @@ class PatchReaderTest(unittest.TestCase): self._patch_checker.check(patch_string) def _assert_checked(self, passed_to_process_file, delete_only_file_count): - self.assertEquals(self._file_reader.passed_to_process_file, + self.assertEqual(self._file_reader.passed_to_process_file, passed_to_process_file) - self.assertEquals(self._file_reader.delete_only_file_count, + self.assertEqual(self._file_reader.delete_only_file_count, delete_only_file_count) def test_check_patch(self): diff --git a/Tools/Scripts/webkitpy/test/finder_unittest.py b/Tools/Scripts/webkitpy/test/finder_unittest.py index 5c808a17e..694b3884a 100644 --- a/Tools/Scripts/webkitpy/test/finder_unittest.py +++ b/Tools/Scripts/webkitpy/test/finder_unittest.py @@ -58,7 +58,7 @@ class FinderTest(unittest.TestCase): handler.level = self.log_levels.pop(0) def test_additional_system_paths(self): - self.assertEquals(self.finder.additional_paths(['/usr']), + self.assertEqual(self.finder.additional_paths(['/usr']), ['/foo', '/foo2']) def test_is_module(self): @@ -70,9 +70,9 @@ class FinderTest(unittest.TestCase): self.assertFalse(self.finder.is_module('baz')) def test_to_module(self): - self.assertEquals(self.finder.to_module('/foo/test.py'), 'test') - self.assertEquals(self.finder.to_module('/foo/bar/test.py'), 'bar.test') - self.assertEquals(self.finder.to_module('/foo/bar/pytest.py'), 'bar.pytest') + self.assertEqual(self.finder.to_module('/foo/test.py'), 'test') + self.assertEqual(self.finder.to_module('/foo/bar/test.py'), 'bar.test') + self.assertEqual(self.finder.to_module('/foo/bar/pytest.py'), 'bar.pytest') def test_clean(self): self.assertTrue(self.fs.exists('/foo2/bar2/missing.pyc')) @@ -80,7 +80,7 @@ class FinderTest(unittest.TestCase): self.assertFalse(self.fs.exists('/foo2/bar2/missing.pyc')) def check_names(self, names, expected_names, find_all=True): - self.assertEquals(self.finder.find_names(names, find_all), expected_names) + self.assertEqual(self.finder.find_names(names, find_all), expected_names) def test_default_names(self): self.check_names([], ['bar.baz_unittest', 'bar2.baz2_integrationtest'], find_all=True) diff --git a/Tools/Scripts/webkitpy/test/main.py b/Tools/Scripts/webkitpy/test/main.py index e639a4578..d8f997805 100644 --- a/Tools/Scripts/webkitpy/test/main.py +++ b/Tools/Scripts/webkitpy/test/main.py @@ -135,6 +135,9 @@ class Tester(object): self._options.child_processes = 1 if self._options.coverage: + _log.warning("Checking code coverage, so running things serially") + self._options.child_processes = 1 + import webkitpy.thirdparty.autoinstalled.coverage as coverage cov = coverage.coverage() cov.start() diff --git a/Tools/Scripts/webkitpy/test/main_unittest.py b/Tools/Scripts/webkitpy/test/main_unittest.py index 4fa6ef384..031abd65b 100644 --- a/Tools/Scripts/webkitpy/test/main_unittest.py +++ b/Tools/Scripts/webkitpy/test/main_unittest.py @@ -81,25 +81,25 @@ class TesterTest(unittest.TestCase): def test_individual_names_are_not_run_twice(self): args = [STUBS_CLASS + '.test_empty'] parallel_tests, serial_tests = self._find_test_names(args) - self.assertEquals(parallel_tests, args) - self.assertEquals(serial_tests, []) + self.assertEqual(parallel_tests, args) + self.assertEqual(serial_tests, []) def test_integration_tests_are_not_found_by_default(self): parallel_tests, serial_tests = self._find_test_names([STUBS_CLASS]) - self.assertEquals(parallel_tests, [ + self.assertEqual(parallel_tests, [ STUBS_CLASS + '.test_empty', ]) - self.assertEquals(serial_tests, [ + self.assertEqual(serial_tests, [ STUBS_CLASS + '.serial_test_empty', ]) def test_integration_tests_are_found(self): parallel_tests, serial_tests = self._find_test_names(['--integration-tests', STUBS_CLASS]) - self.assertEquals(parallel_tests, [ + self.assertEqual(parallel_tests, [ STUBS_CLASS + '.integration_test_empty', STUBS_CLASS + '.test_empty', ]) - self.assertEquals(serial_tests, [ + self.assertEqual(serial_tests, [ STUBS_CLASS + '.serial_integration_test_empty', STUBS_CLASS + '.serial_test_empty', ]) @@ -113,5 +113,5 @@ class TesterTest(unittest.TestCase): stdout=executive.PIPE, stderr=executive.PIPE) out, _ = proc.communicate() retcode = proc.returncode - self.assertEquals(retcode, 0) + self.assertEqual(retcode, 0) self.assertTrue('Cover' in out) diff --git a/Tools/Scripts/webkitpy/test/runner_unittest.py b/Tools/Scripts/webkitpy/test/runner_unittest.py index 8fe1b0633..e5be1921c 100644 --- a/Tools/Scripts/webkitpy/test/runner_unittest.py +++ b/Tools/Scripts/webkitpy/test/runner_unittest.py @@ -92,9 +92,9 @@ class RunnerTest(unittest.TestCase): ('test3 (Foo)', 'E', 'test3\nerred')) runner = Runner(Printer(stream, options), loader) runner.run(['Foo.test1', 'Foo.test2', 'Foo.test3'], 1) - self.assertEquals(runner.tests_run, 3) - self.assertEquals(len(runner.failures), 1) - self.assertEquals(len(runner.errors), 1) + self.assertEqual(runner.tests_run, 3) + self.assertEqual(len(runner.failures), 1) + self.assertEqual(len(runner.errors), 1) if __name__ == '__main__': diff --git a/Tools/Scripts/webkitpy/thirdparty/__init__.py b/Tools/Scripts/webkitpy/thirdparty/__init__.py index 74ea5f601..ee5891122 100644 --- a/Tools/Scripts/webkitpy/thirdparty/__init__.py +++ b/Tools/Scripts/webkitpy/thirdparty/__init__.py @@ -105,7 +105,9 @@ class AutoinstallImportHook(object): def _install_pylint(self): self._ensure_autoinstalled_dir_is_in_sys_path() did_install_something = False - if not self._fs.exists(self._fs.join(_AUTOINSTALLED_DIR, "pylint")): + if (not self._fs.exists(self._fs.join(_AUTOINSTALLED_DIR, "pylint")) or + not self._fs.exists(self._fs.join(_AUTOINSTALLED_DIR, "logilab/astng")) or + not self._fs.exists(self._fs.join(_AUTOINSTALLED_DIR, "logilab/common"))): installer = AutoInstaller(target_dir=_AUTOINSTALLED_DIR) did_install_something = installer.install("http://pypi.python.org/packages/source/l/logilab-common/logilab-common-0.58.1.tar.gz#md5=77298ab2d8bb8b4af9219791e7cee8ce", url_subpath="logilab-common-0.58.1", target_name="logilab/common") did_install_something |= installer.install("http://pypi.python.org/packages/source/l/logilab-astng/logilab-astng-0.24.1.tar.gz#md5=ddaf66e4d85714d9c47a46d4bed406de", url_subpath="logilab-astng-0.24.1", target_name="logilab/astng") diff --git a/Tools/Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py b/Tools/Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py index 8b3341623..2958c6cc1 100644 --- a/Tools/Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py +++ b/Tools/Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py @@ -564,7 +564,7 @@ command_failed: failure_message='Unable to land patch' script_error='MOCK land f return ExpectedFailures() task = CommitQueueTask(MockDelegate(), patch) - self.assertEquals(task.validate(), is_valid) + self.assertEqual(task.validate(), is_valid) def _mock_patch(self, attachment_dict={}, bug_dict={'bug_status': 'NEW'}, committer="fake"): bug = bugzilla.Bug(bug_dict, None) diff --git a/Tools/Scripts/webkitpy/tool/bot/expectedfailures_unittest.py b/Tools/Scripts/webkitpy/tool/bot/expectedfailures_unittest.py index 4c1c3d929..3cee3f059 100644 --- a/Tools/Scripts/webkitpy/tool/bot/expectedfailures_unittest.py +++ b/Tools/Scripts/webkitpy/tool/bot/expectedfailures_unittest.py @@ -45,7 +45,7 @@ class MockResults(object): class ExpectedFailuresTest(unittest.TestCase): def _assert_can_trust(self, results, can_trust): - self.assertEquals(ExpectedFailures._should_trust(results), can_trust) + self.assertEqual(ExpectedFailures._should_trust(results), can_trust) def test_can_trust_results(self): self._assert_can_trust(None, False) @@ -77,19 +77,19 @@ class ExpectedFailuresTest(unittest.TestCase): def test_unexpected_failures_observed(self): failures = ExpectedFailures() failures.update(MockResults(['foo.html'])) - self.assertEquals(failures.unexpected_failures_observed(MockResults(['foo.html', 'bar.html'])), set(['bar.html'])) - self.assertEquals(failures.unexpected_failures_observed(MockResults(['baz.html'])), set(['baz.html'])) + self.assertEqual(failures.unexpected_failures_observed(MockResults(['foo.html', 'bar.html'])), set(['bar.html'])) + self.assertEqual(failures.unexpected_failures_observed(MockResults(['baz.html'])), set(['baz.html'])) unbounded_results = MockResults(['baz.html', 'qux.html', 'taco.html'], failure_limit=3) - self.assertEquals(failures.unexpected_failures_observed(unbounded_results), set(['baz.html', 'qux.html', 'taco.html'])) + self.assertEqual(failures.unexpected_failures_observed(unbounded_results), set(['baz.html', 'qux.html', 'taco.html'])) unbounded_results_with_existing_failure = MockResults(['foo.html', 'baz.html', 'qux.html', 'taco.html'], failure_limit=4) - self.assertEquals(failures.unexpected_failures_observed(unbounded_results_with_existing_failure), set(['baz.html', 'qux.html', 'taco.html'])) + self.assertEqual(failures.unexpected_failures_observed(unbounded_results_with_existing_failure), set(['baz.html', 'qux.html', 'taco.html'])) def test_unexpected_failures_observed_when_tree_is_hosed(self): failures = ExpectedFailures() failures.update(MockResults(['foo.html', 'banana.html'], failure_limit=2)) - self.assertEquals(failures.unexpected_failures_observed(MockResults(['foo.html', 'bar.html'])), None) - self.assertEquals(failures.unexpected_failures_observed(MockResults(['baz.html'])), None) + self.assertEqual(failures.unexpected_failures_observed(MockResults(['foo.html', 'bar.html'])), None) + self.assertEqual(failures.unexpected_failures_observed(MockResults(['baz.html'])), None) unbounded_results = MockResults(['baz.html', 'qux.html', 'taco.html'], failure_limit=3) - self.assertEquals(failures.unexpected_failures_observed(unbounded_results), None) + self.assertEqual(failures.unexpected_failures_observed(unbounded_results), None) unbounded_results_with_existing_failure = MockResults(['foo.html', 'baz.html', 'qux.html', 'taco.html'], failure_limit=4) - self.assertEquals(failures.unexpected_failures_observed(unbounded_results_with_existing_failure), None) + self.assertEqual(failures.unexpected_failures_observed(unbounded_results_with_existing_failure), None) diff --git a/Tools/Scripts/webkitpy/tool/bot/feeders_unittest.py b/Tools/Scripts/webkitpy/tool/bot/feeders_unittest.py index dff48ad8b..060a5c85b 100644 --- a/Tools/Scripts/webkitpy/tool/bot/feeders_unittest.py +++ b/Tools/Scripts/webkitpy/tool/bot/feeders_unittest.py @@ -77,4 +77,4 @@ Feeding commit-queue items [10005, 10000] feeder = CommitQueueFeeder(MockTool()) patches = [MockPatch(1, None), MockPatch(2, '-'), MockPatch(3, "+")] - self.assertEquals([patch.id for patch in feeder._patches_with_acceptable_review_flag(patches)], [1, 3]) + self.assertEqual([patch.id for patch in feeder._patches_with_acceptable_review_flag(patches)], [1, 3]) diff --git a/Tools/Scripts/webkitpy/tool/bot/irc_command_unittest.py b/Tools/Scripts/webkitpy/tool/bot/irc_command_unittest.py index 4dec669fd..4abee6678 100644 --- a/Tools/Scripts/webkitpy/tool/bot/irc_command_unittest.py +++ b/Tools/Scripts/webkitpy/tool/bot/irc_command_unittest.py @@ -37,30 +37,30 @@ from webkitpy.common.system.executive_mock import MockExecutive class IRCCommandTest(unittest.TestCase): def test_whois(self): whois = Whois() - self.assertEquals("tom: Usage: whois SEARCH_STRING", + self.assertEqual("tom: Usage: whois SEARCH_STRING", whois.execute("tom", [], None, None)) - self.assertEquals("tom: Usage: whois SEARCH_STRING", + self.assertEqual("tom: Usage: whois SEARCH_STRING", whois.execute("tom", ["Adam", "Barth"], None, None)) - self.assertEquals("tom: Sorry, I don't know any contributors matching 'unknown@example.com'.", + self.assertEqual("tom: Sorry, I don't know any contributors matching 'unknown@example.com'.", whois.execute("tom", ["unknown@example.com"], None, None)) - self.assertEquals("tom: tonyg@chromium.org is tonyg-cr. Why do you ask?", + self.assertEqual("tom: tonyg@chromium.org is tonyg-cr. Why do you ask?", whois.execute("tom", ["tonyg@chromium.org"], None, None)) - self.assertEquals("tom: TonyG@Chromium.org is tonyg-cr. Why do you ask?", + self.assertEqual("tom: TonyG@Chromium.org is tonyg-cr. Why do you ask?", whois.execute("tom", ["TonyG@Chromium.org"], None, None)) - self.assertEquals("tom: rniwa is rniwa (rniwa@webkit.org). Why do you ask?", + self.assertEqual("tom: rniwa is rniwa (rniwa@webkit.org). Why do you ask?", whois.execute("tom", ["rniwa"], None, None)) - self.assertEquals("tom: lopez is xan (xan.lopez@gmail.com, xan@gnome.org, xan@webkit.org, xlopez@igalia.com). Why do you ask?", + self.assertEqual("tom: lopez is xan (xan.lopez@gmail.com, xan@gnome.org, xan@webkit.org, xlopez@igalia.com). Why do you ask?", whois.execute("tom", ["lopez"], None, None)) - self.assertEquals('tom: "Vicki Murley" <vicki@apple.com> hasn\'t told me their nick. Boo hoo :-(', + self.assertEqual('tom: "Vicki Murley" <vicki@apple.com> hasn\'t told me their nick. Boo hoo :-(', whois.execute("tom", ["vicki@apple.com"], None, None)) - self.assertEquals('tom: I\'m not sure who you mean? gavinp or gbarra could be \'Gavin\'.', + self.assertEqual('tom: I\'m not sure who you mean? gavinp or gbarra could be \'Gavin\'.', whois.execute("tom", ["Gavin"], None, None)) - self.assertEquals('tom: More than 5 contributors match \'david\', could you be more specific?', + self.assertEqual('tom: More than 5 contributors match \'david\', could you be more specific?', whois.execute("tom", ["david"], None, None)) def test_create_bug(self): create_bug = CreateBug() - self.assertEquals("tom: Usage: create-bug BUG_TITLE", + self.assertEqual("tom: Usage: create-bug BUG_TITLE", create_bug.execute("tom", [], None, None)) example_args = ["sherrif-bot", "should", "have", "a", "create-bug", "command"] @@ -68,19 +68,19 @@ class IRCCommandTest(unittest.TestCase): # MockBugzilla has a create_bug, but it logs to stderr, this avoids any logging. tool.bugs.create_bug = lambda a, b, cc=None, assignee=None: 50004 - self.assertEquals("tom: Created bug: http://example.com/50004", + self.assertEqual("tom: Created bug: http://example.com/50004", create_bug.execute("tom", example_args, tool, None)) def mock_create_bug(title, description, cc=None, assignee=None): raise Exception("Exception from bugzilla!") tool.bugs.create_bug = mock_create_bug - self.assertEquals("tom: Failed to create bug:\nException from bugzilla!", + self.assertEqual("tom: Failed to create bug:\nException from bugzilla!", create_bug.execute("tom", example_args, tool, None)) def test_roll_chromium_deps(self): roll = RollChromiumDEPS() - self.assertEquals(None, roll._parse_args([])) - self.assertEquals("1234", roll._parse_args(["1234"])) + self.assertEqual(None, roll._parse_args([])) + self.assertEqual("1234", roll._parse_args(["1234"])) def test_rollout_updates_working_copy(self): rollout = Rollout() @@ -91,27 +91,27 @@ class IRCCommandTest(unittest.TestCase): def test_rollout(self): rollout = Rollout() - self.assertEquals(([1234], "testing foo"), + self.assertEqual(([1234], "testing foo"), rollout._parse_args(["1234", "testing", "foo"])) - self.assertEquals(([554], "testing foo"), + self.assertEqual(([554], "testing foo"), rollout._parse_args(["r554", "testing", "foo"])) - self.assertEquals(([556, 792], "testing foo"), + self.assertEqual(([556, 792], "testing foo"), rollout._parse_args(["r556", "792", "testing", "foo"])) - self.assertEquals(([128, 256], "testing foo"), + self.assertEqual(([128, 256], "testing foo"), rollout._parse_args(["r128,r256", "testing", "foo"])) - self.assertEquals(([512, 1024, 2048], "testing foo"), + self.assertEqual(([512, 1024, 2048], "testing foo"), rollout._parse_args(["512,", "1024,2048", "testing", "foo"])) # Test invalid argument parsing: - self.assertEquals((None, None), rollout._parse_args([])) - self.assertEquals((None, None), rollout._parse_args(["--bar", "1234"])) + self.assertEqual((None, None), rollout._parse_args([])) + self.assertEqual((None, None), rollout._parse_args(["--bar", "1234"])) # Invalid arguments result in the USAGE message. - self.assertEquals("tom: Usage: rollout SVN_REVISION [SVN_REVISIONS] REASON", + self.assertEqual("tom: Usage: rollout SVN_REVISION [SVN_REVISIONS] REASON", rollout.execute("tom", [], None, None)) # FIXME: We need a better way to test IRCCommands which call tool.irc().post() diff --git a/Tools/Scripts/webkitpy/tool/bot/layouttestresultsreader_unittest.py b/Tools/Scripts/webkitpy/tool/bot/layouttestresultsreader_unittest.py index 0eb348297..96e2e4eef 100644 --- a/Tools/Scripts/webkitpy/tool/bot/layouttestresultsreader_unittest.py +++ b/Tools/Scripts/webkitpy/tool/bot/layouttestresultsreader_unittest.py @@ -47,7 +47,7 @@ class LayoutTestResultsReaderTest(unittest.TestCase): self.assertRaises(IOError, tool.filesystem.read_text_file, layout_tests_results_path) self.assertRaises(IOError, tool.filesystem.read_text_file, unit_tests_results_path) # layout_test_results shouldn't raise even if the results.html file is missing. - self.assertEquals(reader.results(), None) + self.assertEqual(reader.results(), None) def test_create_unit_test_results(self): tool = MockTool() @@ -62,7 +62,7 @@ class LayoutTestResultsReaderTest(unittest.TestCase): </testsuite> </testsuites>""" tool.filesystem = MockFileSystem({unit_tests_results_path: no_failures_xml}) - self.assertEquals(reader._create_unit_test_results(), []) + self.assertEqual(reader._create_unit_test_results(), []) def test_missing_unit_test_results_path(self): tool = MockTool() @@ -71,19 +71,19 @@ class LayoutTestResultsReaderTest(unittest.TestCase): reader._create_layout_test_results = lambda: LayoutTestResults([]) # layout_test_results shouldn't raise even if the unit tests xml file is missing. self.assertNotEquals(reader.results(), None) - self.assertEquals(reader.results().failing_tests(), []) + self.assertEqual(reader.results().failing_tests(), []) def test_layout_test_results(self): reader = LayoutTestResultsReader(MockTool(), "/var/logs") reader._read_file_contents = lambda path: None - self.assertEquals(reader.results(), None) + self.assertEqual(reader.results(), None) reader._read_file_contents = lambda path: "" - self.assertEquals(reader.results(), None) + self.assertEqual(reader.results(), None) reader._create_layout_test_results = lambda: LayoutTestResults([]) results = reader.results() self.assertNotEquals(results, None) - self.assertEquals(results.failure_limit_count(), 30) # This value matches RunTests.NON_INTERACTIVE_FAILURE_LIMIT_COUNT + self.assertEqual(results.failure_limit_count(), 30) # This value matches RunTests.NON_INTERACTIVE_FAILURE_LIMIT_COUNT def test_archive_last_layout_test_results(self): tool = MockTool() diff --git a/Tools/Scripts/webkitpy/tool/bot/queueengine_unittest.py b/Tools/Scripts/webkitpy/tool/bot/queueengine_unittest.py index f959ee149..26789ef05 100644 --- a/Tools/Scripts/webkitpy/tool/bot/queueengine_unittest.py +++ b/Tools/Scripts/webkitpy/tool/bot/queueengine_unittest.py @@ -83,12 +83,12 @@ class LoggingDelegate(QueueEngineDelegate): def process_work_item(self, work_item): self.record("process_work_item") - self._test.assertEquals(work_item, "work_item") + self._test.assertEqual(work_item, "work_item") return True def handle_unexpected_error(self, work_item, message): self.record("handle_unexpected_error") - self._test.assertEquals(work_item, "work_item") + self._test.assertEqual(work_item, "work_item") def stop_work_queue(self, message): self.record("stop_work_queue") @@ -120,8 +120,8 @@ class QueueEngineTest(unittest.TestCase): def test_trivial(self): delegate = LoggingDelegate(self) self._run_engine(delegate) - self.assertEquals(delegate.stop_message, "Delegate terminated queue.") - self.assertEquals(delegate._callbacks, LoggingDelegate.expected_callbacks) + self.assertEqual(delegate.stop_message, "Delegate terminated queue.") + self.assertEqual(delegate._callbacks, LoggingDelegate.expected_callbacks) self.assertTrue(os.path.exists(os.path.join(self.temp_dir, "queue_log_path"))) self.assertTrue(os.path.exists(os.path.join(self.temp_dir, "work_log_path", "work_item.log"))) @@ -133,12 +133,12 @@ class QueueEngineTest(unittest.TestCase): # The unexpected error should be handled right after process_work_item starts # but before any other callback. Otherwise callbacks should be normal. expected_callbacks.insert(work_item_index + 1, 'handle_unexpected_error') - self.assertEquals(delegate._callbacks, expected_callbacks) + self.assertEqual(delegate._callbacks, expected_callbacks) def test_handled_error(self): delegate = RaisingDelegate(self, ScriptError(exit_code=QueueEngine.handled_error_code)) self._run_engine(delegate) - self.assertEquals(delegate._callbacks, LoggingDelegate.expected_callbacks) + self.assertEqual(delegate._callbacks, LoggingDelegate.expected_callbacks) def _run_engine(self, delegate, engine=None, termination_message=None): if not engine: @@ -158,8 +158,8 @@ class QueueEngineTest(unittest.TestCase): delegate = RaisingDelegate(self, exception) self._run_engine(delegate, termination_message=termination_message) - self.assertEquals(delegate._callbacks, expected_callbacks) - self.assertEquals(delegate.stop_message, termination_message) + self.assertEqual(delegate._callbacks, expected_callbacks) + self.assertEqual(delegate.stop_message, termination_message) def test_terminating_error(self): self._test_terminating_queue(KeyboardInterrupt(), "User terminated queue.") diff --git a/Tools/Scripts/webkitpy/tool/commands/__init__.py b/Tools/Scripts/webkitpy/tool/commands/__init__.py index 4e8eb62e1..45711815e 100644 --- a/Tools/Scripts/webkitpy/tool/commands/__init__.py +++ b/Tools/Scripts/webkitpy/tool/commands/__init__.py @@ -8,7 +8,6 @@ from webkitpy.tool.commands.bugsearch import BugSearch from webkitpy.tool.commands.chromechannels import ChromeChannels from webkitpy.tool.commands.download import * from webkitpy.tool.commands.earlywarningsystem import * -from webkitpy.tool.commands.expectations import OptimizeExpectations from webkitpy.tool.commands.findusers import FindUsers from webkitpy.tool.commands.gardenomatic import GardenOMatic from webkitpy.tool.commands.openbugs import OpenBugs diff --git a/Tools/Scripts/webkitpy/tool/commands/abstractlocalservercommand.py b/Tools/Scripts/webkitpy/tool/commands/abstractlocalservercommand.py index 6c54da25e..0a7788c11 100644 --- a/Tools/Scripts/webkitpy/tool/commands/abstractlocalservercommand.py +++ b/Tools/Scripts/webkitpy/tool/commands/abstractlocalservercommand.py @@ -53,5 +53,5 @@ class AbstractLocalServerCommand(AbstractDeclarativeCommand): # FIXME: This seems racy. threading.Timer(0.1, lambda: self._tool.user.open_url(server_url)).start() - httpd = self.server(httpd_port=options.httpd_port, config=config) + httpd = self.server(httpd_port=options.httpd_port, config=config) # pylint: disable-msg=E1102 httpd.serve_forever() diff --git a/Tools/Scripts/webkitpy/tool/commands/download.py b/Tools/Scripts/webkitpy/tool/commands/download.py index 1f73d1884..b3ee1239c 100644 --- a/Tools/Scripts/webkitpy/tool/commands/download.py +++ b/Tools/Scripts/webkitpy/tool/commands/download.py @@ -4,7 +4,7 @@ # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: -# +# # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above @@ -14,7 +14,7 @@ # * Neither the name of Google Inc. nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. -# +# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -146,8 +146,10 @@ class AbstractPatchProcessingCommand(AbstractDeclarativeCommand): # Subclasses must implement the methods below. We don't declare them here # because we want to be able to implement them with mix-ins. # + # pylint: disable-msg=E1101 # def _fetch_list_of_patches_to_process(self, options, args, tool): # def _prepare_to_process(self, options, args, tool): + # def _process_patch(self, options, args, tool): @staticmethod def _collect_patches_by_bug(patches): diff --git a/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem.py b/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem.py index b7d5df31e..3ebdf390a 100644 --- a/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem.py +++ b/Tools/Scripts/webkitpy/tool/commands/earlywarningsystem.py @@ -45,6 +45,9 @@ class AbstractEarlyWarningSystem(AbstractReviewQueue, EarlyWarningSystemTaskDele # FIXME: Switch _default_run_tests from opt-in to opt-out once more bots are ready to run tests. _default_run_tests = False + # Subclasses must override. + port_name = None + def __init__(self): options = [make_option("--run-tests", action="store_true", dest="run_tests", default=self._default_run_tests, help="Run the Layout tests for each patch")] AbstractReviewQueue.__init__(self, options=options) @@ -139,7 +142,6 @@ class GtkEWS(AbstractEarlyWarningSystem): name = "gtk-ews" port_name = "gtk" watchers = AbstractEarlyWarningSystem.watchers + [ - "gns@gnome.org", "xan.lopez@gmail.com", ] diff --git a/Tools/Scripts/webkitpy/tool/commands/expectations.py b/Tools/Scripts/webkitpy/tool/commands/expectations.py deleted file mode 100644 index 0e1050ba7..000000000 --- a/Tools/Scripts/webkitpy/tool/commands/expectations.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) 2011 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from webkitpy.layout_tests.models.test_configuration import TestConfigurationConverter -from webkitpy.layout_tests.models.test_expectations import TestExpectationParser -from webkitpy.layout_tests.models.test_expectations import TestExpectations -from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand - - -class OptimizeExpectations(AbstractDeclarativeCommand): - name = "optimize-expectations" - help_text = "Fixes simple style issues in test_expectations file. (Currently works only for chromium port.)" - - def execute(self, options, args, tool): - port = tool.port_factory.get("chromium-win-win7") # FIXME: This should be selectable. - parser = TestExpectationParser(port, [], allow_rebaseline_modifier=False) - expectation_lines = parser.parse(port.test_expectations()) - converter = TestConfigurationConverter(port.all_test_configurations(), port.configuration_specifier_macros()) - tool.filesystem.write_text_file(port.path_to_test_expectations_file(), TestExpectations.list_to_string(expectation_lines, converter)) diff --git a/Tools/Scripts/webkitpy/tool/commands/gardenomatic.py b/Tools/Scripts/webkitpy/tool/commands/gardenomatic.py index 6cb1519ef..c87c1a265 100644 --- a/Tools/Scripts/webkitpy/tool/commands/gardenomatic.py +++ b/Tools/Scripts/webkitpy/tool/commands/gardenomatic.py @@ -32,7 +32,7 @@ class GardenOMatic(AbstractRebaseliningCommand): help_text = "Command for gardening the WebKit tree." def __init__(self): - return super(AbstractRebaseliningCommand, self).__init__(options=(self.platform_options + [ + super(GardenOMatic, self).__init__(options=(self.platform_options + [ self.move_overwritten_baselines_option, self.results_directory_option, self.no_optimize_option, diff --git a/Tools/Scripts/webkitpy/tool/commands/openbugs_unittest.py b/Tools/Scripts/webkitpy/tool/commands/openbugs_unittest.py index 40a6e1b2e..06dac1fd6 100644 --- a/Tools/Scripts/webkitpy/tool/commands/openbugs_unittest.py +++ b/Tools/Scripts/webkitpy/tool/commands/openbugs_unittest.py @@ -43,7 +43,7 @@ class OpenBugsTest(CommandsTest): def test_find_bugs_in_string(self): openbugs = OpenBugs() for expectation in self.find_bugs_in_string_expectations: - self.assertEquals(openbugs._find_bugs_in_string(expectation[0]), expectation[1]) + self.assertEqual(openbugs._find_bugs_in_string(expectation[0]), expectation[1]) def test_args_parsing(self): expected_stderr = "2 bugs found in input.\nMOCK: user.open_url: http://example.com/12345\nMOCK: user.open_url: http://example.com/23456\n" diff --git a/Tools/Scripts/webkitpy/tool/commands/queries.py b/Tools/Scripts/webkitpy/tool/commands/queries.py index b7e4a8588..93e0df3d3 100644 --- a/Tools/Scripts/webkitpy/tool/commands/queries.py +++ b/Tools/Scripts/webkitpy/tool/commands/queries.py @@ -440,13 +440,15 @@ class PrintExpectations(AbstractDeclarativeCommand): help='Print a CSV-style report that includes the port name, modifiers, tests, and expectations'), make_option('-f', '--full', action='store_true', default=False, help='Print a full TestExpectations-style line for every match'), + make_option('--paths', action='store_true', default=False, + help='display the paths for all applicable expectation files'), ] + platform_options(use_globs=True) AbstractDeclarativeCommand.__init__(self, options=options) self._expectation_models = {} def execute(self, options, args, tool): - if not args and not options.all: + if not options.paths and not args and not options.all: print "You must either specify one or more test paths or --all." return @@ -465,6 +467,15 @@ class PrintExpectations(AbstractDeclarativeCommand): default_port = tool.port_factory.get(options=options) port_names = [default_port.name()] + if options.paths: + files = default_port.expectations_files() + layout_tests_dir = default_port.layout_tests_dir() + for file in files: + if file.startswith(layout_tests_dir): + file = file.replace(layout_tests_dir, 'LayoutTests') + print file + return + tests = default_port.tests(args) for port_name in port_names: model = self._model(options, port_name, tests) diff --git a/Tools/Scripts/webkitpy/tool/commands/queries_unittest.py b/Tools/Scripts/webkitpy/tool/commands/queries_unittest.py index 79bf1ca9d..ef1e0b387 100644 --- a/Tools/Scripts/webkitpy/tool/commands/queries_unittest.py +++ b/Tools/Scripts/webkitpy/tool/commands/queries_unittest.py @@ -150,18 +150,18 @@ class FailureReasonTest(unittest.TestCase): command = FailureReason() command.bind_to_tool(tool) # This is an artificial example, mostly to test the CommitInfo lookup failure case. - self.assertEquals(command._blame_line_for_revision(0), "FAILED to fetch CommitInfo for r0, likely missing ChangeLog") + self.assertEqual(command._blame_line_for_revision(0), "FAILED to fetch CommitInfo for r0, likely missing ChangeLog") def raising_mock(self): raise Exception("MESSAGE") tool.checkout().commit_info_for_revision = raising_mock - self.assertEquals(command._blame_line_for_revision(0), "FAILED to fetch CommitInfo for r0, exception: MESSAGE") + self.assertEqual(command._blame_line_for_revision(0), "FAILED to fetch CommitInfo for r0, exception: MESSAGE") class PrintExpectationsTest(unittest.TestCase): def run_test(self, tests, expected_stdout, platform='test-win-xp', **args): options = MockOptions(all=False, csv=False, full=False, platform=platform, - include_keyword=[], exclude_keyword=[]).update(**args) + include_keyword=[], exclude_keyword=[], paths=False).update(**args) tool = MockTool() tool.port_factory.all_port_names = lambda: TestPort.ALL_BASELINE_VARIANTS command = PrintExpectations() @@ -173,7 +173,7 @@ class PrintExpectationsTest(unittest.TestCase): command.execute(options, tests, tool) finally: stdout, _, _ = oc.restore_output() - self.assertEquals(stdout, expected_stdout) + self.assertEqual(stdout, expected_stdout) def test_basic(self): self.run_test(['failures/expected/text.html', 'failures/expected/image.html'], @@ -221,6 +221,12 @@ class PrintExpectationsTest(unittest.TestCase): 'test-win-xp,failures/expected/text.html,BUGTEST,FAIL\n'), csv=True) + def test_paths(self): + self.run_test([], + ('LayoutTests/platform/test/TestExpectations\n' + 'LayoutTests/platform/test-win-xp/TestExpectations\n'), + paths=True) + class PrintBaselinesTest(unittest.TestCase): def setUp(self): @@ -249,7 +255,7 @@ class PrintBaselinesTest(unittest.TestCase): self.capture_output() command.execute(MockOptions(all=False, include_virtual_tests=False, csv=False, platform=None), ['passes/text.html'], self.tool) stdout, _, _ = self.restore_output() - self.assertEquals(stdout, + self.assertEqual(stdout, ('// For test-win-xp\n' 'passes/text-expected.png\n' 'passes/text-expected.txt\n')) @@ -260,7 +266,7 @@ class PrintBaselinesTest(unittest.TestCase): self.capture_output() command.execute(MockOptions(all=False, include_virtual_tests=False, csv=False, platform='test-win-*'), ['passes/text.html'], self.tool) stdout, _, _ = self.restore_output() - self.assertEquals(stdout, + self.assertEqual(stdout, ('// For test-win-vista\n' 'passes/text-expected.png\n' 'passes/text-expected.txt\n' @@ -279,6 +285,6 @@ class PrintBaselinesTest(unittest.TestCase): self.capture_output() command.execute(MockOptions(all=False, platform='*xp', csv=True, include_virtual_tests=False), ['passes/text.html'], self.tool) stdout, _, _ = self.restore_output() - self.assertEquals(stdout, + self.assertEqual(stdout, ('test-win-xp,passes/text.html,None,png,passes/text-expected.png,None\n' 'test-win-xp,passes/text.html,None,txt,passes/text-expected.txt,None\n')) diff --git a/Tools/Scripts/webkitpy/tool/commands/queues.py b/Tools/Scripts/webkitpy/tool/commands/queues.py index 6993c2dea..62d429d88 100644 --- a/Tools/Scripts/webkitpy/tool/commands/queues.py +++ b/Tools/Scripts/webkitpy/tool/commands/queues.py @@ -4,7 +4,7 @@ # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: -# +# # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above @@ -14,7 +14,7 @@ # * Neither the name of Google Inc. nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. -# +# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -352,6 +352,7 @@ class CommitQueue(AbstractPatchQueue, StepSequenceErrorHandler, CommitQueueTaskD # StepSequenceErrorHandler methods + @classmethod def handle_script_error(cls, tool, state, script_error): # Hitting this error handler should be pretty rare. It does occur, # however, when a patch no longer applies to top-of-tree in the final diff --git a/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py b/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py index 6301fea0b..88ab3de06 100644 --- a/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py +++ b/Tools/Scripts/webkitpy/tool/commands/queues_unittest.py @@ -72,7 +72,7 @@ class TestFeederQueue(FeederQueue): class AbstractQueueTest(CommandsTest): def test_log_directory(self): - self.assertEquals(TestQueue()._log_directory(), os.path.join("..", "test-queue-logs")) + self.assertEqual(TestQueue()._log_directory(), os.path.join("..", "test-queue-logs")) def _assert_run_webkit_patch(self, run_args, port=None): queue = TestQueue() @@ -157,15 +157,15 @@ class AbstractPatchQueueTest(CommandsTest): queue.bind_to_tool(tool) queue._options = Mock() queue._options.port = None - self.assertEquals(queue._next_patch(), None) + self.assertEqual(queue._next_patch(), None) tool.status_server = MockStatusServer(work_items=[2, 10000, 10001]) expected_stdout = "MOCK: fetch_attachment: 2 is not a known attachment id\n" # A mock-only message to prevent us from making mistakes. expected_stderr = "MOCK: release_work_item: None 2\n" patch = OutputCapture().assert_outputs(self, queue._next_patch, expected_stdout=expected_stdout, expected_stderr=expected_stderr) # The patch.id() == 2 is ignored because it doesn't exist. - self.assertEquals(patch.id(), 10000) - self.assertEquals(queue._next_patch().id(), 10001) - self.assertEquals(queue._next_patch(), None) # When the queue is empty + self.assertEqual(patch.id(), 10000) + self.assertEqual(queue._next_patch().id(), 10001) + self.assertEqual(queue._next_patch(), None) # When the queue is empty def test_upload_results_archive_for_patch(self): queue = AbstractPatchQueue() @@ -377,9 +377,9 @@ MOCK: release_work_item: commit-queue 10005 state = {'patch': None} OutputCapture().assert_outputs(self, sequence.run_and_handle_errors, [tool, options, state], expected_exception=TryAgain, expected_stderr=expected_stderr) - self.assertEquals(options.update, True) - self.assertEquals(options.build, False) - self.assertEquals(options.test, False) + self.assertEqual(options.update, True) + self.assertEqual(options.build, False) + self.assertEqual(options.test, False) def test_manual_reject_during_processing(self): queue = SecondThoughtsCommitQueue(MockTool()) diff --git a/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py b/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py index d7dafb91c..cc25fae2b 100644 --- a/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py +++ b/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py @@ -88,7 +88,7 @@ class TestRebaselineTest(_BaseTestCase): self.assertEqual(command._baseline_directory("Apple Lion Release WK1 (Tests)"), "/mock-checkout/LayoutTests/platform/mac-lion") self.assertEqual(command._baseline_directory("Apple Lion Release WK2 (Tests)"), "/mock-checkout/LayoutTests/platform/mac-wk2") self.assertEqual(command._baseline_directory("GTK Linux 32-bit Release"), "/mock-checkout/LayoutTests/platform/gtk") - self.assertEqual(command._baseline_directory("EFL Linux 64-bit Debug"), "/mock-checkout/LayoutTests/platform/efl-wk1") + self.assertEqual(command._baseline_directory("EFL Linux 64-bit Release WK2"), "/mock-checkout/LayoutTests/platform/efl-wk2") self.assertEqual(command._baseline_directory("Qt Linux Release"), "/mock-checkout/LayoutTests/platform/qt") self.assertEqual(command._baseline_directory("WebKit Mac10.7"), "/mock-checkout/LayoutTests/platform/chromium-mac-lion") self.assertEqual(command._baseline_directory("WebKit Mac10.6"), "/mock-checkout/LayoutTests/platform/chromium-mac-snowleopard") @@ -105,7 +105,7 @@ Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ] self.options.suffixes = "png,wav,txt" self.command._rebaseline_test_and_update_expectations(self.options) - self.assertEquals(self.tool.web.urls_fetched, + self.assertEqual(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/userscripts/another-test-actual.png', self.WEB_PREFIX + '/userscripts/another-test-actual.wav', self.WEB_PREFIX + '/userscripts/another-test-actual.txt']) @@ -121,7 +121,7 @@ Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ] self.options.suffixes = 'png,wav,txt' self.command._rebaseline_test_and_update_expectations(self.options) - self.assertEquals(self.tool.web.urls_fetched, + self.assertEqual(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/userscripts/another-test-actual.png', self.WEB_PREFIX + '/userscripts/another-test-actual.wav', self.WEB_PREFIX + '/userscripts/another-test-actual.txt']) @@ -136,7 +136,7 @@ Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ] self.options.suffixes = 'png,wav,txt' self.command._rebaseline_test_and_update_expectations(self.options) - self.assertEquals(self.tool.web.urls_fetched, + self.assertEqual(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/userscripts/another-test-actual.png', self.WEB_PREFIX + '/userscripts/another-test-actual.wav', self.WEB_PREFIX + '/userscripts/another-test-actual.txt']) @@ -146,13 +146,13 @@ Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ] def test_rebaseline_test(self): self.command._rebaseline_test("WebKit Linux", "userscripts/another-test.html", None, "txt", self.WEB_PREFIX) - self.assertEquals(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/userscripts/another-test-actual.txt']) + self.assertEqual(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/userscripts/another-test-actual.txt']) def test_rebaseline_test_with_results_directory(self): self._write(self.lion_expectations_path, "Bug(x) [ Mac ] userscripts/another-test.html [ ImageOnlyFailure ]\nbug(z) [ Linux ] userscripts/another-test.html [ ImageOnlyFailure ]\n") self.options.results_directory = '/tmp' self.command._rebaseline_test_and_update_expectations(self.options) - self.assertEquals(self.tool.web.urls_fetched, ['file:///tmp/userscripts/another-test-actual.txt']) + self.assertEqual(self.tool.web.urls_fetched, ['file:///tmp/userscripts/another-test-actual.txt']) def test_rebaseline_test_and_print_scm_changes(self): self.command._print_scm_changes = True @@ -161,20 +161,20 @@ Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ] self.command._rebaseline_test("WebKit Linux", "userscripts/another-test.html", None, "txt", None) - self.assertEquals(self.command._scm_changes, {'add': ['/mock-checkout/LayoutTests/platform/chromium-linux/userscripts/another-test-expected.txt'], 'delete': []}) + self.assertEqual(self.command._scm_changes, {'add': ['/mock-checkout/LayoutTests/platform/chromium-linux/userscripts/another-test-expected.txt'], 'delete': []}) def test_rebaseline_and_copy_test(self): self._write("userscripts/another-test-expected.txt", "generic result") self.command._rebaseline_test("WebKit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt", None) - self.assertEquals(self._read('platform/chromium-mac-lion/userscripts/another-test-expected.txt'), self.MOCK_WEB_RESULT) - self.assertEquals(self._read('platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt'), 'generic result') + self.assertEqual(self._read('platform/chromium-mac-lion/userscripts/another-test-expected.txt'), self.MOCK_WEB_RESULT) + self.assertEqual(self._read('platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt'), 'generic result') def test_rebaseline_and_copy_test_no_existing_result(self): self.command._rebaseline_test("WebKit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt", None) - self.assertEquals(self._read('platform/chromium-mac-lion/userscripts/another-test-expected.txt'), self.MOCK_WEB_RESULT) + self.assertEqual(self._read('platform/chromium-mac-lion/userscripts/another-test-expected.txt'), self.MOCK_WEB_RESULT) self.assertFalse(self.tool.filesystem.exists(self._expand('platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt'))) def test_rebaseline_and_copy_test_with_lion_result(self): @@ -182,9 +182,9 @@ Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ] self.command._rebaseline_test("WebKit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt", self.WEB_PREFIX) - self.assertEquals(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/userscripts/another-test-actual.txt']) - self.assertEquals(self._read("platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt"), "original lion result") - self.assertEquals(self._read("platform/chromium-mac-lion/userscripts/another-test-expected.txt"), self.MOCK_WEB_RESULT) + self.assertEqual(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/userscripts/another-test-actual.txt']) + self.assertEqual(self._read("platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt"), "original lion result") + self.assertEqual(self._read("platform/chromium-mac-lion/userscripts/another-test-expected.txt"), self.MOCK_WEB_RESULT) def test_rebaseline_and_copy_no_overwrite_test(self): self._write("platform/chromium-mac-lion/userscripts/another-test-expected.txt", "original lion result") @@ -192,8 +192,8 @@ Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ] self.command._rebaseline_test("WebKit Mac10.7", "userscripts/another-test.html", ["chromium-mac-snowleopard"], "txt", None) - self.assertEquals(self._read("platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt"), "original snowleopard result") - self.assertEquals(self._read("platform/chromium-mac-lion/userscripts/another-test-expected.txt"), self.MOCK_WEB_RESULT) + self.assertEqual(self._read("platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt"), "original snowleopard result") + self.assertEqual(self._read("platform/chromium-mac-lion/userscripts/another-test-expected.txt"), self.MOCK_WEB_RESULT) def test_rebaseline_test_internal_with_move_overwritten_baselines_to(self): self.tool.executive = MockExecutive2() @@ -220,8 +220,8 @@ Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ] out, _, _ = oc.restore_output() builders._exact_matches = old_exact_matches - self.assertEquals(self._read(self.tool.filesystem.join(port.layout_tests_dir(), 'platform/test-mac-leopard/failures/expected/image-expected.txt')), 'original snowleopard result') - self.assertEquals(out, '{"add": []}\n') + self.assertEqual(self._read(self.tool.filesystem.join(port.layout_tests_dir(), 'platform/test-mac-leopard/failures/expected/image-expected.txt')), 'original snowleopard result') + self.assertEqual(out, '{"add": []}\n') class TestRebaselineJson(_BaseTestCase): @@ -246,7 +246,7 @@ class TestRebaselineJson(_BaseTestCase): self.command._rebaseline(options, {"user-scripts/another-test.html": {"MOCK builder": ["txt", "png"]}}) # Note that we have one run_in_parallel() call followed by a run_command() - self.assertEquals(self.tool.executive.calls, + self.assertEqual(self.tool.executive.calls, [[['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'user-scripts/another-test.html', '--verbose']], ['echo', '--verbose', 'optimize-baselines', '--suffixes', 'txt,png', 'user-scripts/another-test.html']]) @@ -255,7 +255,7 @@ class TestRebaselineJson(_BaseTestCase): self.command._rebaseline(options, {"user-scripts/another-test.html": {"MOCK builder (Debug)": ["txt", "png"]}}) # Note that we have one run_in_parallel() call followed by a run_command() - self.assertEquals(self.tool.executive.calls, + self.assertEqual(self.tool.executive.calls, [[['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--builder', 'MOCK builder (Debug)', '--test', 'user-scripts/another-test.html', '--verbose']], ['echo', '--verbose', 'optimize-baselines', '--suffixes', 'txt,png', 'user-scripts/another-test.html']]) @@ -264,7 +264,7 @@ class TestRebaselineJson(_BaseTestCase): self.command._rebaseline(options, {"user-scripts/another-test.html": {"MOCK builder": ["txt", "png"]}}) # Note that we have one run_in_parallel() call followed by a run_command() - self.assertEquals(self.tool.executive.calls, + self.assertEqual(self.tool.executive.calls, [[['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'user-scripts/another-test.html', '--move-overwritten-baselines-to', 'test-mac-leopard', '--verbose']], ['echo', '--verbose', 'optimize-baselines', '--suffixes', 'txt,png', 'user-scripts/another-test.html']]) @@ -273,7 +273,7 @@ class TestRebaselineJson(_BaseTestCase): self.command._rebaseline(options, {"user-scripts/another-test.html": {"MOCK builder (Debug)": ["txt", "png"]}}) # Note that we have only one run_in_parallel() call - self.assertEquals(self.tool.executive.calls, + self.assertEqual(self.tool.executive.calls, [[['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--builder', 'MOCK builder (Debug)', '--test', 'user-scripts/another-test.html', '--verbose']]]) def test_results_directory(self): @@ -281,7 +281,7 @@ class TestRebaselineJson(_BaseTestCase): self.command._rebaseline(options, {"user-scripts/another-test.html": {"MOCK builder": ["txt", "png"]}}) # Note that we have only one run_in_parallel() call - self.assertEquals(self.tool.executive.calls, + self.assertEqual(self.tool.executive.calls, [[['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'user-scripts/another-test.html', '--results-directory', '/tmp', '--verbose']]]) @@ -313,7 +313,7 @@ class TestRebaseline(_BaseTestCase): builders._exact_matches = old_exact_matches calls = filter(lambda x: x != ['qmake', '-v'] and x[0] != 'perl', self.tool.executive.calls) - self.assertEquals(calls, + self.assertEqual(calls, [[['echo', 'rebaseline-test-internal', '--suffixes', 'txt,png', '--builder', 'MOCK builder', '--test', 'mock/path/to/test.html', '--verbose']]]) @@ -347,8 +347,8 @@ class TestRebaselineExpectations(_BaseTestCase): self.command.execute(self.options, [], self.tool) finally: _, _, logs = oc.restore_output() - self.assertEquals(self.tool.filesystem.written_files, {}) - self.assertEquals(logs, 'Did not find any tests marked Rebaseline.\n') + self.assertEqual(self.tool.filesystem.written_files, {}) + self.assertEqual(logs, 'Did not find any tests marked Rebaseline.\n') def disabled_test_overrides_are_included_correctly(self): # This tests that the any tests marked as REBASELINE in the overrides are found, but @@ -362,8 +362,8 @@ class TestRebaselineExpectations(_BaseTestCase): 'Bug(y) userscripts/test.html [ Crash ]\n')} self._write('/userscripts/another-test.html', '') - self.assertEquals(self.command._tests_to_rebaseline(self.lion_port), {'userscripts/another-test.html': set(['png', 'txt', 'wav'])}) - self.assertEquals(self._read(self.lion_expectations_path), '') + self.assertEqual(self.command._tests_to_rebaseline(self.lion_port), {'userscripts/another-test.html': set(['png', 'txt', 'wav'])}) + self.assertEqual(self._read(self.lion_expectations_path), '') class _FakeOptimizer(BaselineOptimizer): @@ -387,14 +387,14 @@ class TestAnalyzeBaselines(_BaseTestCase): def test_default(self): self.command.execute(MockOptions(suffixes='txt', missing=False, platform=None), ['passes/text.html'], self.tool) - self.assertEquals(self.lines, + self.assertEqual(self.lines, ['passes/text-expected.txt:', ' (generic): 123456', ' test-mac-leopard: abcdef']) def test_missing_baselines(self): self.command.execute(MockOptions(suffixes='png,txt', missing=True, platform=None), ['passes/text.html'], self.tool) - self.assertEquals(self.lines, + self.assertEqual(self.lines, ['passes/text-expected.png: (no baselines found)', 'passes/text-expected.txt:', ' (generic): 123456', diff --git a/Tools/Scripts/webkitpy/tool/commands/roll_unittest.py b/Tools/Scripts/webkitpy/tool/commands/roll_unittest.py index 800bc5b96..237a1c94f 100644 --- a/Tools/Scripts/webkitpy/tool/commands/roll_unittest.py +++ b/Tools/Scripts/webkitpy/tool/commands/roll_unittest.py @@ -56,8 +56,8 @@ class PostRollCommandsTest(CommandsTest): options = MockOptions() tool = MockTool() lkgr_state = postroll._prepare_state(options, [None, "last-known good revision"], tool) - self.assertEquals(None, lkgr_state["chromium_revision"]) - self.assertEquals("Roll Chromium DEPS to last-known good revision", lkgr_state["bug_title"]) + self.assertEqual(None, lkgr_state["chromium_revision"]) + self.assertEqual("Roll Chromium DEPS to last-known good revision", lkgr_state["bug_title"]) revision_state = postroll._prepare_state(options, ["1234", "r1234"], tool) - self.assertEquals("1234", revision_state["chromium_revision"]) - self.assertEquals("Roll Chromium DEPS to r1234", revision_state["bug_title"]) + self.assertEqual("1234", revision_state["chromium_revision"]) + self.assertEqual("Roll Chromium DEPS to r1234", revision_state["bug_title"]) diff --git a/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py b/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py index e89c2a08a..41b81663e 100644 --- a/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py +++ b/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py @@ -38,21 +38,6 @@ from webkitpy.layout_tests.port import builders _log = logging.getLogger(__name__) -class BuildCoverageExtrapolator(object): - def __init__(self, test_configuration_converter): - self._test_configuration_converter = test_configuration_converter - - @memoized - def _covered_test_configurations_for_builder_name(self): - coverage = {} - for builder_name in builders.all_builder_names(): - coverage[builder_name] = self._test_configuration_converter.to_config_set(builders.coverage_specifiers_for_builder_name(builder_name)) - return coverage - - def extrapolate_test_configurations(self, builder_name): - return self._covered_test_configurations_for_builder_name()[builder_name] - - class GardeningHTTPServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer): def __init__(self, httpd_port, config): server_name = '' @@ -63,7 +48,7 @@ class GardeningHTTPServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer def url(self, args=None): # We can't use urllib.encode() here because that encodes spaces as plus signs and the buildbots don't decode those properly. arg_string = ('?' + '&'.join("%s=%s" % (key, urllib.quote(value)) for (key, value) in args.items())) if args else '' - return 'file://' + os.path.join(GardeningHTTPRequestHandler.STATIC_FILE_DIRECTORY, 'garden-o-matic.html' + arg_string) + return 'http://localhost:8127/garden-o-matic.html' + arg_string class GardeningHTTPRequestHandler(ReflectionHandler): @@ -83,18 +68,6 @@ class GardeningHTTPRequestHandler(ReflectionHandler): allow_cross_origin_requests = True debug_output = '' - def rollout(self): - revision = self.query['revision'][0] - reason = self.query['reason'][0] - self._run_webkit_patch([ - 'rollout', - '--force-clean', - '--non-interactive', - revision, - reason, - ]) - self._serve_text('success') - def ping(self): self._serve_text('pong') @@ -139,4 +112,4 @@ class GardeningHTTPRequestHandler(ReflectionHandler): self._serve_file(fullpath, headers_only=(self.command == 'HEAD')) return - self._send_response(403) + self.send_response(403) diff --git a/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py b/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py index 9961648de..438cc0583 100644 --- a/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py +++ b/Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py @@ -83,17 +83,6 @@ class TestGardeningHTTPRequestHandler(GardeningHTTPRequestHandler): print "== End JSON Response ==" -class BuildCoverageExtrapolatorTest(unittest.TestCase): - def test_extrapolate(self): - # FIXME: Make this test not rely on actual (not mock) port objects. - host = MockHost() - port = host.port_factory.get('chromium-win-win7', None) - converter = TestConfigurationConverter(port.all_test_configurations(), port.configuration_specifier_macros()) - extrapolator = BuildCoverageExtrapolator(converter) - self.assertEquals(extrapolator.extrapolate_test_configurations("WebKit XP"), set([TestConfiguration(version='xp', architecture='x86', build_type='release')])) - self.assertRaises(KeyError, extrapolator.extrapolate_test_configurations, "Potato") - - class GardeningServerTest(unittest.TestCase): def _post_to_path(self, path, body=None, expected_stderr=None, expected_stdout=None, server=None): handler = TestGardeningHTTPRequestHandler(server or MockServer()) diff --git a/Tools/Scripts/webkitpy/tool/servers/reflectionhandler.py b/Tools/Scripts/webkitpy/tool/servers/reflectionhandler.py index 930870961..2148b4eb2 100644 --- a/Tools/Scripts/webkitpy/tool/servers/reflectionhandler.py +++ b/Tools/Scripts/webkitpy/tool/servers/reflectionhandler.py @@ -44,8 +44,8 @@ import BaseHTTPServer class ReflectionHandler(BaseHTTPServer.BaseHTTPRequestHandler): + STATIC_FILE_EXTENSIONS = ['.js', '.css', '.html'] # Subclasses should override. - STATIC_FILE_NAMES = None STATIC_FILE_DIRECTORY = None # Setting this flag to True causes the server to send @@ -78,7 +78,8 @@ class ReflectionHandler(BaseHTTPServer.BaseHTTPRequestHandler): self.query = {} function_or_file_name = path[1:] or "index.html" - if function_or_file_name in self.STATIC_FILE_NAMES: + _, extension = os.path.splitext(self.path) + if extension in self.STATIC_FILE_EXTENSIONS: self._serve_static_file(function_or_file_name) return diff --git a/Tools/Scripts/webkitpy/tool/servers/reflectionhandler_unittest.py b/Tools/Scripts/webkitpy/tool/servers/reflectionhandler_unittest.py new file mode 100644 index 000000000..d269dfcf5 --- /dev/null +++ b/Tools/Scripts/webkitpy/tool/servers/reflectionhandler_unittest.py @@ -0,0 +1,70 @@ +# Copyright (C) 2012 Google Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import unittest + +from webkitpy.tool.servers.reflectionhandler import ReflectionHandler + + +class TestReflectionHandler(ReflectionHandler): + STATIC_FILE_DIRECTORY = "/" + + def __init__(self): + self.static_files_served = set() + self.errors_sent = set() + self.functions_run = set() + + def _serve_static_file(self, name): + self.static_files_served.add(name) + + def send_error(self, code, description): + self.errors_sent.add(code) + + def function_one(self): + self.functions_run.add("function_one") + + def some_html(self): + self.functions_run.add("some_html") + + +class ReflectionHandlerTest(unittest.TestCase): + def assert_handler_response(self, requests, expected_static_files, expected_errors, expected_functions): + handler = TestReflectionHandler() + for request in requests: + handler.path = request + handler._handle_request() + self.assertEqual(handler.static_files_served, expected_static_files) + self.assertEqual(handler.errors_sent, expected_errors) + self.assertEqual(handler.functions_run, expected_functions) + + def test_static_content_or_function_switch(self): + self.assert_handler_response(["/test.js"], set(["test.js"]), set(), set()) + self.assert_handler_response(["/test.js", "/test.css", "/test.html"], set(["test.js", "test.html", "test.css"]), set(), set()) + self.assert_handler_response(["/test.js", "/test.exe", "/testhtml"], set(["test.js"]), set([404]), set()) + self.assert_handler_response(["/test.html", "/function.one"], set(["test.html"]), set(), set(['function_one'])) + self.assert_handler_response(["/some.html"], set(["some.html"]), set(), set()) diff --git a/Tools/Scripts/webkitpy/tool/steps/addsvnmimetypeforpng_unittest.py b/Tools/Scripts/webkitpy/tool/steps/addsvnmimetypeforpng_unittest.py index 221c6bc94..9fab6f438 100644 --- a/Tools/Scripts/webkitpy/tool/steps/addsvnmimetypeforpng_unittest.py +++ b/Tools/Scripts/webkitpy/tool/steps/addsvnmimetypeforpng_unittest.py @@ -55,4 +55,4 @@ class AddSvnMimetypeForPngTest(unittest.TestCase): try: capture.assert_outputs(self, step.run, [state]) except SystemExit, e: - self.assertEquals(e.code, 1) + self.assertEqual(e.code, 1) diff --git a/Tools/Scripts/webkitpy/tool/steps/preparechangelog_unittest.py b/Tools/Scripts/webkitpy/tool/steps/preparechangelog_unittest.py index 847dc2f93..fc31d1fa9 100644 --- a/Tools/Scripts/webkitpy/tool/steps/preparechangelog_unittest.py +++ b/Tools/Scripts/webkitpy/tool/steps/preparechangelog_unittest.py @@ -54,4 +54,4 @@ class PrepareChangeLogTest(changelog_unittest.ChangeLogTest): expected_message = "Example title\n http://example.com/1234" expected_contents = changelog_contents.replace("Need a short description (OOPS!).\n Need the bug URL (OOPS!).", expected_message) os.remove(changelog_path) - self.assertEquals(actual_contents.splitlines(), expected_contents.splitlines()) + self.assertEqual(actual_contents.splitlines(), expected_contents.splitlines()) diff --git a/Tools/Scripts/webkitpy/tool/steps/preparechangelogforrevert_unittest.py b/Tools/Scripts/webkitpy/tool/steps/preparechangelogforrevert_unittest.py index 076e60252..b82cb4aa2 100644 --- a/Tools/Scripts/webkitpy/tool/steps/preparechangelogforrevert_unittest.py +++ b/Tools/Scripts/webkitpy/tool/steps/preparechangelogforrevert_unittest.py @@ -115,11 +115,11 @@ class UpdateChangeLogsForRevertTest(unittest.TestCase): changelog.update_with_unreviewed_message(PrepareChangeLogForRevert._message_for_revert(*args)) actual_entry = changelog.latest_entry() os.remove(changelog_path) - self.assertEquals(actual_entry.contents(), expected_entry) - self.assertEquals(actual_entry.reviewer_text(), None) + self.assertEqual(actual_entry.contents(), expected_entry) + self.assertEqual(actual_entry.reviewer_text(), None) # These checks could be removed to allow this to work on other entries: - self.assertEquals(actual_entry.author_name(), "Eric Seidel") - self.assertEquals(actual_entry.author_email(), "eric@webkit.org") + self.assertEqual(actual_entry.author_name(), "Eric Seidel") + self.assertEqual(actual_entry.author_email(), "eric@webkit.org") def test_message_for_revert(self): self._assert_message_for_revert_output([[12345], "Reason"], self._revert_entry_without_bug_url) |