Use Python 2.7 unittest syntax in our unittests
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2013 07:12:44 +0000 (07:12 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2013 07:12:44 +0000 (07:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=105607

Patch by Tim 'mithro' Ansell <mithro@mithis.com> on 2013-01-22
Reviewed by Eric Seidel.

* Scripts/webkitpy/**/*_unittest.py:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@140510 268f45cc-cd09-0410-ab3c-d52691b4dbfc

165 files changed:
Tools/ChangeLog
Tools/Scripts/webkitpy/common/checkout/baselineoptimizer_unittest.py
Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py
Tools/Scripts/webkitpy/common/checkout/checkout_unittest.py
Tools/Scripts/webkitpy/common/checkout/commitinfo_unittest.py
Tools/Scripts/webkitpy/common/checkout/scm/detection_unittest.py
Tools/Scripts/webkitpy/common/config/build_unittest.py
Tools/Scripts/webkitpy/common/config/committers_unittest.py
Tools/Scripts/webkitpy/common/config/committervalidator_unittest.py
Tools/Scripts/webkitpy/common/config/contributionareas_unittest.py
Tools/Scripts/webkitpy/common/config/ports_unittest.py
Tools/Scripts/webkitpy/common/config/urls_unittest.py
Tools/Scripts/webkitpy/common/editdistance_unittest.py
Tools/Scripts/webkitpy/common/find_files_unittest.py
Tools/Scripts/webkitpy/common/lru_cache_unittest.py
Tools/Scripts/webkitpy/common/memoized_unittest.py
Tools/Scripts/webkitpy/common/net/bugzilla/bug_unittest.py
Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla_unittest.py
Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py
Tools/Scripts/webkitpy/common/net/credentials_unittest.py
Tools/Scripts/webkitpy/common/net/failuremap_unittest.py
Tools/Scripts/webkitpy/common/net/htdigestparser_unittest.py
Tools/Scripts/webkitpy/common/net/irc/ircproxy_unittest.py
Tools/Scripts/webkitpy/common/net/layouttestresults_unittest.py
Tools/Scripts/webkitpy/common/net/networktransaction_unittest.py
Tools/Scripts/webkitpy/common/net/omahaproxy_unittest.py
Tools/Scripts/webkitpy/common/net/resultsjsonparser_unittest.py
Tools/Scripts/webkitpy/common/net/statusserver_unittest.py
Tools/Scripts/webkitpy/common/net/unittestresults_unittest.py
Tools/Scripts/webkitpy/common/newstringio_unittest.py
Tools/Scripts/webkitpy/common/prettypatch_unittest.py
Tools/Scripts/webkitpy/common/read_checksum_from_png_unittest.py
Tools/Scripts/webkitpy/common/system/crashlogs_unittest.py
Tools/Scripts/webkitpy/common/system/environment_unittest.py
Tools/Scripts/webkitpy/common/system/executive_unittest.py
Tools/Scripts/webkitpy/common/system/file_lock_integrationtest.py
Tools/Scripts/webkitpy/common/system/filesystem_mock_unittest.py
Tools/Scripts/webkitpy/common/system/filesystem_unittest.py
Tools/Scripts/webkitpy/common/system/logtesting.py
Tools/Scripts/webkitpy/common/system/logutils_unittest.py
Tools/Scripts/webkitpy/common/system/outputcapture_unittest.py
Tools/Scripts/webkitpy/common/system/outputtee_unittest.py
Tools/Scripts/webkitpy/common/system/path_unittest.py
Tools/Scripts/webkitpy/common/system/platforminfo_unittest.py
Tools/Scripts/webkitpy/common/system/profiler_unittest.py
Tools/Scripts/webkitpy/common/system/stack_utils_unittest.py
Tools/Scripts/webkitpy/common/system/user_unittest.py
Tools/Scripts/webkitpy/common/system/workspace_unittest.py
Tools/Scripts/webkitpy/common/system/zipfileset_unittest.py
Tools/Scripts/webkitpy/common/thread/messagepump_unittest.py
Tools/Scripts/webkitpy/common/thread/threadedmessagequeue_unittest.py
Tools/Scripts/webkitpy/common/watchlist/amountchangedpattern_unittest.py
Tools/Scripts/webkitpy/common/watchlist/changedlinepattern_unittest.py
Tools/Scripts/webkitpy/common/watchlist/filenamepattern_unittest.py
Tools/Scripts/webkitpy/common/watchlist/watchlist_unittest.py
Tools/Scripts/webkitpy/common/watchlist/watchlistrule_unittest.py
Tools/Scripts/webkitpy/common/webkitunittest.py
Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner_unittest.py
Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py
Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer_unittest.py
Tools/Scripts/webkitpy/layout_tests/layout_package/json_results_generator_unittest.py
Tools/Scripts/webkitpy/layout_tests/lint_test_expectations_unittest.py
Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py
Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
Tools/Scripts/webkitpy/layout_tests/models/test_failures_unittest.py
Tools/Scripts/webkitpy/layout_tests/models/test_results_unittest.py
Tools/Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/builders_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/chromium_linux_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/chromium_mac_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/chromium_port_testcase.py
Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/chromium_win_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/config_standalone.py
Tools/Scripts/webkitpy/layout_tests/port/config_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/driver_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/efl_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/factory_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/gtk_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/http_lock_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/image_diff_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/leakdetector_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/mac_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
Tools/Scripts/webkitpy/layout_tests/port/qt_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/server_process_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/win_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/xvfbdriver_unittest.py
Tools/Scripts/webkitpy/layout_tests/reftests/extract_reference_link_unittest.py
Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py
Tools/Scripts/webkitpy/layout_tests/servers/apache_http_server_unittest.py
Tools/Scripts/webkitpy/layout_tests/servers/http_server_integrationtest.py
Tools/Scripts/webkitpy/layout_tests/servers/http_server_unittest.py
Tools/Scripts/webkitpy/layout_tests/views/buildbot_results_unittest.py
Tools/Scripts/webkitpy/layout_tests/views/metered_stream_unittest.py
Tools/Scripts/webkitpy/layout_tests/views/printing_unittest.py
Tools/Scripts/webkitpy/performance_tests/perftest_unittest.py
Tools/Scripts/webkitpy/performance_tests/perftestsrunner_integrationtest.py
Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py
Tools/Scripts/webkitpy/style/checker_unittest.py
Tools/Scripts/webkitpy/style/checkers/changelog_unittest.py
Tools/Scripts/webkitpy/style/checkers/cmake_unittest.py
Tools/Scripts/webkitpy/style/checkers/common_unittest.py
Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
Tools/Scripts/webkitpy/style/checkers/jsonchecker_unittest.py
Tools/Scripts/webkitpy/style/checkers/png_unittest.py
Tools/Scripts/webkitpy/style/checkers/python_unittest.py
Tools/Scripts/webkitpy/style/checkers/test_expectations_unittest.py
Tools/Scripts/webkitpy/style/checkers/text_unittest.py
Tools/Scripts/webkitpy/style/checkers/watchlist_unittest.py
Tools/Scripts/webkitpy/style/checkers/xcodeproj_unittest.py
Tools/Scripts/webkitpy/style/checkers/xml_unittest.py
Tools/Scripts/webkitpy/style/error_handlers_unittest.py
Tools/Scripts/webkitpy/style/filereader_unittest.py
Tools/Scripts/webkitpy/style/filter_unittest.py
Tools/Scripts/webkitpy/style/main_unittest.py
Tools/Scripts/webkitpy/style/optparser_unittest.py
Tools/Scripts/webkitpy/style/patchreader_unittest.py
Tools/Scripts/webkitpy/test/finder_unittest.py
Tools/Scripts/webkitpy/test/main_unittest.py
Tools/Scripts/webkitpy/test/runner_unittest.py
Tools/Scripts/webkitpy/test/skip_unittest.py
Tools/Scripts/webkitpy/thirdparty/__init___unittest.py
Tools/Scripts/webkitpy/to_be_moved/update_webgl_conformance_tests_unittest.py
Tools/Scripts/webkitpy/tool/bot/botinfo_unittest.py
Tools/Scripts/webkitpy/tool/bot/commitqueuetask_unittest.py
Tools/Scripts/webkitpy/tool/bot/expectedfailures_unittest.py
Tools/Scripts/webkitpy/tool/bot/feeders_unittest.py
Tools/Scripts/webkitpy/tool/bot/flakytestreporter_unittest.py
Tools/Scripts/webkitpy/tool/bot/irc_command_unittest.py
Tools/Scripts/webkitpy/tool/bot/ircbot_unittest.py
Tools/Scripts/webkitpy/tool/bot/layouttestresultsreader_unittest.py
Tools/Scripts/webkitpy/tool/bot/queueengine_unittest.py
Tools/Scripts/webkitpy/tool/bot/sheriff_unittest.py
Tools/Scripts/webkitpy/tool/commands/download_unittest.py
Tools/Scripts/webkitpy/tool/commands/earlywarningsystem_unittest.py
Tools/Scripts/webkitpy/tool/commands/perfalizer_unittest.py
Tools/Scripts/webkitpy/tool/commands/queries_unittest.py
Tools/Scripts/webkitpy/tool/commands/queues_unittest.py
Tools/Scripts/webkitpy/tool/commands/queuestest.py
Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
Tools/Scripts/webkitpy/tool/commands/roll_unittest.py
Tools/Scripts/webkitpy/tool/grammar_unittest.py
Tools/Scripts/webkitpy/tool/mocktool_unittest.py
Tools/Scripts/webkitpy/tool/multicommandtool_unittest.py
Tools/Scripts/webkitpy/tool/servers/gardeningserver_unittest.py
Tools/Scripts/webkitpy/tool/servers/rebaselineserver_unittest.py
Tools/Scripts/webkitpy/tool/servers/reflectionhandler_unittest.py
Tools/Scripts/webkitpy/tool/steps/addsvnmimetypeforpng_unittest.py
Tools/Scripts/webkitpy/tool/steps/applywatchlist_unittest.py
Tools/Scripts/webkitpy/tool/steps/cleanworkingdirectory_unittest.py
Tools/Scripts/webkitpy/tool/steps/closebugforlanddiff_unittest.py
Tools/Scripts/webkitpy/tool/steps/commit_unittest.py
Tools/Scripts/webkitpy/tool/steps/discardlocalchanges_unittest.py
Tools/Scripts/webkitpy/tool/steps/preparechangelog_unittest.py
Tools/Scripts/webkitpy/tool/steps/preparechangelogforrevert_unittest.py
Tools/Scripts/webkitpy/tool/steps/runtests_unittest.py
Tools/Scripts/webkitpy/tool/steps/steps_unittest.py
Tools/Scripts/webkitpy/tool/steps/suggestreviewers_unittest.py
Tools/Scripts/webkitpy/tool/steps/update_unittest.py
Tools/Scripts/webkitpy/tool/steps/updatechangelogswithreview_unittest.py
Tools/Scripts/webkitpy/tool/steps/validatechangelogs_unittest.py

index 622d2a8..c7f9c5d 100644 (file)
@@ -1,5 +1,14 @@
 2013-01-22  Tim 'mithro' Ansell  <mithro@mithis.com>
 
+        Use Python 2.7 unittest syntax in our unittests
+        https://bugs.webkit.org/show_bug.cgi?id=105607
+
+        Reviewed by Eric Seidel.
+
+        * Scripts/webkitpy/**/*_unittest.py:
+
+2013-01-22  Tim 'mithro' Ansell  <mithro@mithis.com>
+
         Convert disable-msg to disable for new pylint.
         https://bugs.webkit.org/show_bug.cgi?id=107627
 
index 16d865b..308fc17 100644 (file)
@@ -27,7 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import sys
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer
 from webkitpy.common.system.filesystem_mock import MockFileSystem
index 185d5f7..ec414bc 100644 (file)
@@ -29,7 +29,7 @@
 import codecs
 import os
 import tempfile
-import unittest
+import unittest2 as unittest
 
 from StringIO import StringIO
 
@@ -257,7 +257,7 @@ class ChangeLogTest(unittest.TestCase):
         self.assertEqual(parsed_entries[4].bug_description(), None)
         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.assertIsNone(parsed_entries[7].reviewer_text())
         self.assertEqual(parsed_entries[8].reviewer_text(), 'Darin Adler')
 
     def test_parse_log_entries_from_annotated_file(self):
index a3b47c9..85e3dd4 100644 (file)
@@ -30,7 +30,7 @@ import codecs
 import os
 import shutil
 import tempfile
-import unittest
+import unittest2 as unittest
 
 from .checkout import Checkout
 from .changelog import ChangeLogEntry
@@ -141,7 +141,7 @@ Second part of this complicated change by me, Tor Arne Vestb\u00f8!
         commit_message = checkout.commit_message_for_this_commit(git_commit=None, return_stderr=True)
         # Throw away the first line - a warning about unknown VCS root.
         commit_message.message_lines = commit_message.message_lines[1:]
-        self.assertEqual(commit_message.message(), self.expected_commit_message)
+        self.assertMultiLineEqual(commit_message.message(), self.expected_commit_message)
 
 
 class CheckoutTest(unittest.TestCase):
@@ -160,7 +160,7 @@ class CheckoutTest(unittest.TestCase):
         checkout = self._make_checkout()
         checkout._scm.contents_at_revision = mock_contents_at_revision
         entry = checkout._latest_entry_for_changelog_at_revision("foo", "bar")
-        self.assertEqual(entry.contents(), _changelog1entry1)
+        self.assertMultiLineEqual(entry.contents(), _changelog1entry1)  # Pylint is confused about this line, pylint: disable=E1101
 
     # FIXME: This tests a hack around our current changed_files handling.
     # Right now changelog_entries_for_revision tries to fetch deleted files
@@ -191,10 +191,10 @@ class CheckoutTest(unittest.TestCase):
         self.assertEqual(commitinfo.bug_id(), 36629)
         self.assertEqual(commitinfo.author_name(), u"Tor Arne Vestb\u00f8")
         self.assertEqual(commitinfo.author_email(), "vestbo@webkit.org")
-        self.assertEqual(commitinfo.reviewer_text(), None)
-        self.assertEqual(commitinfo.reviewer(), None)
+        self.assertIsNone(commitinfo.reviewer_text())
+        self.assertIsNone(commitinfo.reviewer())
         self.assertEqual(commitinfo.committer_email(), "committer@example.com")
-        self.assertEqual(commitinfo.committer(), None)
+        self.assertIsNone(commitinfo.committer())
         self.assertEqual(commitinfo.to_json(), {
             'bug_id': 36629,
             'author_email': 'vestbo@webkit.org',
@@ -207,7 +207,7 @@ class CheckoutTest(unittest.TestCase):
         })
 
         checkout.changelog_entries_for_revision = lambda revision, changed_files=None: []
-        self.assertEqual(checkout.commit_info_for_revision(1), None)
+        self.assertIsNone(checkout.commit_info_for_revision(1))
 
     def test_bug_id_for_revision(self):
         checkout = self._make_checkout()
index f58e6f1..826673d 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.checkout.commitinfo import CommitInfo
 from webkitpy.common.config.committers import CommitterList, Committer, Reviewer
index 3a15466..593f093 100644 (file)
@@ -47,5 +47,5 @@ MOCK run_command: ['svn', 'info'], cwd=/
 MOCK run_command: ['git', 'rev-parse', '--is-inside-work-tree'], cwd=/
 """
         scm = OutputCapture().assert_outputs(self, detector.detect_scm_system, ["/"], expected_logs=expected_logs)
-        self.assertEqual(scm, None)
+        self.assertIsNone(scm)
         # FIXME: This should make a synthetic tree and test SVN and Git detection in that tree.
index 973995d..deb7b92 100644 (file)
@@ -20,7 +20,7 @@
 # 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
+import unittest2 as unittest
 
 from webkitpy.common.config import build
 
index 7f4f677..ce9335b 100644 (file)
@@ -25,7 +25,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.
 
-import unittest
+import unittest2 as unittest
 from webkitpy.common.config.committers import Account, CommitterList, Contributor, Committer, Reviewer
 
 class CommittersTest(unittest.TestCase):
@@ -51,7 +51,7 @@ class CommittersTest(unittest.TestCase):
         # Test valid committer, reviewer and contributor lookup
         self.assertEqual(committer_list.committer_by_name("Test One"), committer)
         self.assertEqual(committer_list.committer_by_name("Test Two"), reviewer)
-        self.assertEqual(committer_list.committer_by_name("Test Three"), None)
+        self.assertIsNone(committer_list.committer_by_name("Test Three"))
         self.assertEqual(committer_list.contributor_by_name("Test Three"), contributor)
         self.assertEqual(committer_list.contributor_by_name("test one"), committer)
         self.assertEqual(committer_list.contributor_by_name("test two"), reviewer)
@@ -62,21 +62,21 @@ class CommittersTest(unittest.TestCase):
 
         # Test lookup by login email address
         self.assertEqual(committer_list.account_by_login('zero@test.com'), account)
-        self.assertEqual(committer_list.account_by_login('zero@gmail.com'), None)
+        self.assertIsNone(committer_list.account_by_login('zero@gmail.com'))
         self.assertEqual(committer_list.account_by_login('one@test.com'), committer)
         self.assertEqual(committer_list.account_by_login('two@test.com'), reviewer)
-        self.assertEqual(committer_list.account_by_login('Two@rad.com'), None)
-        self.assertEqual(committer_list.account_by_login('so_two@gmail.com'), None)
+        self.assertIsNone(committer_list.account_by_login('Two@rad.com'))
+        self.assertIsNone(committer_list.account_by_login('so_two@gmail.com'))
 
         # Test that a known committer is not returned during reviewer lookup
-        self.assertEqual(committer_list.reviewer_by_email('one@test.com'), None)
-        self.assertEqual(committer_list.reviewer_by_email('three@test.com'), None)
+        self.assertIsNone(committer_list.reviewer_by_email('one@test.com'))
+        self.assertIsNone(committer_list.reviewer_by_email('three@test.com'))
         # and likewise that a known contributor is not returned for committer lookup.
-        self.assertEqual(committer_list.committer_by_email('three@test.com'), None)
+        self.assertIsNone(committer_list.committer_by_email('three@test.com'))
 
         # Test that unknown email address fail both committer and reviewer lookup
-        self.assertEqual(committer_list.committer_by_email('bar@bar.com'), None)
-        self.assertEqual(committer_list.reviewer_by_email('bar@bar.com'), None)
+        self.assertIsNone(committer_list.committer_by_email('bar@bar.com'))
+        self.assertIsNone(committer_list.reviewer_by_email('bar@bar.com'))
 
         # Test that emails returns a list.
         self.assertEqual(committer.emails, ['one@test.com'])
index 232f077..e8aa887 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.host_mock import MockHost
 from .committervalidator import CommitterValidator
@@ -41,4 +41,4 @@ class CommitterValidatorTest(unittest.TestCase):
 - If you do not have review rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.
 
 - If you have review rights please correct the error in Tools/Scripts/webkitpy/common/config/committers.py by adding yourself to the file (no review needed).  The commit-queue restarts itself every 2 hours.  After restart the commit-queue will correctly respect your review rights."""
-        self.assertEqual(validator._flag_permission_rejection_message("foo@foo.com", "review"), expected_messsage)
+        self.assertMultiLineEqual(validator._flag_permission_rejection_message("foo@foo.com", "review"), expected_messsage)
index c3960d9..17d4fe7 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from .contributionareas import _Intersection
 from .contributionareas import _Area
index d205142..a434211 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.config.ports import *
 
index b4bf897..c1a082c 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from .urls import parse_bug_id, parse_attachment_id
 
@@ -42,12 +42,12 @@ class URLsTest(unittest.TestCase):
         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.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"))
+        self.assertIsNone(parse_bug_id("http://www.webkit.org/b/12345"))
+        self.assertIsNone(parse_bug_id("http://bugs.webkit.org/show_bug.cgi?ctype=xml&id=12345"))
+        self.assertIsNone(parse_bug_id("http://bugs.webkit.org/show_bug.cgi?ctype=xml&id=12345&excludefield=attachmentdata"))
+        self.assertIsNone(parse_bug_id("http://bugs.webkit.org/show_bug.cgi?ctype=xml&excludefield=attachmentdata&id=12345"))
+        self.assertIsNone(parse_bug_id("http://bugs.webkit.org/show_bug.cgi?excludefield=attachmentdata&ctype=xml&id=12345"))
+        self.assertIsNone(parse_bug_id("http://bugs.webkit.org/show_bug.cgi?excludefield=attachmentdata&id=12345&ctype=xml"))
 
     def test_parse_attachment_id(self):
         self.assertEqual(12345, parse_attachment_id("https://bugs.webkit.org/attachment.cgi?id=12345&action=review"))
index 4ae6441..1f67572 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.editdistance import edit_distance
 
index f0fe01c..4c0a7cd 100644 (file)
@@ -27,7 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import sys
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.filesystem import FileSystem
 import find_files
index 9442764..96ca209 100644 (file)
@@ -24,7 +24,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common import lru_cache
 
index dd7c793..af406df 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.memoized import memoized
 
index f20c601..9c9fd9d 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from .bug import Bug
 
index 90e4c83..09efbee 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 import datetime
 import StringIO
 
@@ -85,9 +85,9 @@ class BugzillaTest(unittest.TestCase):
     def test_url_creation(self):
         # FIXME: These would be all better as doctests
         bugs = Bugzilla()
-        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))
+        self.assertIsNone(bugs.bug_url_for_bug_id(None))
+        self.assertIsNone(bugs.short_bug_url_for_bug_id(None))
+        self.assertIsNone(bugs.attachment_url_for_id(None))
 
     def test_parse_bug_id(self):
         # Test that we can parse the urls we produce.
@@ -198,7 +198,7 @@ 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.assertEqual(sorted(actual.keys()), sorted(expected.keys()))
+        self.assertItemsEqual(actual.keys(), expected.keys())
 
         for key, expected_value in expected.items():
             self.assertEqual(actual[key], expected_value, ("Failure for key: %s: Actual='%s' Expected='%s'" % (key, actual[key], expected_value)))
index 98ccfcd..26b7b97 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.net.layouttestresults import LayoutTestResults
 from webkitpy.common.net.buildbot import BuildBot, Builder, Build
@@ -71,14 +71,14 @@ class BuilderTest(unittest.TestCase):
         self.assertEqual(regression_window.failing_build().revision(), 1004)
 
         regression_window = self.builder.find_regression_window(self.builder.build(10), look_back_limit=2)
-        self.assertEqual(regression_window.build_before_failure(), None)
+        self.assertIsNone(regression_window.build_before_failure())
         self.assertEqual(regression_window.failing_build().revision(), 1008)
 
     def test_none_build(self):
         self.builder._fetch_build = lambda build_number: None
         regression_window = self.builder.find_regression_window(self.builder.build(10))
-        self.assertEqual(regression_window.build_before_failure(), None)
-        self.assertEqual(regression_window.failing_build(), None)
+        self.assertIsNone(regression_window.build_before_failure())
+        self.assertIsNone(regression_window.failing_build())
 
     def test_flaky_tests(self):
         self._install_fetch_build(lambda build_number: ["test1"] if build_number % 2 else ["test2"])
@@ -106,12 +106,12 @@ class BuilderTest(unittest.TestCase):
 
     def test_find_blameworthy_regression_window(self):
         self.assertEqual(self.builder.find_blameworthy_regression_window(10).revisions(), [1004])
-        self.assertEqual(self.builder.find_blameworthy_regression_window(10, look_back_limit=2), None)
+        self.assertIsNone(self.builder.find_blameworthy_regression_window(10, look_back_limit=2))
         # Flakey test avoidance requires at least 2 red builds:
-        self.assertEqual(self.builder.find_blameworthy_regression_window(4), None)
+        self.assertIsNone(self.builder.find_blameworthy_regression_window(4))
         self.assertEqual(self.builder.find_blameworthy_regression_window(4, avoid_flakey_tests=False).revisions(), [1004])
         # Green builder:
-        self.assertEqual(self.builder.find_blameworthy_regression_window(3), None)
+        self.assertIsNone(self.builder.find_blameworthy_regression_window(3))
 
     def test_build_caching(self):
         self.assertEqual(self.builder.build(10), self.builder.build(10))
@@ -148,7 +148,7 @@ class BuilderTest(unittest.TestCase):
             }
             return build_dictionary
         buildbot._fetch_build_dictionary = mock_fetch_build_dictionary
-        self.assertNotEqual(builder._fetch_build(1), None)
+        self.assertIsNotNone(builder._fetch_build(1))
 
 
 class BuildTest(unittest.TestCase):
@@ -158,7 +158,7 @@ class BuildTest(unittest.TestCase):
         builder._fetch_file_from_results = lambda results_url, file_name: None
         build = Build(builder, None, None, None)
         # Test that layout_test_results() returns None if the fetch fails.
-        self.assertEqual(build.layout_test_results(), None)
+        self.assertIsNone(build.layout_test_results())
 
 
 class BuildBotTest(unittest.TestCase):
@@ -263,16 +263,16 @@ class BuildBotTest(unittest.TestCase):
         self.assertEqual(build.url(), "http://build.webkit.org/builders/Test%20Builder/builds/10")
         self.assertEqual(build.results_url(), "http://build.webkit.org/results/Test%20Builder/r20%20%2810%29")
         self.assertEqual(build.revision(), 20)
-        self.assertEqual(build.is_green(), True)
+        self.assertTrue(build.is_green())
 
         build = build.previous_build()
         self.assertEqual(build.builder(), builder)
         self.assertEqual(build.url(), "http://build.webkit.org/builders/Test%20Builder/builds/9")
         self.assertEqual(build.results_url(), "http://build.webkit.org/results/Test%20Builder/r18%20%289%29")
         self.assertEqual(build.revision(), 18)
-        self.assertEqual(build.is_green(), False)
+        self.assertFalse(build.is_green())
 
-        self.assertEqual(builder.build(None), None)
+        self.assertIsNone(builder.build(None))
 
     _example_directory_listing = '''
 <h1>Directory listing for /results/SnowLeopard Intel Leaks/</h1>
index 4349748..beafa58 100644 (file)
@@ -28,7 +28,7 @@
 
 import os
 import tempfile
-import unittest
+import unittest2 as unittest
 from webkitpy.common.net.credentials import Credentials
 from webkitpy.common.system.executive import Executive
 from webkitpy.common.system.outputcapture import OutputCapture
@@ -92,7 +92,7 @@ password: "SECRETSAUCE"
             def _is_mac_os_x(self):
                 return False
         credentials = FakeCredentials("bugs.webkit.org")
-        self.assertEqual(credentials._is_mac_os_x(), False)
+        self.assertFalse(credentials._is_mac_os_x())
         self.assertEqual(credentials._credentials_from_keychain("foo"), ["foo", None])
 
     def test_security_output_parse(self):
@@ -109,7 +109,7 @@ password: "SECRETSAUCE"
         # by the test case CredentialsTest._assert_security_call (below).
         outputCapture = OutputCapture()
         outputCapture.capture_output()
-        self.assertEqual(credentials._run_security_tool(), None)
+        self.assertIsNone(credentials._run_security_tool())
         outputCapture.restore_output()
 
     def _assert_security_call(self, username=None):
index bd41032..0bede97 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.net.buildbot import Build
 from webkitpy.common.net.failuremap import *
index a2a4ac9..367c862 100644 (file)
@@ -22,7 +22,7 @@
 
 import StringIO
 import os
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.net.htdigestparser import HTDigestParser
 
index bce9d85..639979a 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.net.irc.ircproxy import IRCProxy
 from webkitpy.common.system.outputcapture import OutputCapture
index fc02372..ea4e927 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.net.layouttestresults import LayoutTestResults
 from webkitpy.common.system.outputcapture import OutputCapture
@@ -38,10 +38,10 @@ from webkitpy.thirdparty.BeautifulSoup import BeautifulSoup
 class LayoutTestResultsTest(unittest.TestCase):
     def test_set_failure_limit_count(self):
         results = LayoutTestResults([])
-        self.assertEqual(results.failure_limit_count(), None)
+        self.assertIsNone(results.failure_limit_count())
         results.set_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)
-        self.assertEqual(LayoutTestResults.results_from_string(""), None)
+        self.assertIsNone(LayoutTestResults.results_from_string(None))
+        self.assertIsNone(LayoutTestResults.results_from_string(""))
index 3302dec..67439f0 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.net.networktransaction import NetworkTransaction, NetworkTimeout
 from webkitpy.common.system.logtesting import LoggingTestCase
index 3aa58b6..80ba982 100644 (file)
@@ -29,7 +29,7 @@
 
 # Unit test for omahaproxy.py
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.net.omahaproxy import OmahaProxy
 
@@ -128,9 +128,9 @@ class OmahaProxyTest(unittest.TestCase):
         revisions = omahaproxy.get_revisions()
         self.assertEqual(len(revisions), 5)
         for revision in revisions:
-            self.assertTrue("commit" in revision)
-            self.assertTrue("channel" in revision)
-            self.assertTrue("platform" in revision)
-            self.assertTrue("date" in revision)
+            self.assertIn("commit", revision)
+            self.assertIn("channel", revision)
+            self.assertIn("platform", revision)
+            self.assertIn("date", revision)
             self.assertEqual(len(revision.keys()), 4)
         self.assertEqual(revisions, self.expected_revisions)
index 867379f..aaeb5dc 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.net.resultsjsonparser import ResultsJSONParser
 from webkitpy.layout_tests.models import test_results
index 1f0afd0..91a42c9 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.net.statusserver import StatusServer
 from webkitpy.common.system.outputcapture import OutputCaptureTestCaseBase
index 0708391..2271392 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from unittestresults import UnitTestResults
 
@@ -34,10 +34,10 @@ from unittestresults import UnitTestResults
 class UnitTestResultsTest(unittest.TestCase):
 
     def test_nostring(self):
-        self.assertEqual(None, UnitTestResults.results_from_string(None))
+        self.assertIsNone(UnitTestResults.results_from_string(None))
 
     def test_emptystring(self):
-        self.assertEqual(None, UnitTestResults.results_from_string(""))
+        self.assertIsNone(UnitTestResults.results_from_string(""))
 
     def test_nofailures(self):
         no_failures_xml = """<?xml version="1.0" encoding="UTF-8"?>
index 2a1dba8..6704722 100644 (file)
@@ -28,7 +28,7 @@
 
 """Unit tests for newstringio module."""
 
-import unittest
+import unittest2 as unittest
 
 import newstringio
 
index 37fa844..3ae1c43 100644 (file)
@@ -28,7 +28,7 @@
 
 import os.path
 import sys
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.executive import Executive
 from webkitpy.common.prettypatch import PrettyPatch
@@ -77,7 +77,7 @@ Index: latin1_test
         pretty_patch = PrettyPatch(Executive(), self._webkit_root())
         pretty = pretty_patch.pretty_diff(self._diff_with_multiple_encodings)
         self.assertTrue(pretty)  # We got some output
-        self.assertTrue(isinstance(pretty, str))  # It's a byte array, not unicode
+        self.assertIsInstance(pretty, str)  # It's a byte array, not unicode
 
     def test_pretty_print_empty_string(self):
         if not self.check_ruby():
index 9f920ff..751f7af 100644 (file)
@@ -22,7 +22,7 @@
 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import StringIO
-import unittest
+import unittest2 as unittest
 from webkitpy.common import read_checksum_from_png
 
 
@@ -36,4 +36,4 @@ class ReadChecksumFromPngTest(unittest.TestCase):
         # 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 L\1cx01\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.assertEqual(None, checksum)
+        self.assertIsNone(checksum)
index 1f5c40a..ada5d0e 100644 (file)
@@ -21,7 +21,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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.crashlogs import CrashLogs
 from webkitpy.common.system.filesystem_mock import MockFileSystem
@@ -69,13 +69,6 @@ Serial ATA Device: OPTIARC DVD RW AD-5670S
 """.format(process_name=process_name, pid=pid)
 
 class CrashLogsTest(unittest.TestCase):
-    def assertLinesEqual(self, a, b):
-        if hasattr(self, 'assertMultiLineEqual'):
-            self.assertMultiLineEqual(a, b)
-        else:
-            self.assertEqual(a.splitlines(), b.splitlines())
-
-
     def test_find_log_darwin(self):
         if not SystemHost().platform.is_mac():
             return
@@ -95,15 +88,15 @@ class CrashLogsTest(unittest.TestCase):
         filesystem = MockFileSystem(files)
         crash_logs = CrashLogs(MockSystemHost(filesystem=filesystem))
         log = crash_logs.find_newest_log("DumpRenderTree")
-        self.assertLinesEqual(log, newer_mock_crash_report)
+        self.assertMultiLineEqual(log, newer_mock_crash_report)
         log = crash_logs.find_newest_log("DumpRenderTree", 28529)
-        self.assertLinesEqual(log, newer_mock_crash_report)
+        self.assertMultiLineEqual(log, newer_mock_crash_report)
         log = crash_logs.find_newest_log("DumpRenderTree", 28530)
-        self.assertLinesEqual(log, mock_crash_report)
+        self.assertMultiLineEqual(log, mock_crash_report)
         log = crash_logs.find_newest_log("DumpRenderTree", 28531)
-        self.assertEqual(log, None)
+        self.assertIsNone(log)
         log = crash_logs.find_newest_log("DumpRenderTree", newer_than=1.0)
-        self.assertEqual(log, None)
+        self.assertIsNone(log)
 
         def bad_read(path):
             raise IOError('IOError: No such file or directory')
@@ -113,10 +106,10 @@ class CrashLogsTest(unittest.TestCase):
 
         filesystem.read_text_file = bad_read
         log = crash_logs.find_newest_log("DumpRenderTree", 28531, include_errors=True)
-        self.assertTrue('IOError: No such file or directory' in log)
+        self.assertIn('IOError: No such file or directory', log)
 
         filesystem = MockFileSystem(files)
         crash_logs = CrashLogs(MockSystemHost(filesystem=filesystem))
         filesystem.mtime = bad_mtime
         log = crash_logs.find_newest_log("DumpRenderTree", newer_than=1.0, include_errors=True)
-        self.assertTrue('OSError: No such file or directory' in log)
+        self.assertIn('OSError: No such file or directory', log)
index 6558b51..2868a65 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from .environment import Environment
 
index ca28197..c5b651d 100644 (file)
@@ -33,13 +33,17 @@ import signal
 import subprocess
 import sys
 import time
-import unittest
 
 # Since we execute this script directly as part of the unit tests, we need to ensure
 # that Tools/Scripts is in sys.path for the next imports to work correctly.
 script_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
 if script_dir not in sys.path:
     sys.path.append(script_dir)
+third_party_py = os.path.join(script_dir, "webkitpy", "thirdparty", "autoinstalled")
+if third_party_py not in sys.path:
+    sys.path.append(third_party_py)
+
+import unittest2 as unittest
 
 from webkitpy.common.system.executive import Executive, ScriptError
 from webkitpy.common.system.filesystem_mock import MockFileSystem
@@ -172,11 +176,11 @@ class ExecutiveTest(unittest.TestCase):
         if sys.platform == "win32":
             # FIXME: https://bugs.webkit.org/show_bug.cgi?id=54790
             # We seem to get either 0 or 1 here for some reason.
-            self.assertTrue(process.wait() in (0, 1))
+            self.assertIn(process.wait(), (0, 1))
         elif sys.platform == "cygwin":
             # FIXME: https://bugs.webkit.org/show_bug.cgi?id=98196
             # cygwin seems to give us either SIGABRT or SIGKILL
-            self.assertTrue(process.wait() in (-signal.SIGABRT, -signal.SIGKILL))
+            self.assertIn(process.wait(), (-signal.SIGABRT, -signal.SIGKILL))
         else:
             expected_exit_code = -signal.SIGKILL
             self.assertEqual(process.wait(), expected_exit_code)
@@ -187,7 +191,7 @@ class ExecutiveTest(unittest.TestCase):
     def serial_test_kill_all(self):
         executive = Executive()
         process = subprocess.Popen(never_ending_command(), stdout=subprocess.PIPE)
-        self.assertEqual(process.poll(), None)  # Process is running
+        self.assertIsNone(process.poll())  # Process is running
         executive.kill_all(never_ending_command()[0])
         # Note: Can't use a ternary since signal.SIGTERM is undefined for sys.platform == "win32"
         if sys.platform == "cygwin":
@@ -196,7 +200,7 @@ class ExecutiveTest(unittest.TestCase):
         elif sys.platform == "win32":
             # FIXME: https://bugs.webkit.org/show_bug.cgi?id=54790
             # We seem to get either 0 or 1 here for some reason.
-            self.assertTrue(process.wait() in (0, 1))
+            self.assertIn(process.wait(), (0, 1))
         else:
             expected_exit_code = -signal.SIGTERM
             self.assertEqual(process.wait(), expected_exit_code)
@@ -229,7 +233,7 @@ class ExecutiveTest(unittest.TestCase):
 
         executive = Executive()
         pids = executive.running_pids()
-        self.assertTrue(os.getpid() in pids)
+        self.assertIn(os.getpid(), pids)
 
     def serial_test_run_in_parallel(self):
         # We run this test serially to avoid overloading the machine and throwing off the timing.
index b661a01..7b1b426 100644 (file)
@@ -25,7 +25,7 @@
 
 import os
 import tempfile
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.file_lock import FileLock
 
index a90c60d..a598332 100644 (file)
@@ -28,7 +28,7 @@
 
 import os
 import re
-import unittest
+import unittest2 as unittest
 
 
 from webkitpy.common.system import filesystem_mock
index 0718317..26389e7 100644 (file)
@@ -35,7 +35,7 @@ import os
 import stat
 import sys
 import tempfile
-import unittest
+import unittest2 as unittest
 
 from filesystem import FileSystem
 
index 0cfa6cb..1aba172 100644 (file)
@@ -32,7 +32,7 @@ see the TestLogStream class, and perhaps also the LogTesting class.
 """
 
 import logging
-import unittest
+import unittest2 as unittest
 
 
 class TestLogStream(object):
index 6d7cc4d..252ebf4 100644 (file)
@@ -24,7 +24,7 @@
 
 import logging
 import os
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.logtesting import LogTesting
 from webkitpy.common.system.logtesting import TestLogStream
index da4347c..7ef2e24 100644 (file)
@@ -21,7 +21,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import logging
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.outputcapture import OutputCapture
 
@@ -43,7 +43,7 @@ class OutputCaptureTest(unittest.TestCase):
         actual_stdout, actual_stderr, actual_logs = self.output.restore_output()
         self.assertEqual('', actual_stdout)
         self.assertEqual('', actual_stderr)
-        self.assertEqual(expected_logs, actual_logs)
+        self.assertMultiLineEqual(expected_logs, actual_logs)
 
     def test_initial_log_level(self):
         self.output.capture_output()
index 6a509f0..8d06916 100644 (file)
@@ -27,7 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import StringIO
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.outputtee import Tee, OutputTee
 
index 7a71958..118546e 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 import sys
 
 from webkitpy.common.system.systemhost import SystemHost
index 6b671e2..bdb0f86 100644 (file)
@@ -28,7 +28,7 @@
 
 import platform
 import sys
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.executive import Executive
 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2
@@ -79,12 +79,12 @@ class TestPlatformInfo(unittest.TestCase):
         self.assertNotEquals(info.os_version, '')
         self.assertNotEquals(info.display_name(), '')
         self.assertTrue(info.is_mac() or info.is_win() or info.is_linux() or info.is_freebsd())
-        self.assertNotEquals(info.terminal_width(), None)
+        self.assertIsNotNone(info.terminal_width())
 
         if info.is_mac():
             self.assertTrue(info.total_bytes_memory() > 0)
         else:
-            self.assertEqual(info.total_bytes_memory(), None)
+            self.assertIsNone(info.total_bytes_memory())
 
     def test_os_name_and_wrappers(self):
         info = self.make_info(fake_sys('linux2'))
@@ -172,10 +172,10 @@ class TestPlatformInfo(unittest.TestCase):
         self.assertEqual(info.total_bytes_memory(), 1234)
 
         info = self.make_info(fake_sys('win32', tuple([6, 1, 7600])))
-        self.assertEqual(info.total_bytes_memory(), None)
+        self.assertIsNone(info.total_bytes_memory())
 
         info = self.make_info(fake_sys('linux2'))
-        self.assertEqual(info.total_bytes_memory(), None)
+        self.assertIsNone(info.total_bytes_memory())
 
         info = self.make_info(fake_sys('freebsd9'))
-        self.assertEqual(info.total_bytes_memory(), None)
+        self.assertIsNone(info.total_bytes_memory())
index 2489d1d..22bc2df 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.platforminfo_mock import MockPlatformInfo
 from webkitpy.common.system.systemhost_mock import MockSystemHost
index 625acf2..3050adc 100644 (file)
@@ -27,7 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import sys
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system import outputcapture
 from webkitpy.common.system import stack_utils
@@ -42,11 +42,11 @@ class StackUtilsTest(unittest.TestCase):
     def test_find_thread_stack_found(self):
         thread_id = current_thread_id()
         found_stack = stack_utils._find_thread_stack(thread_id)
-        self.assertNotEqual(found_stack, None)
+        self.assertIsNotNone(found_stack)
 
     def test_find_thread_stack_not_found(self):
         found_stack = stack_utils._find_thread_stack(0)
-        self.assertEqual(found_stack, None)
+        self.assertIsNone(found_stack)
 
     def test_log_thread_state(self):
         msgs = []
index bd86d22..49810b2 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.common.system.user import User
index eca386a..9f400c7 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.filesystem_mock import MockFileSystem
 from webkitpy.common.system.outputcapture import OutputCapture
@@ -69,4 +69,4 @@ MOCK output of child process
             def __init__(self, path):
                 self.filename = path
         archive = OutputCapture().assert_outputs(self, workspace.create_zip, ["/zip/path", "/source/path", MockZipFile], expected_logs=expected_logs)
-        self.assertEqual(archive, None)
+        self.assertIsNone(archive)
index 918e23a..1a0603c 100644 (file)
@@ -23,7 +23,7 @@
 
 import shutil
 import tempfile
-import unittest
+import unittest2 as unittest
 import zipfile
 
 from webkitpy.common.system.filesystem_mock import MockFileSystem
index f731db2..1a46772 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.thread.messagepump import MessagePump, MessagePumpDelegate
 from webkitpy.common.thread.threadedmessagequeue import ThreadedMessageQueue
index cb67c1e..dbb8a2e 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.thread.threadedmessagequeue import ThreadedMessageQueue
 
index 7ae45fa..b222d3a 100644 (file)
@@ -31,7 +31,7 @@
 
 
 import re
-import unittest
+import unittest2 as unittest
 
 
 from webkitpy.common.watchlist.amountchangedpattern import AmountChangedPattern
index 1f2aeda..2f5fd68 100644 (file)
@@ -29,7 +29,7 @@
 '''Unit tests for changedlinepattern.py.'''
 
 import re
-import unittest
+import unittest2 as unittest
 
 
 from webkitpy.common.watchlist.changedlinepattern import ChangedLinePattern
index 0afdf30..2b51dd6 100644 (file)
@@ -27,7 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import re
-import unittest
+import unittest2 as unittest
 
 
 from webkitpy.common.watchlist.filenamepattern import FilenamePattern
index 67ff3b0..dd7b083 100644 (file)
@@ -28,7 +28,7 @@
 
 '''Unit tests for watchlist.py.'''
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.checkout.diff_test_data import DIFF_TEST_DATA
 from webkitpy.common.watchlist.watchlistparser import WatchListParser
index 92aaf34..d926887 100644 (file)
@@ -27,7 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
-import unittest
+import unittest2 as unittest
 from webkitpy.common.watchlist.watchlistrule import WatchListRule
 
 
index 7b650a1..dd61523 100644 (file)
@@ -29,7 +29,7 @@
 '''Basic unit test functionality.'''
 
 import re
-import unittest
+import unittest2 as unittest
 
 
 class TestCase(unittest.TestCase):
index c86e9a2..362747d 100644 (file)
@@ -27,7 +27,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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.host_mock import MockHost
 from webkitpy.common.system.systemhost_mock import MockSystemHost
index aad2b30..4a81548 100644 (file)
@@ -31,7 +31,7 @@
 
 import sys
 import time
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.host_mock import MockHost
 from webkitpy.layout_tests.controllers.manager import Manager
index 3a2ef3d..4116598 100644 (file)
@@ -23,7 +23,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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.host_mock import MockHost
 from webkitpy.layout_tests.controllers import test_result_writer
index c5c2b24..ffd7f20 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 import json
 import optparse
 import random
@@ -123,12 +123,12 @@ class JSONGeneratorTest(unittest.TestCase):
         # Aliasing to a short name for better access to its constants.
         JRG = json_results_generator.JSONResultsGeneratorBase
 
-        self.assertTrue(JRG.VERSION_KEY in json)
-        self.assertTrue(self.builder_name in json)
+        self.assertIn(JRG.VERSION_KEY, json)
+        self.assertIn(self.builder_name, json)
 
         buildinfo = json[self.builder_name]
-        self.assertTrue(JRG.FIXABLE in buildinfo)
-        self.assertTrue(JRG.TESTS in buildinfo)
+        self.assertIn(JRG.FIXABLE, buildinfo)
+        self.assertIn(JRG.TESTS, buildinfo)
         self.assertEqual(len(buildinfo[JRG.BUILD_NUMBERS]), num_runs)
         self.assertEqual(buildinfo[JRG.BUILD_NUMBERS][0], self.build_number)
 
@@ -181,7 +181,7 @@ class JSONGeneratorTest(unittest.TestCase):
         nodes = path.split("/")
         sub_trie = trie
         for node in nodes:
-            self.assertTrue(node in sub_trie)
+            self.assertIn(node, sub_trie)
             sub_trie = sub_trie[node]
         return sub_trie
 
index 32ea8b9..89ade19 100644 (file)
@@ -28,7 +28,7 @@
 
 import optparse
 import StringIO
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.host_mock import MockHost
 from webkitpy.layout_tests import lint_test_expectations
@@ -100,7 +100,7 @@ class LintTest(unittest.TestCase):
         res = lint_test_expectations.lint(host, options, logging_stream)
 
         self.assertEqual(res, 0)
-        self.assertTrue('Lint succeeded' in logging_stream.getvalue())
+        self.assertIn('Lint succeeded', logging_stream.getvalue())
 
     def test_lint_test_files__errors(self):
         options = optparse.Values({'platform': 'test', 'debug_rwt_logging': False})
@@ -118,9 +118,9 @@ class LintTest(unittest.TestCase):
         res = lint_test_expectations.lint(host, options, logging_stream)
 
         self.assertEqual(res, -1)
-        self.assertTrue('Lint failed' in logging_stream.getvalue())
-        self.assertTrue('foo:1' in logging_stream.getvalue())
-        self.assertTrue('bar:1' in logging_stream.getvalue())
+        self.assertIn('Lint failed', logging_stream.getvalue())
+        self.assertIn('foo:1', logging_stream.getvalue())
+        self.assertIn('bar:1', logging_stream.getvalue())
 
 
 class MainTest(unittest.TestCase):
index ec99cf6..1a7d375 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.layout_tests.models.test_configuration import *
 
@@ -71,15 +71,15 @@ class TestConfigurationTest(unittest.TestCase):
     def test_hash(self):
         config_dict = {}
         config_dict[TestConfiguration('xp', 'x86', 'release')] = True
-        self.assertTrue(TestConfiguration('xp', 'x86', 'release') in config_dict)
+        self.assertIn(TestConfiguration('xp', 'x86', 'release'), config_dict)
         self.assertTrue(config_dict[TestConfiguration('xp', 'x86', 'release')])
 
         def query_unknown_key():
             return config_dict[TestConfiguration('xp', 'x86', 'debug')]
 
         self.assertRaises(KeyError, query_unknown_key)
-        self.assertTrue(TestConfiguration('xp', 'x86', 'release') in config_dict)
-        self.assertFalse(TestConfiguration('xp', 'x86', 'debug') in config_dict)
+        self.assertIn(TestConfiguration('xp', 'x86', 'release'), config_dict)
+        self.assertNotIn(TestConfiguration('xp', 'x86', 'debug'), config_dict)
         configs_list = [TestConfiguration('xp', 'x86', 'release'), TestConfiguration('xp', 'x86', 'debug'), TestConfiguration('xp', 'x86', 'debug')]
         self.assertEqual(len(configs_list), 3)
         self.assertEqual(len(set(configs_list)), 2)
@@ -103,7 +103,7 @@ class SpecifierSorterTest(unittest.TestCase):
 
     def test_init(self):
         sorter = SpecifierSorter()
-        self.assertEqual(sorter.category_for_specifier('control'), None)
+        self.assertIsNone(sorter.category_for_specifier('control'))
         sorter = SpecifierSorter(self._all_test_configurations)
         self.assertEqual(sorter.category_for_specifier('xp'), 'version')
         sorter = SpecifierSorter(self._all_test_configurations, MOCK_MACROS)
@@ -111,7 +111,7 @@ class SpecifierSorterTest(unittest.TestCase):
 
     def test_add_specifier(self):
         sorter = SpecifierSorter()
-        self.assertEqual(sorter.category_for_specifier('control'), None)
+        self.assertIsNone(sorter.category_for_specifier('control'))
         sorter.add_specifier('version', 'control')
         self.assertEqual(sorter.category_for_specifier('control'), 'version')
         sorter.add_specifier('version', 'one')
index eae2543..966a4a6 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.host_mock import MockHost
 from webkitpy.common.system.outputcapture import OutputCapture
index 74ef8cb..ea9a2e8 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.layout_tests.models.test_failures import *
 
@@ -36,7 +36,7 @@ class TestFailuresTest(unittest.TestCase):
         failure_obj = cls()
         s = failure_obj.dumps()
         new_failure_obj = TestFailure.loads(s)
-        self.assertTrue(isinstance(new_failure_obj, cls))
+        self.assertIsInstance(new_failure_obj, cls)
 
         self.assertEqual(failure_obj, new_failure_obj)
 
index 80d8a47..e1bb2f2 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.layout_tests.models.test_results import TestResult
 
@@ -44,7 +44,7 @@ class TestResultsTest(unittest.TestCase):
                             test_run_time=1.1)
         s = result.dumps()
         new_result = TestResult.loads(s)
-        self.assertTrue(isinstance(new_result, TestResult))
+        self.assertIsInstance(new_result, TestResult)
 
         self.assertEqual(new_result, result)
 
index d337c57..da35452 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.host_mock import MockHost
 from webkitpy.layout_tests.models import test_expectations
@@ -97,22 +97,22 @@ class InterpretTestFailuresTest(unittest.TestCase):
         self.assertEqual(test_dict['image_diff_percent'], 0.42)
 
         test_dict = test_run_results._interpret_test_failures([test_failures.FailureReftestMismatch(self.port.abspath_for_test('foo/reftest-expected.html'))])
-        self.assertTrue('image_diff_percent' in test_dict)
+        self.assertIn('image_diff_percent', test_dict)
 
         test_dict = test_run_results._interpret_test_failures([test_failures.FailureReftestMismatchDidNotOccur(self.port.abspath_for_test('foo/reftest-expected-mismatch.html'))])
         self.assertEqual(len(test_dict), 0)
 
         test_dict = test_run_results._interpret_test_failures([test_failures.FailureMissingAudio()])
-        self.assertTrue('is_missing_audio' in test_dict)
+        self.assertIn('is_missing_audio', test_dict)
 
         test_dict = test_run_results._interpret_test_failures([test_failures.FailureMissingResult()])
-        self.assertTrue('is_missing_text' in test_dict)
+        self.assertIn('is_missing_text', test_dict)
 
         test_dict = test_run_results._interpret_test_failures([test_failures.FailureMissingImage()])
-        self.assertTrue('is_missing_image' in test_dict)
+        self.assertIn('is_missing_image', test_dict)
 
         test_dict = test_run_results._interpret_test_failures([test_failures.FailureMissingImageHash()])
-        self.assertTrue('is_missing_image' in test_dict)
+        self.assertIn('is_missing_image', test_dict)
 
 
 class SummarizedResultsTest(unittest.TestCase):
@@ -122,7 +122,7 @@ class SummarizedResultsTest(unittest.TestCase):
 
     def test_no_svn_revision(self):
         summary = summarized_results(self.port, expected=False, passing=False, flaky=False)
-        self.assertTrue('revision' not in summary)
+        self.assertNotIn('revision', summary)
 
     def test_svn_revision(self):
         self.port._options.builder_name = 'dummy builder'
index 0ec6be9..7685695 100644 (file)
@@ -30,7 +30,7 @@ import logging
 import optparse
 import sys
 import tempfile
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.executive import Executive, ScriptError
 from webkitpy.common.system import executive_mock
@@ -57,7 +57,7 @@ class PortTest(unittest.TestCase):
 
     def test_default_child_processes(self):
         port = self.make_port()
-        self.assertNotEquals(port.default_child_processes(), None)
+        self.assertIsNotNone(port.default_child_processes())
 
     def test_format_wdiff_output_as_html(self):
         output = "OUTPUT %s %s %s" % (Port._WDIFF_DEL, Port._WDIFF_ADD, Port._WDIFF_END)
@@ -180,11 +180,11 @@ class PortTest(unittest.TestCase):
 
         # And make sure we actually get diff output.
         diff = port.diff_text('foo', 'bar', 'exp.txt', 'act.txt')
-        self.assertTrue('foo' in diff)
-        self.assertTrue('bar' in diff)
-        self.assertTrue('exp.txt' in diff)
-        self.assertTrue('act.txt' in diff)
-        self.assertFalse('nosuchthing' in diff)
+        self.assertIn('foo', diff)
+        self.assertIn('bar', diff)
+        self.assertIn('exp.txt', diff)
+        self.assertIn('act.txt', diff)
+        self.assertNotIn('nosuchthing', diff)
 
     def test_setup_test_run(self):
         port = self.make_port()
@@ -196,8 +196,8 @@ class PortTest(unittest.TestCase):
         port.host.filesystem.write_text_file(port.layout_tests_dir() + '/canvas/test', '')
         port.host.filesystem.write_text_file(port.layout_tests_dir() + '/css2.1/test', '')
         dirs = port.test_dirs()
-        self.assertTrue('canvas' in dirs)
-        self.assertTrue('css2.1' in dirs)
+        self.assertIn('canvas', dirs)
+        self.assertIn('css2.1', dirs)
 
     def test_skipped_perf_tests(self):
         port = self.make_port()
@@ -223,7 +223,7 @@ class PortTest(unittest.TestCase):
 
     def test_get_option__unset(self):
         port = self.make_port()
-        self.assertEqual(port.get_option('foo'), None)
+        self.assertIsNone(port.get_option('foo'))
 
     def test_get_option__default(self):
         port = self.make_port()
@@ -320,7 +320,7 @@ class PortTest(unittest.TestCase):
     def test_find_with_skipped_directories(self):
         port = self.make_port(with_tests=True)
         tests = port.tests(['userscripts'])
-        self.assertTrue('userscripts/resources/iframe.html' not in tests)
+        self.assertNotIn('userscripts/resources/iframe.html', tests)
 
     def test_find_with_skipped_directories_2(self):
         port = self.make_port(with_tests=True)
@@ -432,20 +432,20 @@ class PortTest(unittest.TestCase):
     def test_tests(self):
         port = self.make_port(with_tests=True)
         tests = port.tests([])
-        self.assertTrue('passes/text.html' in tests)
-        self.assertTrue('virtual/passes/text.html' in tests)
+        self.assertIn('passes/text.html', tests)
+        self.assertIn('virtual/passes/text.html', tests)
 
         tests = port.tests(['passes'])
-        self.assertTrue('passes/text.html' in tests)
-        self.assertTrue('passes/passes/test-virtual-passes.html' in tests)
-        self.assertFalse('virtual/passes/text.html' in tests)
+        self.assertIn('passes/text.html', tests)
+        self.assertIn('passes/passes/test-virtual-passes.html', tests)
+        self.assertNotIn('virtual/passes/text.html', tests)
 
         tests = port.tests(['virtual/passes'])
-        self.assertFalse('passes/text.html' in tests)
-        self.assertTrue('virtual/passes/test-virtual-passes.html' in tests)
-        self.assertTrue('virtual/passes/passes/test-virtual-passes.html' in tests)
-        self.assertFalse('virtual/passes/test-virtual-virtual/passes.html' in tests)
-        self.assertFalse('virtual/passes/virtual/passes/test-virtual-passes.html' in tests)
+        self.assertNotIn('passes/text.html', tests)
+        self.assertIn('virtual/passes/test-virtual-passes.html', tests)
+        self.assertIn('virtual/passes/passes/test-virtual-passes.html', tests)
+        self.assertNotIn('virtual/passes/test-virtual-virtual/passes.html', tests)
+        self.assertNotIn('virtual/passes/virtual/passes/test-virtual-passes.html', tests)
 
     def test_build_path(self):
         port = self.make_port(options=optparse.Values({'build_directory': '/my-build-directory/'}))
index 5997f54..77551b9 100644 (file)
@@ -27,7 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import builders
-import unittest
+import unittest2 as unittest
 
 
 class BuildersTest(unittest.TestCase):
index 2fea658..f34bbcd 100644 (file)
@@ -29,7 +29,7 @@
 import optparse
 import StringIO
 import time
-import unittest
+import unittest2 as unittest
 import sys
 
 from webkitpy.common.system import executive_mock
@@ -239,15 +239,15 @@ class ChromiumAndroidDriverTest(unittest.TestCase):
 
     def test_drt_cmd_line(self):
         cmd_line = self.driver._drt_cmd_line(True, ['--a'])
-        self.assertTrue('--a' in cmd_line)
-        self.assertTrue('--create-stdin-fifo' in cmd_line)
-        self.assertTrue('--separate-stderr-fifo' in cmd_line)
+        self.assertIn('--a', cmd_line)
+        self.assertIn('--create-stdin-fifo', cmd_line)
+        self.assertIn('--separate-stderr-fifo', cmd_line)
 
     def test_read_prompt(self):
         self.driver._server_process = driver_unittest.MockServerProcess(lines=['root@android:/ # '])
-        self.assertEqual(self.driver._read_prompt(time.time() + 1), None)
+        self.assertIsNone(self.driver._read_prompt(time.time() + 1))
         self.driver._server_process = driver_unittest.MockServerProcess(lines=['$ '])
-        self.assertEqual(self.driver._read_prompt(time.time() + 1), None)
+        self.assertIsNone(self.driver._read_prompt(time.time() + 1))
 
     def test_command_from_driver_input(self):
         driver_input = driver.DriverInput('foo/bar/test.html', 10, 'checksum', True)
index edb1e62..308d02f 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system import executive_mock
 from webkitpy.common.system.systemhost_mock import MockSystemHost
index aff3741..bf2ff8f 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.layout_tests.port import chromium_mac
 from webkitpy.layout_tests.port import chromium_port_testcase
index 966409a..4d63337 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system import logtesting
 from webkitpy.common.system.executive_mock import MockExecutive2
index 414981f..c6c50df 100644 (file)
@@ -28,7 +28,6 @@
 
 import StringIO
 import time
-import unittest
 
 from webkitpy.common.system import logtesting
 from webkitpy.common.system.executive_mock import MockExecutive2
index b8f5929..3ccf940 100644 (file)
@@ -27,7 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import os
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system import outputcapture
 from webkitpy.common.system.executive_mock import MockExecutive
@@ -74,7 +74,7 @@ class ChromiumWinTest(chromium_port_testcase.ChromiumPortTestCase):
 
     def test_versions(self):
         port = self.make_port()
-        self.assertTrue(port.name() in ('chromium-win-xp', 'chromium-win-win7'))
+        self.assertIn(port.name(), ('chromium-win-xp', 'chromium-win-win7'))
 
         self.assert_name(None, 'xp', 'chromium-win-xp')
         self.assert_name('chromium-win', 'xp', 'chromium-win-xp')
index 5b04831..274a07b 100644 (file)
@@ -33,7 +33,6 @@ https://bugs.webkit.org/show_bug?id=49360 for the motivation. We can remove
 this test when we remove the global configuration cache in config.py."""
 
 import os
-import unittest
 import sys
 
 
index 34bcc68..27c83ee 100644 (file)
@@ -28,7 +28,7 @@
 
 import os
 import sys
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.executive import Executive, ScriptError
 from webkitpy.common.system.executive_mock import MockExecutive2
index f60dc3d..32173a8 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.systemhost_mock import MockSystemHost
 
index 94be48b..503afda 100644 (file)
@@ -24,7 +24,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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.executive_mock import MockExecutive
 from webkitpy.common.system.outputcapture import OutputCapture
index a8704f9..363b7b9 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.tool.mocktool import MockOptions
 from webkitpy.common.system.systemhost_mock import MockSystemHost
@@ -54,7 +54,7 @@ class FactoryTest(unittest.TestCase):
     def assert_port(self, port_name=None, os_name=None, os_version=None, options=None, cls=None):
         host = MockSystemHost(os_name=os_name, os_version=os_version)
         port = factory.PortFactory(host).get(port_name, options=options)
-        self.assertTrue(isinstance(port, cls))
+        self.assertIsInstance(port, cls)
 
     def test_mac(self):
         self.assert_port(port_name='mac-lion', cls=mac.MacPort)
index f18137b..75ae535 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 import sys
 import os
 
@@ -67,12 +67,6 @@ class GtkPortTest(port_testcase.PortTestCase):
         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 assertLinesEqual(self, a, b):
-        if hasattr(self, 'assertMultiLineEqual'):
-            self.assertMultiLineEqual(a, b)
-        else:
-            self.assertEqual(a.splitlines(), b.splitlines())
-
     def test_get_crash_log(self):
         core_directory = os.environ.get('WEBKIT_CORE_DUMPS_DIRECTORY', '/path/to/coredumps')
         core_pattern = os.path.join(core_directory, "core-pid_%p-_-process_%e")
@@ -95,8 +89,8 @@ STDERR: <empty>""" % locals()
         port._get_gdb_output = mock_empty_crash_log
         stderr, log = port._get_crash_log("DumpRenderTree", 28529, "", "", newer_than=None)
         self.assertEqual(stderr, "")
-        self.assertLinesEqual(log, mock_empty_crash_log)
+        self.assertMultiLineEqual(log, mock_empty_crash_log)
 
         stderr, log = port._get_crash_log("DumpRenderTree", 28529, "", "", newer_than=0.0)
         self.assertEqual(stderr, "")
-        self.assertLinesEqual(log, mock_empty_crash_log)
+        self.assertMultiLineEqual(log, mock_empty_crash_log)
index 94ce5f9..25af12f 100644 (file)
@@ -25,7 +25,7 @@
 
 from http_lock import HttpLock
 import os  # Used for os.getpid()
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.filesystem_mock import MockFileSystem
 from webkitpy.common.system.executive_mock import MockExecutive
index 0e5f0a0..b5b427b 100644 (file)
@@ -28,7 +28,7 @@
 
 """Unit testing base class for Port implementations."""
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.layout_tests.port.server_process_mock import MockServerProcess
 from webkitpy.layout_tests.port.image_diff import ImageDiffer
index 09d37d7..f2daec9 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.layout_tests.port.leakdetector import LeakDetector
 from webkitpy.common.system.filesystem_mock import MockFileSystem
index 7884f24..34efe40 100644 (file)
@@ -87,9 +87,9 @@ java/
         port._filesystem = MockFileSystem(dirs=platform_dir_paths)
 
         dirs_to_skip = port._tests_for_other_platforms()
-        self.assertTrue('platform/chromium-linux' in dirs_to_skip)
-        self.assertFalse('platform/mac' in dirs_to_skip)
-        self.assertFalse('platform/mac-snowleopard' in dirs_to_skip)
+        self.assertIn('platform/chromium-linux', dirs_to_skip)
+        self.assertNotIn('platform/mac', dirs_to_skip)
+        self.assertNotIn('platform/mac-snowleopard', dirs_to_skip)
 
     def test_version(self):
         port = self.make_port()
index b485574..bd285ef 100644 (file)
@@ -29,7 +29,7 @@
 """Unit tests for MockDRT."""
 
 import sys
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common import newstringio
 from webkitpy.common.system.systemhost_mock import MockSystemHost
index 89ef296..c5c9b5d 100644 (file)
@@ -34,7 +34,7 @@ import os
 import socket
 import sys
 import time
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.executive_mock import MockExecutive
 from webkitpy.common.system.filesystem_mock import MockFileSystem
index 3d3c8fe..38edf0a 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 import os
 from copy import deepcopy
 
index cd1db1f..97376aa 100644 (file)
@@ -28,7 +28,7 @@
 
 import sys
 import time
-import unittest
+import unittest2 as unittest
 
 from webkitpy.layout_tests.port.factory import PortFactory
 from webkitpy.layout_tests.port import server_process
@@ -140,13 +140,13 @@ class TestServerProcess(unittest.TestCase):
         server_process = FakeServerProcess(port_obj=port_obj, name="test", cmd=["test"])
         server_process.write("should break")
         self.assertTrue(server_process.has_crashed())
-        self.assertNotEquals(server_process.pid(), None)
-        self.assertEqual(server_process._proc, None)
+        self.assertIsNotNone(server_process.pid())
+        self.assertIsNone(server_process._proc)
         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.assertEqual(server_process._proc, None)
+        self.assertIsNone(server_process._proc)
         self.assertEqual(server_process.broken_pipes, [server_process.stdin])
index 9def724..9027ceb 100644 (file)
@@ -27,7 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import StringIO
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.executive import ScriptError
 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2
index 4717dde..4c5d338 100644 (file)
@@ -27,7 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import logging
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.filesystem_mock import MockFileSystem
 from webkitpy.common.system.executive_mock import MockExecutive2
@@ -131,5 +131,5 @@ class XvfbDriverTest(unittest.TestCase):
         expected_logs = "MOCK kill_process pid: 1234\n"
         OutputCapture().assert_outputs(self, driver.stop, [], expected_logs=expected_logs)
 
-        self.assertEqual(driver._xvfb_process, None)
+        self.assertIsNone(driver._xvfb_process)
         self.assertFalse(port._filesystem.exists(driver._lock_file))
index 1266a33..85b18e2 100644 (file)
@@ -23,7 +23,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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.layout_tests.reftests import extract_reference_link
 
@@ -55,10 +55,10 @@ CONTENT OF TEST
 </html>
 """
         matches, mismatches = extract_reference_link.get_reference_link(html_1)
-        self.assertEqual(matches,
-                         ["green-box-ref.xht", "blue-box-ref.xht"])
-        self.assertEqual(mismatches,
-                         ["red-box-notref.xht", "red-box-notref.xht"])
+        self.assertItemsEqual(matches,
+                              ["green-box-ref.xht", "blue-box-ref.xht"])
+        self.assertItemsEqual(mismatches,
+                              ["red-box-notref.xht", "red-box-notref.xht"])
 
         html_2 = ""
         empty_tuple_1 = extract_reference_link.get_reference_link(html_2)
index eaa80c9..d85a0a4 100644 (file)
@@ -40,7 +40,7 @@ import sys
 import thread
 import time
 import threading
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system import outputcapture, path
 from webkitpy.common.system.crashlogs_unittest import make_mock_crash_report_darwin
index f3ca6a1..5ca027f 100644 (file)
@@ -28,7 +28,7 @@
 
 import re
 import sys
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.executive_mock import MockExecutive
 from webkitpy.common.system.outputcapture import OutputCapture
@@ -64,7 +64,7 @@ class TestLayoutTestApacheHttpd(unittest.TestCase):
             server.stop()
         finally:
             _, _, logs = oc.restore_output()
-        self.assertTrue("StartServers 4" in logs)
-        self.assertTrue("MinSpareServers 4" in logs)
-        self.assertTrue("MaxSpareServers 4" in logs)
+        self.assertIn("StartServers 4", logs)
+        self.assertIn("MinSpareServers 4", logs)
+        self.assertIn("MaxSpareServers 4", logs)
         self.assertTrue(host.filesystem.exists("/mock/output_dir/httpd.conf"))
index 37faa64..aa6e59d 100644 (file)
@@ -36,7 +36,7 @@ import socket
 import subprocess
 import sys
 import tempfile
-import unittest
+import unittest2 as unittest
 
 
 class BaseTest(unittest.TestCase):
index d553c53..2ee9495 100644 (file)
@@ -28,7 +28,7 @@
 
 import re
 import sys
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.host_mock import MockHost
 from webkitpy.layout_tests.port import test
index 076d5c8..5ce15c1 100644 (file)
@@ -28,7 +28,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import StringIO
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.host_mock import MockHost
 
index eba436d..0eaec2d 100644 (file)
@@ -29,7 +29,7 @@
 import logging
 import re
 import StringIO
-import unittest
+import unittest2 as unittest
 
 from webkitpy.layout_tests.views.metered_stream import MeteredStream
 
index 3448f5f..71e7888 100644 (file)
@@ -32,7 +32,7 @@ import optparse
 import StringIO
 import sys
 import time
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.host_mock import MockHost
 
@@ -54,7 +54,7 @@ def get_options(args):
 class TestUtilityFunctions(unittest.TestCase):
     def test_print_options(self):
         options, args = get_options([])
-        self.assertTrue(options is not None)
+        self.assertIsNotNone(options)
 
 
 class  Testprinter(unittest.TestCase):
@@ -108,19 +108,19 @@ class  Testprinter(unittest.TestCase):
         printer._options.time_out_ms = 6000
         printer._options.slow_time_out_ms = 12000
         printer.print_config('/tmp')
-        self.assertTrue("Using port 'test-mac-leopard'" in err.getvalue())
-        self.assertTrue('Test configuration: <leopard, x86, release>' in err.getvalue())
-        self.assertTrue('Placing test results in /tmp' in err.getvalue())
-        self.assertTrue('Baseline search path: test-mac-leopard -> test-mac-snowleopard -> generic' in err.getvalue())
-        self.assertTrue('Using Release build' in err.getvalue())
-        self.assertTrue('Pixel tests enabled' in err.getvalue())
-        self.assertTrue('Command line:' in err.getvalue())
-        self.assertTrue('Regular timeout: ' in err.getvalue())
+        self.assertIn("Using port 'test-mac-leopard'", err.getvalue())
+        self.assertIn('Test configuration: <leopard, x86, release>', err.getvalue())
+        self.assertIn('Placing test results in /tmp', err.getvalue())
+        self.assertIn('Baseline search path: test-mac-leopard -> test-mac-snowleopard -> generic', err.getvalue())
+        self.assertIn('Using Release build', err.getvalue())
+        self.assertIn('Pixel tests enabled', err.getvalue())
+        self.assertIn('Command line:', err.getvalue())
+        self.assertIn('Regular timeout: ', err.getvalue())
 
         self.reset(err)
         printer._options.quiet = True
         printer.print_config('/tmp')
-        self.assertFalse('Baseline search path: test-mac-leopard -> test-mac-snowleopard -> generic' in err.getvalue())
+        self.assertNotIn('Baseline search path: test-mac-leopard -> test-mac-snowleopard -> generic', err.getvalue())
 
     def test_print_one_line_summary(self):
         printer, err = self.get_printer()
index bd55f4c..010d328 100644 (file)
@@ -29,7 +29,7 @@
 import StringIO
 import json
 import math
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.host_mock import MockHost
 from webkitpy.common.system.outputcapture import OutputCapture
@@ -89,7 +89,7 @@ class TestPerfTestMetric(unittest.TestCase):
             return json.loads(json.dumps(statistics))
 
         statistics = compute_statistics([10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11])
-        self.assertEqual(sorted(statistics.keys()), ['avg', 'max', 'median', 'min', 'stdev'])
+        self.assertItemsEqual(statistics.keys(), ['avg', 'max', 'median', 'min', 'stdev'])
         self.assertEqual(statistics['avg'], 10.5)
         self.assertEqual(statistics['min'], 1)
         self.assertEqual(statistics['max'], 20)
@@ -111,7 +111,7 @@ class TestPerfTest(unittest.TestCase):
         parsed_results = test.parse_output(output)
         self.assertEqual(len(parsed_results), 1)
         some_test_results = parsed_results[0].to_dict()
-        self.assertEqual(sorted(some_test_results.keys()), ['avg', 'max', 'median', 'min', 'stdev', 'unit', 'values'])
+        self.assertItemsEqual(some_test_results.keys(), ['avg', 'max', 'median', 'min', 'stdev', 'unit', 'values'])
         self.assertEqual(some_test_results['values'], [1080, 1120, 1095, 1101, 1104])
         self.assertEqual(some_test_results['min'], 1080)
         self.assertEqual(some_test_results['max'], 1120)
@@ -164,7 +164,7 @@ max 1120 ms
         try:
             test = PerfTest(MockPort(), 'some-test', '/path/some-dir/some-test')
             test._filter_output(output)
-            self.assertEqual(test.parse_output(output), None)
+            self.assertIsNone(test.parse_output(output))
         finally:
             actual_stdout, actual_stderr, actual_logs = output_capture.restore_output()
         self.assertEqual(actual_stdout, '')
@@ -307,7 +307,7 @@ class TestPageLoadingPerfTest(unittest.TestCase):
             port = MockPort()
             test = PageLoadingPerfTest(port, 'some-test', '/path/some-dir/some-test')
             driver = TestPageLoadingPerfTest.MockDriver([1, 2, 3, 4, 5, 6, 7, 'some error', 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], test)
-            self.assertEqual(test._run_with_driver(driver, None), None)
+            self.assertIsNone(test._run_with_driver(driver, None))
         finally:
             actual_stdout, actual_stderr, actual_logs = output_capture.restore_output()
         self.assertEqual(actual_stdout, '')
@@ -461,7 +461,7 @@ class TestReplayPerfTest(unittest.TestCase):
         test, port = self._setup_test(run_test)
 
         try:
-            self.assertEqual(test.prepare(time_out_ms=100), True)
+            self.assertTrue(test.prepare(time_out_ms=100))
         finally:
             actual_stdout, actual_stderr, actual_logs = output_capture.restore_output()
 
@@ -485,7 +485,7 @@ class TestReplayPerfTest(unittest.TestCase):
         test.run_single = run_single
 
         try:
-            self.assertEqual(test.prepare(time_out_ms=100), False)
+            self.assertFalse(test.prepare(time_out_ms=100))
         finally:
             actual_stdout, actual_stderr, actual_logs = output_capture.restore_output()
         self.assertTrue(called[0])
index 8232a86..534104c 100644 (file)
@@ -31,7 +31,7 @@
 import StringIO
 import json
 import re
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.host_mock import MockHost
 from webkitpy.common.system.outputcapture import OutputCapture
index bf8c704..fcc34a3 100644 (file)
@@ -31,7 +31,7 @@
 import StringIO
 import json
 import re
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.host_mock import MockHost
 from webkitpy.layout_tests.port.test import TestPort
@@ -72,7 +72,7 @@ class MainTest(unittest.TestCase):
         add_file('test2.html')
         add_file('test3.html')
         port.host.filesystem.chdir(runner._port.perf_tests_dir()[:runner._port.perf_tests_dir().rfind(runner._host.filesystem.sep)])
-        self.assertEqual(self._collect_tests_and_sort_test_name(runner), ['test1.html', 'test2.html'])
+        self.assertItemsEqual(self._collect_tests_and_sort_test_name(runner), ['test1.html', 'test2.html'])
 
     def test_collect_tests_with_skipped_list(self):
         runner, port = self.create_runner()
@@ -83,7 +83,7 @@ class MainTest(unittest.TestCase):
         self._add_file(runner, 'inspector/resources', 'resource_file.html')
         self._add_file(runner, 'unsupported', 'unsupported_test2.html')
         port.skipped_perf_tests = lambda: ['inspector/unsupported_test1.html', 'unsupported']
-        self.assertEqual(self._collect_tests_and_sort_test_name(runner), ['inspector/test1.html', 'inspector/test2.html'])
+        self.assertItemsEqual(self._collect_tests_and_sort_test_name(runner), ['inspector/test1.html', 'inspector/test2.html'])
 
     def test_collect_tests_with_skipped_list_and_files(self):
         runner, port = self.create_runner(args=['Suite/Test1.html', 'Suite/SkippedTest1.html', 'SkippedSuite/Test1.html'])
@@ -95,7 +95,7 @@ class MainTest(unittest.TestCase):
         self._add_file(runner, 'Suite', 'SkippedTest1.html')
         self._add_file(runner, 'Suite', 'SkippedTest2.html')
         port.skipped_perf_tests = lambda: ['Suite/SkippedTest1.html', 'Suite/SkippedTest1.html', 'SkippedSuite']
-        self.assertEqual(self._collect_tests_and_sort_test_name(runner),
+        self.assertItemsEqual(self._collect_tests_and_sort_test_name(runner),
             ['SkippedSuite/Test1.html', 'Suite/SkippedTest1.html', 'Suite/Test1.html'])
 
     def test_collect_tests_with_ignored_skipped_list(self):
@@ -107,12 +107,12 @@ class MainTest(unittest.TestCase):
         self._add_file(runner, 'inspector/resources', 'resource_file.html')
         self._add_file(runner, 'unsupported', 'unsupported_test2.html')
         port.skipped_perf_tests = lambda: ['inspector/unsupported_test1.html', 'unsupported']
-        self.assertEqual(self._collect_tests_and_sort_test_name(runner), ['inspector/test1.html', 'inspector/test2.html', 'inspector/unsupported_test1.html', 'unsupported/unsupported_test2.html'])
+        self.assertItemsEqual(self._collect_tests_and_sort_test_name(runner), ['inspector/test1.html', 'inspector/test2.html', 'inspector/unsupported_test1.html', 'unsupported/unsupported_test2.html'])
 
     def test_collect_tests_should_ignore_replay_tests_by_default(self):
         runner, port = self.create_runner()
         self._add_file(runner, 'Replay', 'www.webkit.org.replay')
-        self.assertEqual(runner._collect_tests(), [])
+        self.assertItemsEqual(runner._collect_tests(), [])
 
     def test_collect_tests_with_replay_tests(self):
         runner, port = self.create_runner(args=['--replay'])
@@ -135,15 +135,15 @@ class MainTest(unittest.TestCase):
                 '--slave-config-json-path=a/source.json',
                 '--test-results-server=somehost',
                 '--debug'])
-        self.assertEqual(options.build, True)
+        self.assertTrue(options.build)
         self.assertEqual(options.build_directory, 'folder42')
         self.assertEqual(options.platform, 'platform42')
         self.assertEqual(options.builder_name, 'webkit-mac-1')
         self.assertEqual(options.build_number, '56')
         self.assertEqual(options.time_out_ms, '42')
         self.assertEqual(options.configuration, 'Debug')
-        self.assertEqual(options.show_results, False)
-        self.assertEqual(options.reset_results, True)
+        self.assertFalse(options.show_results)
+        self.assertTrue(options.reset_results)
         self.assertEqual(options.output_json_path, 'a/output.json')
         self.assertEqual(options.slave_config_json_path, 'a/source.json')
         self.assertEqual(options.test_results_server, 'somehost')
index 74524d5..9a139c7 100644 (file)
@@ -35,7 +35,7 @@
 
 import logging
 import os
-import unittest
+import unittest2 as unittest
 
 import checker as style
 from webkitpy.common.system.logtesting import LogTesting, TestLogStream
@@ -173,7 +173,7 @@ class GlobalVariablesTest(unittest.TestCase):
             # begin with -.
             self.assertTrue(rule.startswith('-'))
             # Check no rule occurs twice.
-            self.assertFalse(rule in already_seen)
+            self.assertNotIn(rule, already_seen)
             already_seen.append(rule)
 
     def test_defaults(self):
@@ -274,8 +274,8 @@ class GlobalVariablesTest(unittest.TestCase):
         """Check that _MAX_REPORTS_PER_CATEGORY is valid."""
         all_categories = self._all_categories()
         for category in _MAX_REPORTS_PER_CATEGORY.iterkeys():
-            self.assertTrue(category in all_categories,
-                            'Key "%s" is not a category' % category)
+            self.assertIn(category, all_categories,
+                          'Key "%s" is not a category' % category)
 
 
 class CheckWebKitStyleFunctionTest(unittest.TestCase):
@@ -396,7 +396,7 @@ class CheckerDispatcherDispatchTest(unittest.TestCase):
     def assert_checker_none(self, file_path):
         """Assert that the dispatched checker is None."""
         checker = self.dispatch(file_path)
-        self.assertTrue(checker is None, 'Checking: "%s"' % file_path)
+        self.assertIsNone(checker, 'Checking: "%s"' % file_path)
 
     def assert_checker(self, file_path, expected_class):
         """Assert the type of the dispatched checker."""
index a8cffd3..0ec0ec2 100644 (file)
@@ -24,7 +24,7 @@
 """Unit test for changelog.py."""
 
 import changelog
-import unittest
+import unittest2 as unittest
 
 
 class ChangeLogCheckerTest(unittest.TestCase):
index f9feedc..7b2cdaf 100644 (file)
@@ -22,7 +22,7 @@
 
 """Unit test for cmake.py."""
 
-import unittest
+import unittest2 as unittest
 
 from cmake import CMakeChecker
 
index 6f87dcd..8449b98 100644 (file)
@@ -22,7 +22,7 @@
 
 """Unit tests for common.py."""
 
-import unittest
+import unittest2 as unittest
 
 from common import CarriageReturnChecker
 from common import TabChecker
index c33ac6d..8de99df 100644 (file)
@@ -39,7 +39,7 @@ import codecs
 import os
 import random
 import re
-import unittest
+import unittest2 as unittest
 import cpp as cpp_style
 from cpp import CppChecker
 from ..filter import FilterConfiguration
index af1f47c..62a0793 100644 (file)
@@ -22,7 +22,7 @@
 
 """Unit test for jsonchecker.py."""
 
-import unittest
+import unittest2 as unittest
 
 import jsonchecker
 
@@ -67,7 +67,7 @@ class JSONCheckerTest(unittest.TestCase):
             mock_error_handler.had_error = True
             self.assertEqual(expected_line_number, line_number)
             self.assertEqual(expected_category, category)
-            self.assertTrue(category in jsonchecker.JSONChecker.categories)
+            self.assertIn(category, jsonchecker.JSONChecker.categories)
 
         error_handler = MockErrorHandler(handle_style_error)
         error_handler.had_error = False
index ac51b9d..a71a441 100644 (file)
@@ -23,7 +23,7 @@
 
 """Unit test for png.py."""
 
-import unittest
+import unittest2 as unittest
 from png import PNGChecker
 from webkitpy.common.system.filesystem_mock import MockFileSystem
 from webkitpy.common.system.systemhost_mock import MockSystemHost
index 73bda76..d52e3f3 100644 (file)
@@ -23,7 +23,7 @@
 """Unit tests for python.py."""
 
 import os
-import unittest
+import unittest2 as unittest
 
 from python import PythonChecker
 
index 4f4a4e4..43ef836 100644 (file)
@@ -28,7 +28,7 @@
 
 import os
 import sys
-import unittest
+import unittest2 as unittest
 
 from test_expectations import TestExpectationsChecker
 from webkitpy.common.host_mock import MockHost
@@ -70,7 +70,7 @@ class TestExpectationsTestCase(unittest.TestCase):
         if port:
             self.assertTrue(port.name().startswith(expected_port_implementation))
         else:
-            self.assertEqual(None, expected_port_implementation)
+            self.assertIsNone(expected_port_implementation)
 
     def test_determine_port_from_expectations_path(self):
         self._expect_port_for_expectations_path(None, '/')
@@ -94,7 +94,7 @@ class TestExpectationsTestCase(unittest.TestCase):
                                           self._error_collector, host=host)
 
         # We should have failed to find a valid port object for that path.
-        self.assertEqual(checker._port_obj, None)
+        self.assertIsNone(checker._port_obj)
 
         # Now use a test port so we can check the lines.
         checker._port_obj = host.port_factory.get('test-mac-leopard')
index aa9766b..01e373a 100644 (file)
@@ -28,7 +28,7 @@
 
 """Unit test for text_style.py."""
 
-import unittest
+import unittest2 as unittest
 
 import text as text_style
 from text import TextChecker
@@ -45,7 +45,7 @@ class TextStyleTestCase(unittest.TestCase):
             self.had_error = True
 
         text_style.process_file_data('', lines, error_for_test)
-        self.assertTrue(not self.had_error, '%s should not have any errors.' % lines)
+        self.assertFalse(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."""
index cb518dd..90950c9 100644 (file)
@@ -31,7 +31,7 @@
 '''Unit tests for watchlist.py.'''
 
 
-import unittest
+import unittest2 as unittest
 
 
 import watchlist
index 770713f..36a1a41 100644 (file)
@@ -24,7 +24,7 @@
 """Unit test for xcodeproj.py."""
 
 import xcodeproj
-import unittest
+import unittest2 as unittest
 
 
 class TestErrorHandler(object):
index 13add40..a224de3 100644 (file)
@@ -22,7 +22,7 @@
 
 """Unit test for xml.py."""
 
-import unittest
+import unittest2 as unittest
 
 import xml
 
index c021431..0b4c355 100644 (file)
@@ -23,7 +23,7 @@
 """Unit tests for error_handlers.py."""
 
 
-import unittest
+import unittest2 as unittest
 
 from checker import StyleProcessorConfiguration
 from error_handlers import DefaultStyleErrorHandler
index d728c46..2c506ec 100644 (file)
@@ -20,7 +20,7 @@
 # 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
+import unittest2 as unittest
 
 from webkitpy.common.system.filesystem import FileSystem
 from webkitpy.common.system.logtesting import LoggingTestCase
index c20d998..b4dd7bc 100644 (file)
@@ -22,7 +22,7 @@
 
 """Unit tests for filter.py."""
 
-import unittest
+import unittest2 as unittest
 
 from filter import _CategoryFilter as CategoryFilter
 from filter import validate_filter_rules
index e019168..dbfc7c8 100644 (file)
@@ -20,7 +20,7 @@
 # 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
+import unittest2 as unittest
 
 from main import change_directory
 from webkitpy.common.system.filesystem_mock import MockFileSystem
index 979b31d..0c9002a 100644 (file)
@@ -22,7 +22,7 @@
 
 """Unit tests for parser.py."""
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.logtesting import LoggingTestCase
 from webkitpy.style.optparser import ArgumentParser
@@ -145,9 +145,9 @@ class ArgumentParserTest(LoggingTestCase):
         self.assertEqual(files, [])
 
         self.assertEqual(options.filter_rules, [])
-        self.assertEqual(options.git_commit, None)
-        self.assertEqual(options.diff_files, False)
-        self.assertEqual(options.is_verbose, False)
+        self.assertIsNone(options.git_commit)
+        self.assertFalse(options.diff_files)
+        self.assertFalse(options.is_verbose)
         self.assertEqual(options.min_confidence, 3)
         self.assertEqual(options.output_format, 'vs7')
 
@@ -166,9 +166,9 @@ class ArgumentParserTest(LoggingTestCase):
         (files, options) = parse(['--git-diff=commit'])
         self.assertEqual(options.git_commit, 'commit')
         (files, options) = parse(['--verbose'])
-        self.assertEqual(options.is_verbose, True)
+        self.assertTrue(options.is_verbose)
         (files, options) = parse(['--diff-files', 'file.txt'])
-        self.assertEqual(options.diff_files, True)
+        self.assertTrue(options.diff_files)
 
         # Pass user_rules.
         (files, options) = parse(['--filter=+build,-whitespace'])
@@ -200,8 +200,8 @@ class CommandOptionValuesTest(unittest.TestCase):
         # Check default parameters.
         options = ProcessorOptions()
         self.assertEqual(options.filter_rules, [])
-        self.assertEqual(options.git_commit, None)
-        self.assertEqual(options.is_verbose, False)
+        self.assertIsNone(options.git_commit)
+        self.assertFalse(options.is_verbose)
         self.assertEqual(options.min_confidence, 1)
         self.assertEqual(options.output_format, "emacs")
 
@@ -222,7 +222,7 @@ class CommandOptionValuesTest(unittest.TestCase):
                                    output_format="vs7")
         self.assertEqual(options.filter_rules, ["+"])
         self.assertEqual(options.git_commit, "commit")
-        self.assertEqual(options.is_verbose, True)
+        self.assertTrue(options.is_verbose)
         self.assertEqual(options.min_confidence, 3)
         self.assertEqual(options.output_format, "vs7")
 
index 05d36d9..f7368ec 100644 (file)
@@ -29,7 +29,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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.filesystem_mock import MockFileSystem
 from webkitpy.style.patchreader import PatchReader
index 91b3fed..f1259ef 100644 (file)
@@ -21,7 +21,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import logging
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.filesystem_mock import MockFileSystem
 from webkitpy.common.system.outputcapture import OutputCapture
@@ -112,7 +112,7 @@ class FinderTest(unittest.TestCase):
             self.check_names(['/tmp/another_unittest.py'], [])
         finally:
             _, _, logs = oc.restore_output()
-            self.assertTrue('another_unittest.py' in logs)
+            self.assertIn('another_unittest.py', logs)
 
         # Paths that don't exist are errors.
         oc.capture_output()
@@ -120,7 +120,7 @@ class FinderTest(unittest.TestCase):
             self.check_names(['/foo/bar/notexist_unittest.py'], [])
         finally:
             _, _, logs = oc.restore_output()
-            self.assertTrue('notexist_unittest.py' in logs)
+            self.assertIn('notexist_unittest.py', logs)
 
         # Names that don't exist are caught later, at load time.
         self.check_names(['bar.notexist_unittest'], ['bar.notexist_unittest'])
index 031abd6..8a1b56d 100644 (file)
@@ -22,7 +22,7 @@
 
 import logging
 import sys
-import unittest
+import unittest2 as unittest
 import StringIO
 
 from webkitpy.common.system.filesystem import FileSystem
@@ -70,8 +70,8 @@ class TesterTest(unittest.TestCase):
             _, _, logs = oc.restore_output()
             root_logger.handlers = root_handlers
 
-        self.assertTrue('No tests to run' in errors.getvalue())
-        self.assertTrue('No tests to run' in logs)
+        self.assertIn('No tests to run', errors.getvalue())
+        self.assertIn('No tests to run', logs)
 
     def _find_test_names(self, args):
         tester = Tester()
@@ -114,4 +114,4 @@ class TesterTest(unittest.TestCase):
         out, _ = proc.communicate()
         retcode = proc.returncode
         self.assertEqual(retcode, 0)
-        self.assertTrue('Cover' in out)
+        self.assertIn('Cover', out)
index cafc981..46a9507 100644 (file)
@@ -23,7 +23,7 @@
 import logging
 import re
 import StringIO
-import unittest
+import unittest2 as unittest
 
 from webkitpy.tool.mocktool import MockOptions
 from webkitpy.test.printer import Printer
index 2f847d6..bfcb6a6 100644 (file)
@@ -22,7 +22,7 @@
 
 import StringIO
 import logging
-import unittest
+import unittest2 as unittest
 
 from webkitpy.test.skip import skip_if
 
index fab9952..f687ae0 100644 (file)
@@ -27,7 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import sys
-import unittest
+import unittest2 as unittest
 
 from webkitpy.thirdparty import AutoinstallImportHook
 
index b37b991..028a4c6 100644 (file)
@@ -28,7 +28,7 @@
 
 """Unit tests for update_webgl_conformance_tests."""
 
-import unittest
+import unittest2 as unittest
 from webkitpy.to_be_moved import update_webgl_conformance_tests as webgl
 
 
index 820ff55..18545a8 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.tool.bot.botinfo import BotInfo
 from webkitpy.tool.mocktool import MockTool
index 3e3fa88..ba9254b 100644 (file)
@@ -28,7 +28,7 @@
 
 from datetime import datetime
 import logging
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.net import bugzilla
 from webkitpy.common.net.layouttestresults import LayoutTestResults
@@ -372,7 +372,7 @@ command_failed: failure_message='Patch does not pass tests' script_error='MOCK t
         patch = tool.bugs.fetch_attachment(10000)
         task = CommitQueueTask(commit_queue, patch)
         success = OutputCapture().assert_outputs(self, task.run, expected_logs=expected_logs)
-        self.assertEqual(success, False)
+        self.assertFalse(success)
 
     def test_test_failure(self):
         commit_queue = MockCommitQueue([
index 3cee3f0..b639856 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.tool.bot.expectedfailures import ExpectedFailures
 
index cb04e19..b70a637 100644 (file)
@@ -27,7 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 from datetime import datetime
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.thirdparty.mock import Mock
index 48c5112..3fb3c83 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.config.committers import Committer
 from webkitpy.common.system.filesystem_mock import MockFileSystem
index a33260f..b658eff 100644 (file)
@@ -27,7 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import os
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.tool.bot.irc_command import *
@@ -97,7 +97,7 @@ class IRCCommandTest(unittest.TestCase):
 
     def test_roll_chromium_deps(self):
         roll = RollChromiumDEPS()
-        self.assertEqual(None, roll._parse_args([]))
+        self.assertIsNone(roll._parse_args([]))
         self.assertEqual("1234", roll._parse_args(["1234"]))
         self.assertEqual('"Alan Cutter" <alancutter@chromium.org>', roll._expand_irc_nickname("alancutter"))
         self.assertEqual("unknown_irc_nickname", roll._expand_irc_nickname("unknown_irc_nickname"))
index c78eb80..2380711 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 import random
 
 from webkitpy.common.system.outputcapture import OutputCapture
index b6e89df..18de7ec 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.filesystem_mock import MockFileSystem
 from webkitpy.common.system.outputcapture import OutputCapture
@@ -48,7 +48,7 @@ class LayoutTestResultsReaderTest(unittest.TestCase):
         self.assertRaises(IOError, host.filesystem.read_text_file, layout_tests_results_path)
         self.assertRaises(IOError, host.filesystem.read_text_file, unit_tests_results_path)
         # layout_test_results shouldn't raise even if the results.json file is missing.
-        self.assertEqual(reader.results(), None)
+        self.assertIsNone(reader.results())
 
     def test_create_unit_test_results(self):
         host = MockHost()
@@ -71,19 +71,19 @@ class LayoutTestResultsReaderTest(unittest.TestCase):
         reader._create_layout_test_results = lambda: LayoutTestResults([])
         reader._create_unit_test_results = lambda: None
         # layout_test_results shouldn't raise even if the unit tests xml file is missing.
-        self.assertNotEquals(reader.results(), None)
+        self.assertIsNotNone(reader.results(), None)
         self.assertEqual(reader.results().failing_tests(), [])
 
 
     def test_layout_test_results(self):
         reader = LayoutTestResultsReader(MockHost(), "/mock-results", "/var/logs")
         reader._read_file_contents = lambda path: None
-        self.assertEqual(reader.results(), None)
+        self.assertIsNone(reader.results())
         reader._read_file_contents = lambda path: ""
-        self.assertEqual(reader.results(), None)
+        self.assertIsNone(reader.results())
         reader._create_layout_test_results = lambda: LayoutTestResults([])
         results = reader.results()
-        self.assertNotEquals(results, None)
+        self.assertIsNotNone(results)
         self.assertEqual(results.failure_limit_count(), 30)  # This value matches RunTests.NON_INTERACTIVE_FAILURE_LIMIT_COUNT
 
     def test_archive_last_layout_test_results(self):
@@ -95,10 +95,10 @@ class LayoutTestResultsReaderTest(unittest.TestCase):
         # Should fail because the results_directory does not exist.
         expected_logs = "/mock-results does not exist, not archiving.\n"
         archive = OutputCapture().assert_outputs(self, reader.archive, [patch], expected_logs=expected_logs)
-        self.assertEqual(archive, None)
+        self.assertIsNone(archive)
 
         host.filesystem.maybe_make_directory(results_directory)
         self.assertTrue(host.filesystem.exists(results_directory))
 
-        self.assertNotEqual(reader.archive(patch), None)
+        self.assertIsNotNone(reader.archive(patch))
         self.assertFalse(host.filesystem.exists(results_directory))
index 934b9ce..1ba13b1 100644 (file)
@@ -31,7 +31,7 @@ import os
 import shutil
 import tempfile
 import threading
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.executive import ScriptError
 from webkitpy.common.system.outputcapture import OutputCapture
@@ -168,7 +168,7 @@ class QueueEngineTest(unittest.TestCase):
     def test_now(self):
         """Make sure there are no typos in the QueueEngine.now() method."""
         engine = QueueEngine("test", None, None)
-        self.assertTrue(isinstance(engine._now(), datetime.datetime))
+        self.assertIsInstance(engine._now(), datetime.datetime)
 
     def test_sleep_message(self):
         engine = QueueEngine("test", None, None)
index 02fc036..cf989c9 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.net.buildbot import Builder
 from webkitpy.common.system.outputcapture import OutputCapture
index 14bf2ce..cbec11c 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.thirdparty.mock import Mock
index 2717e06..5f0b806 100644 (file)
@@ -47,7 +47,7 @@ class AbstractEarlyWarningSystemTest(QueuesTest):
         ews._expected_failures.unexpected_failures_observed = lambda results: set(["foo.html", "bar.html"])
         task = Mock()
         patch = ews._tool.bugs.fetch_attachment(10000)
-        self.assertEqual(ews._failing_tests_message(task, patch), "New failing tests:\nbar.html\nfoo.html")
+        self.assertMultiLineEqual(ews._failing_tests_message(task, patch), "New failing tests:\nbar.html\nfoo.html")
 
 
 class EarlyWarningSytemTest(QueuesTest):
index feb7b05..14211e4 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.net.buildbot import Builder
 from webkitpy.common.system.executive import ScriptError
index 02fa030..1f4b37e 100644 (file)
@@ -27,7 +27,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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.common.net.bugzilla import Bugzilla
@@ -173,7 +173,7 @@ class PrintExpectationsTest(unittest.TestCase):
             command.execute(options, tests, tool)
         finally:
             stdout, _, _ = oc.restore_output()
-        self.assertEqual(stdout, expected_stdout)
+        self.assertMultiLineEqual(stdout, expected_stdout)
 
     def test_basic(self):
         self.run_test(['failures/expected/text.html', 'failures/expected/image.html'],
@@ -263,7 +263,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.assertEqual(stdout,
+        self.assertMultiLineEqual(stdout,
                           ('// For test-win-xp\n'
                            'passes/text-expected.png\n'
                            'passes/text-expected.txt\n'))
@@ -274,7 +274,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.assertEqual(stdout,
+        self.assertMultiLineEqual(stdout,
                           ('// For test-win-vista\n'
                            'passes/text-expected.png\n'
                            'passes/text-expected.txt\n'
@@ -293,6 +293,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.assertEqual(stdout,
+        self.assertMultiLineEqual(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'))
index 10a0fbd..af9fd04 100644 (file)
@@ -156,7 +156,7 @@ class AbstractPatchQueueTest(CommandsTest):
         queue.bind_to_tool(tool)
         queue._options = Mock()
         queue._options.port = None
-        self.assertEqual(queue._next_patch(), None)
+        self.assertIsNone(queue._next_patch())
         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_logs = "MOCK: release_work_item: None 2\n"
@@ -382,9 +382,9 @@ MOCK: update_status: commit-queue Tests passed, but commit failed (checkout out
         state = {'patch': None}
         OutputCapture().assert_outputs(self, sequence.run_and_handle_errors, [tool, options, state], expected_exception=TryAgain, expected_logs=expected_logs)
 
-        self.assertEqual(options.update, True)
-        self.assertEqual(options.build, False)
-        self.assertEqual(options.test, False)
+        self.assertTrue(options.update)
+        self.assertFalse(options.build)
+        self.assertFalse(options.test)
 
     def test_manual_reject_during_processing(self):
         queue = SecondThoughtsCommitQueue(MockTool())
index 0f7c4ec..be9f693 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.net.bugzilla import Attachment
 from webkitpy.common.system.outputcapture import OutputCapture
index 5e0887d..f0a4d55 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer
@@ -83,15 +83,15 @@ class TestRebaselineTest(_BaseTestCase):
 
     def test_baseline_directory(self):
         command = self.command
-        self.assertEqual(command._baseline_directory("Apple Win XP Debug (Tests)"), "/mock-checkout/LayoutTests/platform/win-xp")
-        self.assertEqual(command._baseline_directory("Apple Win 7 Release (Tests)"), "/mock-checkout/LayoutTests/platform/win")
-        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 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")
+        self.assertMultiLineEqual(command._baseline_directory("Apple Win XP Debug (Tests)"), "/mock-checkout/LayoutTests/platform/win-xp")
+        self.assertMultiLineEqual(command._baseline_directory("Apple Win 7 Release (Tests)"), "/mock-checkout/LayoutTests/platform/win")
+        self.assertMultiLineEqual(command._baseline_directory("Apple Lion Release WK1 (Tests)"), "/mock-checkout/LayoutTests/platform/mac-lion")
+        self.assertMultiLineEqual(command._baseline_directory("Apple Lion Release WK2 (Tests)"), "/mock-checkout/LayoutTests/platform/mac-wk2")
+        self.assertMultiLineEqual(command._baseline_directory("GTK Linux 32-bit Release"), "/mock-checkout/LayoutTests/platform/gtk")
+        self.assertMultiLineEqual(command._baseline_directory("EFL Linux 64-bit Release WK2"), "/mock-checkout/LayoutTests/platform/efl-wk2")
+        self.assertMultiLineEqual(command._baseline_directory("Qt Linux Release"), "/mock-checkout/LayoutTests/platform/qt")
+        self.assertMultiLineEqual(command._baseline_directory("WebKit Mac10.7"), "/mock-checkout/LayoutTests/platform/chromium-mac-lion")
+        self.assertMultiLineEqual(command._baseline_directory("WebKit Mac10.6"), "/mock-checkout/LayoutTests/platform/chromium-mac-snowleopard")
 
     def test_rebaseline_updates_expectations_file_noop(self):
         self._zero_out_test_expectations()
@@ -105,12 +105,12 @@ 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.assertEqual(self.tool.web.urls_fetched,
+        self.assertItemsEqual(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'])
         new_expectations = self._read(self.lion_expectations_path)
-        self.assertEqual(new_expectations, """Bug(B) [ Mac Linux XP Debug ] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ]
+        self.assertMultiLineEqual(new_expectations, """Bug(B) [ Mac Linux XP Debug ] fast/dom/Window/window-postmessage-clone-really-deep-array.html [ Pass ]
 Bug(A) [ Debug ] : fast/css/large-list-of-rules-crash.html [ Failure ]
 """)
 
@@ -121,12 +121,12 @@ 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.assertEqual(self.tool.web.urls_fetched,
+        self.assertItemsEqual(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'])
         new_expectations = self._read(self.lion_expectations_path)
-        self.assertEqual(new_expectations, "Bug(x) [ MountainLion SnowLeopard ] userscripts/another-test.html [ ImageOnlyFailure ]\nbug(z) [ Linux ] userscripts/another-test.html [ ImageOnlyFailure ]\n")
+        self.assertMultiLineEqual(new_expectations, "Bug(x) [ MountainLion SnowLeopard ] userscripts/another-test.html [ ImageOnlyFailure ]\nbug(z) [ Linux ] userscripts/another-test.html [ ImageOnlyFailure ]\n")
 
     def test_rebaseline_does_not_include_overrides(self):
         self._write(self.lion_expectations_path, "Bug(x) [ Mac ] userscripts/another-test.html [ ImageOnlyFailure ]\nBug(z) [ Linux ] userscripts/another-test.html [ ImageOnlyFailure ]\n")
@@ -136,23 +136,23 @@ 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.assertEqual(self.tool.web.urls_fetched,
+        self.assertItemsEqual(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'])
 
         new_expectations = self._read(self.lion_expectations_path)
-        self.assertEqual(new_expectations, "Bug(x) [ MountainLion SnowLeopard ] userscripts/another-test.html [ ImageOnlyFailure ]\nBug(z) [ Linux ] userscripts/another-test.html [ ImageOnlyFailure ]\n")
+        self.assertMultiLineEqual(new_expectations, "Bug(x) [ MountainLion SnowLeopard ] userscripts/another-test.html [ ImageOnlyFailure ]\nBug(z) [ Linux ] userscripts/another-test.html [ ImageOnlyFailure ]\n")
 
     def test_rebaseline_test(self):
         self.command._rebaseline_test("WebKit Linux", "userscripts/another-test.html", None, "txt", self.WEB_PREFIX)
-        self.assertEqual(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/userscripts/another-test-actual.txt'])
+        self.assertItemsEqual(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.assertEqual(self.tool.web.urls_fetched, ['file:///tmp/userscripts/another-test-actual.txt'])
+        self.assertItemsEqual(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.assertEqual(self.command._scm_changes, {'add': ['/mock-checkout/LayoutTests/platform/chromium-linux/userscripts/another-test-expected.txt'], 'delete': []})
+        self.assertDictEqual(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.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')
+        self.assertMultiLineEqual(self._read('platform/chromium-mac-lion/userscripts/another-test-expected.txt'), self.MOCK_WEB_RESULT)
+        self.assertMultiLineEqual(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.assertEqual(self._read('platform/chromium-mac-lion/userscripts/another-test-expected.txt'), self.MOCK_WEB_RESULT)
+        self.assertMultiLineEqual(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.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)
+        self.assertItemsEqual(self.tool.web.urls_fetched, [self.WEB_PREFIX + '/userscripts/another-test-actual.txt'])
+        self.assertMultiLineEqual(self._read("platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt"), "original lion result")
+        self.assertMultiLineEqual(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.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)
+        self.assertMultiLineEqual(self._read("platform/chromium-mac-snowleopard/userscripts/another-test-expected.txt"), "original snowleopard result")
+        self.assertMultiLineEqual(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.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')
+        self.assertMultiLineEqual(self._read(self.tool.filesystem.join(port.layout_tests_dir(), 'platform/test-mac-leopard/failures/expected/image-expected.txt')), 'original snowleopard result')
+        self.assertMultiLineEqual(out, '{"add": []}\n')
 
 
 class TestRebaselineJson(_BaseTestCase):
@@ -335,8 +335,8 @@ class TestRebaselineExpectations(_BaseTestCase):
 
         # FIXME: change this to use the test- ports.
         calls = filter(lambda x: x != ['qmake', '-v'], self.tool.executive.calls)
-        self.assertTrue(len(calls) == 1)
-        self.assertTrue(len(calls[0]) == 36)
+        self.assertEqual(len(calls), 1)
+        self.assertEqual(len(calls[0]), 36)
 
     def test_rebaseline_expectations_noop(self):
         self._zero_out_test_expectations()
@@ -362,7 +362,7 @@ class TestRebaselineExpectations(_BaseTestCase):
                           'Bug(y) userscripts/test.html [ Crash ]\n')}
         self._write('/userscripts/another-test.html', '')
 
-        self.assertEqual(self.command._tests_to_rebaseline(self.lion_port), {'userscripts/another-test.html': set(['png', 'txt', 'wav'])})
+        self.assertDictEqual(self.command._tests_to_rebaseline(self.lion_port), {'userscripts/another-test.html': set(['png', 'txt', 'wav'])})
         self.assertEqual(self._read(self.lion_expectations_path), '')
 
 
index bf29964..e1ccc38 100644 (file)
@@ -57,7 +57,7 @@ class PostRollCommandsTest(CommandsTest):
         options = MockOptions()
         tool = MockTool()
         lkgr_state = postroll._prepare_state(options, [None, "last-known good revision"], tool)
-        self.assertEqual(None, lkgr_state["chromium_revision"])
+        self.assertIsNone(lkgr_state["chromium_revision"])
         self.assertEqual("Roll Chromium DEPS to last-known good revision", lkgr_state["bug_title"])
         self.assertEqual("Unreviewed.  Rolled DEPS.\n\n", lkgr_state["changelog_message"])
         revision_state = postroll._prepare_state(options, ["1234", "r1234", "test message"], tool)
index afc67db..dd8081f 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.tool.grammar import join_with_separators
 
index 5117909..35fdd3a 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from mocktool import MockOptions
 
index a01e6ad..7230235 100644 (file)
@@ -27,7 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import sys
-import unittest
+import unittest2 as unittest
 
 from optparse import make_option
 
index 438cc05..45bd4ee 100644 (file)
@@ -28,7 +28,7 @@
 
 import json
 import sys
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.layout_tests.models.test_configuration import *
index f5c1cbf..fd19c4d 100644 (file)
@@ -27,7 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import json
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.net import resultsjsonparser_unittest
 from webkitpy.common.host_mock import MockHost
@@ -211,7 +211,7 @@ class RebaselineTestTest(unittest.TestCase):
         server._test_config = get_test_config()
         server._gather_baselines(results_json)
         self.assertEqual(results_json['tests']['svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html']['state'], 'needs_rebaseline')
-        self.assertFalse('prototype-chocolate.html' in results_json['tests'])
+        self.assertNotIn('prototype-chocolate.html', results_json['tests'])
 
     def _assertRebaseline(self, test_files, results_files, test_name, baseline_target, baseline_move_to, expected_success, expected_log):
         log = []
@@ -234,7 +234,7 @@ class GetActualResultFilesTest(unittest.TestCase):
             'fast/text2-actual.txt',
             'fast/text-notactual.txt',
         ))
-        self.assertEqual(
+        self.assertItemsEqual(
             ('text-actual.txt',),
             rebaselineserver._get_actual_result_files(
                 'fast/text.html', test_config))
index d269dfc..e1d5623 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.tool.servers.reflectionhandler import ReflectionHandler
 
index 9fab6f4..12be0be 100644 (file)
@@ -21,7 +21,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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.tool.steps.addsvnmimetypeforpng import AddSvnMimetypeForPng
 from webkitpy.common.system.filesystem_mock import MockFileSystem
index a978f41..a740c3d 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.tool.mocktool import MockOptions, MockTool
index 1a2093d..7e31a9b 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.thirdparty.mock import Mock
 from webkitpy.tool.mocktool import MockOptions, MockTool
index 6969c4e..b042d42 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.tool.mocktool import MockOptions, MockTool
index 936e3eb..c6b76b4 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.common.system.executive import ScriptError
index 6f8f42c..d38fc92 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.thirdparty.mock import Mock
 from webkitpy.tool.mocktool import MockOptions, MockTool
index fc31d1f..811a148 100644 (file)
@@ -27,7 +27,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import os
-import unittest
+import unittest2 as unittest
 
 # Do not import changelog_unittest.ChangeLogTest directly as that will cause it to be run again.
 from webkitpy.common.checkout import changelog_unittest
index b82cb4a..a017988 100644 (file)
@@ -29,7 +29,7 @@
 import codecs
 import os
 import tempfile
-import unittest
+import unittest2 as unittest
 
 # Do not import changelog_unittest.ChangeLogTest directly as that will cause it to be run again.
 from webkitpy.common.checkout import changelog_unittest
@@ -115,8 +115,8 @@ class UpdateChangeLogsForRevertTest(unittest.TestCase):
         changelog.update_with_unreviewed_message(PrepareChangeLogForRevert._message_for_revert(*args))
         actual_entry = changelog.latest_entry()
         os.remove(changelog_path)
-        self.assertEqual(actual_entry.contents(), expected_entry)
-        self.assertEqual(actual_entry.reviewer_text(), None)
+        self.assertMultiLineEqual(actual_entry.contents(), expected_entry)
+        self.assertIsNone(actual_entry.reviewer_text())
         # These checks could be removed to allow this to work on other entries:
         self.assertEqual(actual_entry.author_name(), "Eric Seidel")
         self.assertEqual(actual_entry.author_email(), "eric@webkit.org")
index 967585c..b3151e8 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.tool.mocktool import MockOptions, MockTool
index 41c7983..48ee26f 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.common.config.ports import DeprecatedPort
index 42254c8..fc096f1 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.tool.mocktool import MockOptions, MockTool
index c1a934d..0866c4b 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.config.ports import ChromiumPort, ChromiumAndroidPort, ChromiumXVFBPort
 from webkitpy.tool.mocktool import MockOptions, MockTool
index 3182cf3..d433e3f 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.tool.mocktool import MockOptions, MockTool
index c3b723e..8a23be4 100644 (file)
@@ -26,7 +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.
 
-import unittest
+import unittest2 as unittest
 
 from webkitpy.common.system.outputcapture import OutputCapture
 from webkitpy.thirdparty.mock import Mock