Title: [270944] trunk/Tools
Revision
270944
Author
[email protected]
Date
2020-12-17 13:35:37 -0800 (Thu, 17 Dec 2020)

Log Message

[webkitscmpy] Capture Mock process logging during tests
https://bugs.webkit.org/show_bug.cgi?id=219989
<rdar://problem/72435662>

Reviewed by Dewei Zhu.

When declaring two mock local repositories, we need to ensure that logs are captured when
Instantiating the second repository so that "Mock process # send signal 9" is not logged
to the user's terminal.

* Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Bump version.
* Scripts/libraries/webkitscmpy/webkitscmpy/test/checkout_unittest.py:
(TestCheckout):
* Scripts/libraries/webkitscmpy/webkitscmpy/test/find_unittest.py:
(TestFind):
* Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py:
(TestGit):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (270943 => 270944)


--- trunk/Tools/ChangeLog	2020-12-17 21:33:12 UTC (rev 270943)
+++ trunk/Tools/ChangeLog	2020-12-17 21:35:37 UTC (rev 270944)
@@ -1,5 +1,25 @@
 2020-12-17  Jonathan Bedard  <[email protected]>
 
+        [webkitscmpy] Capture Mock process logging during tests 
+        https://bugs.webkit.org/show_bug.cgi?id=219989
+        <rdar://problem/72435662>
+
+        Reviewed by Dewei Zhu.
+
+        When declaring two mock local repositories, we need to ensure that logs are captured when
+        Instantiating the second repository so that "Mock process # send signal 9" is not logged
+        to the user's terminal.
+
+        * Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Bump version.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/test/checkout_unittest.py:
+        (TestCheckout):
+        * Scripts/libraries/webkitscmpy/webkitscmpy/test/find_unittest.py:
+        (TestFind):
+        * Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py:
+        (TestGit):
+
+2020-12-17  Jonathan Bedard  <[email protected]>
+
         [webkitscmpy] Remove branches argument from mock Git
         https://bugs.webkit.org/show_bug.cgi?id=219988
         <rdar://problem/72434657>

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py (270943 => 270944)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2020-12-17 21:33:12 UTC (rev 270943)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2020-12-17 21:35:37 UTC (rev 270944)
@@ -46,7 +46,7 @@
         "Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
     )
 
-version = Version(0, 6, 2)
+version = Version(0, 6, 3)
 
 AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
 AutoInstall.register(Package('monotonic', Version(1, 5)))

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/checkout_unittest.py (270943 => 270944)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/checkout_unittest.py	2020-12-17 21:33:12 UTC (rev 270943)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/checkout_unittest.py	2020-12-17 21:35:37 UTC (rev 270944)
@@ -31,7 +31,7 @@
     path = '/mock/repository'
 
     def test_checkout_git(self):
-        with mocks.local.Git(self.path), mocks.local.Svn(), MockTime, OutputCapture():
+        with OutputCapture(), mocks.local.Git(self.path), mocks.local.Svn(), MockTime:
             self.assertEqual('bae5d1e90999d4f916a8a15810ccfa43f37a2fd6', local.Git(self.path).commit().hash)
 
             self.assertEqual(0, program.main(
@@ -42,7 +42,7 @@
             self.assertEqual('fff83bb2d9171b4d9196e977eb0508fd57e7a08d', local.Git(self.path).commit().hash)
 
     def test_checkout_git_svn(self):
-        with mocks.local.Git(self.path, git_svn=True), mocks.local.Svn(), MockTime, OutputCapture():
+        with OutputCapture(), mocks.local.Git(self.path, git_svn=True), mocks.local.Svn(), MockTime:
             self.assertEqual('bae5d1e90999d4f916a8a15810ccfa43f37a2fd6', local.Git(self.path).commit().hash)
 
             self.assertEqual(0, program.main(
@@ -53,7 +53,7 @@
             self.assertEqual('621652add7fc416099bd2063366cc38ff61afe36', local.Git(self.path).commit().hash)
 
     def test_checkout_svn(self):
-        with mocks.local.Git(), mocks.local.Svn(self.path), MockTime, OutputCapture():
+        with OutputCapture(), mocks.local.Git(), mocks.local.Svn(self.path), MockTime:
             self.assertEqual(6, local.Svn(self.path).commit().revision)
 
             self.assertEqual(0, program.main(
@@ -64,7 +64,7 @@
             self.assertEqual(4, local.Svn(self.path).commit().revision)
 
     def test_checkout_remote(self):
-        with mocks.remote.Svn(), OutputCapture():
+        with OutputCapture(), mocks.remote.Svn():
             self.assertEqual(1, program.main(
                 args=('-C', 'https://svn.webkit.org/repository/webkit', 'checkout', '3@trunk'),
                 path=self.path,

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/find_unittest.py (270943 => 270944)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/find_unittest.py	2020-12-17 21:33:12 UTC (rev 270943)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/find_unittest.py	2020-12-17 21:35:37 UTC (rev 270944)
@@ -33,7 +33,7 @@
     path = '/mock/repository'
 
     def test_basic_git(self):
-        with mocks.local.Git(self.path), mocks.local.Svn(), MockTime, OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.local.Git(self.path), mocks.local.Svn(), MockTime:
             self.assertEqual(0, program.main(
                 args=('find', 'HEAD', '-q'),
                 path=self.path,
@@ -41,7 +41,7 @@
         self.assertEqual(captured.stdout.getvalue(), '4@main | bae5d1e90999\n')
 
     def test_basic_git_svn(self):
-        with mocks.local.Git(self.path, git_svn=True), mocks.local.Svn(), MockTime, OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.local.Git(self.path, git_svn=True), mocks.local.Svn(), MockTime:
             self.assertEqual(0, program.main(
                 args=('find', 'HEAD', '-q'),
                 path=self.path,
@@ -49,7 +49,7 @@
         self.assertEqual(captured.stdout.getvalue(), '4@main | bae5d1e90999, r6 | 6th commit\n')
 
     def test_basic_svn(self):
-        with mocks.local.Git(), mocks.local.Svn(self.path), MockTime, OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.local.Git(), mocks.local.Svn(self.path), MockTime:
             self.assertEqual(0, program.main(
                 args=('find', 'HEAD', '-q'),
                 path=self.path,
@@ -57,7 +57,7 @@
         self.assertEqual(captured.stdout.getvalue(), '4@trunk | r6 | 6th commit\n')
 
     def test_basic_svn_remote(self):
-        with mocks.remote.Svn(), OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.remote.Svn():
             self.assertEqual(0, program.main(
                 args=('-C', 'https://svn.example.org/repository/webkit', 'find', 'HEAD', '-q'),
                 path=self.path,
@@ -65,7 +65,7 @@
         self.assertEqual(captured.stdout.getvalue(), '4@trunk | r6 | 6th commit\n')
 
     def test_branch_tilde(self):
-        with mocks.local.Git(self.path, git_svn=True), mocks.local.Svn(), MockTime, OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.local.Git(self.path, git_svn=True), mocks.local.Svn(), MockTime:
             self.assertEqual(0, program.main(
                 args=('find', 'branch-a~1', '-q'),
                 path=self.path,
@@ -73,7 +73,7 @@
         self.assertEqual(captured.stdout.getvalue(), '2.1@branch-a | a30ce8494bf1, r3 | 3rd commit\n')
 
     def test_identifier_git(self):
-        with mocks.local.Git(self.path), mocks.local.Svn(), MockTime, OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.local.Git(self.path), mocks.local.Svn(), MockTime:
             self.assertEqual(0, program.main(
                 args=('find', '2@main', '-q'),
                 path=self.path,
@@ -81,7 +81,7 @@
         self.assertEqual(captured.stdout.getvalue(), '2@main | fff83bb2d917\n')
 
     def test_identifier_git_svn(self):
-        with mocks.local.Git(self.path), mocks.local.Svn(), MockTime, OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.local.Git(self.path), mocks.local.Svn(), MockTime:
             self.assertEqual(0, program.main(
                 args=('find', '2@main', '-q'),
                 path=self.path,
@@ -89,7 +89,7 @@
         self.assertEqual(captured.stdout.getvalue(), '2@main | fff83bb2d917\n')
 
     def test_identifier_svn(self):
-        with mocks.local.Git(), mocks.local.Svn(self.path), MockTime, OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.local.Git(), mocks.local.Svn(self.path), MockTime:
             self.assertEqual(0, program.main(
                 args=('find', '2@trunk', '-q'),
                 path=self.path,
@@ -97,7 +97,7 @@
         self.assertEqual(captured.stdout.getvalue(), '2@trunk | r2 | 2nd commit\n')
 
     def test_hash(self):
-        with mocks.local.Git(self.path), mocks.local.Svn(), MockTime, OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.local.Git(self.path), mocks.local.Svn(), MockTime:
             self.assertEqual(0, program.main(
                 args=('find', '3cd32e352410', '-q'),
                 path=self.path,
@@ -105,7 +105,7 @@
         self.assertEqual(captured.stdout.getvalue(), '2.2@branch-b | 3cd32e352410\n')
 
     def test_revision_svn(self):
-        with mocks.local.Git(), mocks.local.Svn(self.path), MockTime, OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.local.Git(), mocks.local.Svn(self.path), MockTime:
             self.assertEqual(0, program.main(
                 args=('find', 'r5', '-q'),
                 path=self.path,
@@ -113,7 +113,7 @@
         self.assertEqual(captured.stdout.getvalue(), '2.2@branch-b | r5 | 5th commit\n')
 
     def test_revision_git_svn(self):
-        with mocks.local.Git(self.path, git_svn=True), mocks.local.Svn(), MockTime, OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.local.Git(self.path, git_svn=True), mocks.local.Svn(), MockTime:
             self.assertEqual(0, program.main(
                 args=('find', 'r5', '-q'),
                 path=self.path,
@@ -121,7 +121,7 @@
         self.assertEqual(captured.stdout.getvalue(), '2.2@branch-b | 3cd32e352410, r5 | 5th commit\n')
 
     def test_standard(self):
-        with mocks.local.Git(self.path, git_svn=True), mocks.local.Svn(), MockTime, OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.local.Git(self.path, git_svn=True), mocks.local.Svn(), MockTime:
             self.assertEqual(0, program.main(
                 args=('find', '3@main'),
                 path=self.path,
@@ -138,7 +138,7 @@
         )
 
     def test_verbose(self):
-        with mocks.local.Git(self.path, git_svn=True), mocks.local.Svn(), MockTime, OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.local.Git(self.path, git_svn=True), mocks.local.Svn(), MockTime:
             self.assertEqual(0, program.main(
                 args=('find', '3@main', '-v'),
                 path=self.path,
@@ -157,7 +157,7 @@
         )
 
     def test_json(self):
-        with mocks.local.Git(self.path, git_svn=True), mocks.local.Svn(), MockTime, OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.local.Git(self.path, git_svn=True), mocks.local.Svn(), MockTime:
             self.assertEqual(0, program.main(
                 args=('find', '3@main', '--json'),
                 path=self.path,
@@ -178,7 +178,7 @@
             ))
 
     def test_tag_svn(self):
-        with mocks.local.Git(), mocks.local.Svn(self.path), MockTime, OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.local.Git(), mocks.local.Svn(self.path), MockTime:
             self.assertEqual(0, program.main(
                 args=('find', 'tag-1', '-q'),
                 path=self.path,
@@ -186,7 +186,7 @@
         self.assertEqual(captured.stdout.getvalue(), '2.3@tags/tag-1 | r9 | 9th commit\n')
 
     def test_tag_git(self):
-        with mocks.local.Git(self.path, git_svn=True) as mock, mocks.local.Svn(), MockTime, OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.local.Git(self.path, git_svn=True) as mock, mocks.local.Svn(), MockTime:
             mock.tags['tag-1'] = mock.commits['branch-a'][-1]
 
             self.assertEqual(0, program.main(
@@ -196,7 +196,7 @@
         self.assertEqual(captured.stdout.getvalue(), '2.2@branch-a | 621652add7fc, r7 | 7th commit\n')
 
     def test_no_log_svn(self):
-        with mocks.local.Git(), mocks.local.Svn(self.path), MockTime, OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.local.Git(), mocks.local.Svn(self.path), MockTime:
             self.assertEqual(0, program.main(
                 args=('find', 'trunk', '--no-log', '-q'),
                 path=self.path,
@@ -204,7 +204,7 @@
         self.assertEqual(captured.stdout.getvalue(), '4@trunk | r6\n')
 
     def test_no_log_git(self):
-        with mocks.local.Git(self.path, git_svn=True), mocks.local.Svn(), MockTime, OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.local.Git(self.path, git_svn=True), mocks.local.Svn(), MockTime:
             self.assertEqual(0, program.main(
                 args=('find', 'main', '--no-log', '-q'),
                 path=self.path,
@@ -212,7 +212,7 @@
         self.assertEqual(captured.stdout.getvalue(), '4@main | bae5d1e90999, r6\n')
 
     def test_timezone_svn(self):
-        with mocks.local.Git(), mocks.local.Svn(self.path, utc_offset='-0600'), MockTime, OutputCapture() as captured:
+        with OutputCapture() as captured, mocks.local.Git(), mocks.local.Svn(self.path, utc_offset='-0600'), MockTime:
             self.assertEqual(0, program.main(
                 args=('find', '3@trunk'),
                 path=self.path,

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py (270943 => 270944)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py	2020-12-17 21:33:12 UTC (rev 270943)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py	2020-12-17 21:35:37 UTC (rev 270944)
@@ -24,7 +24,7 @@
 import unittest
 
 from datetime import datetime
-from webkitcorepy import LoggerCapture
+from webkitcorepy import LoggerCapture, OutputCapture
 from webkitcorepy.mocks import Time as MockTime
 from webkitscmpy import local, mocks, remote
 
@@ -33,7 +33,7 @@
     path = '/mock/repository'
 
     def test_detection(self):
-        with mocks.local.Git(self.path), mocks.local.Svn():
+        with OutputCapture(), mocks.local.Git(self.path), mocks.local.Svn():
             detect = local.Scm.from_path(self.path)
             self.assertEqual(detect.executable, local.Git.executable)
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to