Title: [90659] trunk/Tools
Revision
90659
Author
[email protected]
Date
2011-07-08 13:02:23 -0700 (Fri, 08 Jul 2011)

Log Message

Make checkout_unittest more robust against files moving around

Fixes <http://webkit.org/b/64197> checkout_unittest contains ugly, fragile code to find the
Scripts directory

Reviewed by Adam Barth.

* Scripts/webkitpy/common/checkout/checkout_unittest.py:
(CommitMessageForThisCommitTest.test_commit_message_for_this_commit): Instantiate a real SCM
object and use it to get the path to the Scripts directory, rather than hard-coding the
relative path from this file to Scripts.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (90658 => 90659)


--- trunk/Tools/ChangeLog	2011-07-08 20:01:37 UTC (rev 90658)
+++ trunk/Tools/ChangeLog	2011-07-08 20:02:23 UTC (rev 90659)
@@ -1,5 +1,19 @@
 2011-07-08  Adam Roben  <[email protected]>
 
+        Make checkout_unittest more robust against files moving around
+
+        Fixes <http://webkit.org/b/64197> checkout_unittest contains ugly, fragile code to find the
+        Scripts directory
+
+        Reviewed by Adam Barth.
+
+        * Scripts/webkitpy/common/checkout/checkout_unittest.py:
+        (CommitMessageForThisCommitTest.test_commit_message_for_this_commit): Instantiate a real SCM
+        object and use it to get the path to the Scripts directory, rather than hard-coding the
+        relative path from this file to Scripts.
+
+2011-07-08  Adam Roben  <[email protected]>
+
         Make TestFailures remember that run-webkit-tests timed out, even across reloads
 
         Fixes <http://webkit.org/b/64193> TestFailures page incorrectly thinks all tests passed in

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/checkout_unittest.py (90658 => 90659)


--- trunk/Tools/Scripts/webkitpy/common/checkout/checkout_unittest.py	2011-07-08 20:01:37 UTC (rev 90658)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/checkout_unittest.py	2011-07-08 20:02:23 UTC (rev 90659)
@@ -119,8 +119,6 @@
     # FIXME: This should not need to touch the file system, however
     # ChangeLog is difficult to mock at current.
     def test_commit_message_for_this_commit(self):
-        scm = Mock()
-
         def mock_run(*args, **kwargs):
             # Note that we use a real Executive here, not a MockExecutive, so we can test that we're
             # invoking commit-log-editor correctly.
@@ -129,13 +127,13 @@
             kwargs['env'] = env
             return Executive().run_command(*args, **kwargs)
 
-        def mock_script_path(script):
-            return os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', script))
+        real_scm = detect_scm_system(self.old_cwd)
 
-        scm.run = mock_run
-        scm.script_path = mock_script_path
+        mock_scm = Mock()
+        mock_scm.run = mock_run
+        mock_scm.script_path = real_scm.script_path
 
-        checkout = Checkout(scm)
+        checkout = Checkout(mock_scm)
         checkout.modified_changelogs = lambda git_commit, changed_files=None: self.changelogs
         commit_message = checkout.commit_message_for_this_commit(git_commit=None)
         self.assertEqual(commit_message.message(), self.expected_commit_message)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to