Title: [278081] trunk/Tools
Revision
278081
Author
gsnedd...@apple.com
Date
2021-05-26 07:23:15 -0700 (Wed, 26 May 2021)

Log Message

Fix remaining test-webkitpy{,-python2} --all --integration-tests failures
https://bugs.webkit.org/show_bug.cgi?id=226242

Reviewed by Jonathan Bedard.

* Scripts/webkitpy/common/checkout/scm/scm_unittest.py:
(GitTest.test_remote_branch_ref): Allow main
(GitTest.test_native_branch):  Allow main
(SVNTest.clean_bogus_dir): Deleted.
(SVNTest.test_diff_for_file_with_existing_bogus_dir): Deleted.
(SVNTest.test_diff_for_file_with_missing_bogus_dir): Deleted.
* Scripts/webkitpy/common/checkout/scm/svn.py:
(SVN._setup_bogus_dir): Use tempfile
(SVN._teardown_bogus_dir): Make no-op when no bogus dir exists
(SVN._bogus_dir_name): Deleted.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (278080 => 278081)


--- trunk/Tools/ChangeLog	2021-05-26 13:28:02 UTC (rev 278080)
+++ trunk/Tools/ChangeLog	2021-05-26 14:23:15 UTC (rev 278081)
@@ -1,3 +1,21 @@
+2021-05-26  Sam Sneddon  <gsnedd...@apple.com>
+
+        Fix remaining test-webkitpy{,-python2} --all --integration-tests failures
+        https://bugs.webkit.org/show_bug.cgi?id=226242
+
+        Reviewed by Jonathan Bedard.
+
+        * Scripts/webkitpy/common/checkout/scm/scm_unittest.py:
+        (GitTest.test_remote_branch_ref): Allow main
+        (GitTest.test_native_branch):  Allow main
+        (SVNTest.clean_bogus_dir): Deleted.
+        (SVNTest.test_diff_for_file_with_existing_bogus_dir): Deleted.
+        (SVNTest.test_diff_for_file_with_missing_bogus_dir): Deleted.
+        * Scripts/webkitpy/common/checkout/scm/svn.py:
+        (SVN._setup_bogus_dir): Use tempfile
+        (SVN._teardown_bogus_dir): Make no-op when no bogus dir exists
+        (SVN._bogus_dir_name): Deleted.
+
 2021-05-25  Chris Fleizach  <cfleiz...@apple.com>
 
         AX: Improve string conversion in AccessibilityController::injectAccessibilityPreference

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py (278080 => 278081)


--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py	2021-05-26 13:28:02 UTC (rev 278080)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py	2021-05-26 14:23:15 UTC (rev 278081)
@@ -1014,26 +1014,7 @@
         self.assertIn("-some content", diff)
         self.assertIn("+changed content", diff)
 
-    def clean_bogus_dir(self):
-        self.bogus_dir = self.scm._bogus_dir_name()
-        if os.path.exists(self.bogus_dir):
-            shutil.rmtree(self.bogus_dir)
-
     @slow
-    def test_diff_for_file_with_existing_bogus_dir(self):
-        self.clean_bogus_dir()
-        os.mkdir(self.bogus_dir)
-        self.do_test_diff_for_file()
-        self.assertTrue(os.path.exists(self.bogus_dir))
-        shutil.rmtree(self.bogus_dir)
-
-    @slow
-    def test_diff_for_file_with_missing_bogus_dir(self):
-        self.clean_bogus_dir()
-        self.do_test_diff_for_file()
-        self.assertFalse(os.path.exists(self.bogus_dir))
-
-    @slow
     def test_svn_lock(self):
         if self.scm.svn_version() >= Version(1, 7):
             # the following technique with .svn/lock then svn update doesn't work with subversion client 1.7 or later
@@ -1088,7 +1069,7 @@
         run_command(['rm', '-rf', self.untracking_checkout_path])
 
     def test_remote_branch_ref(self):
-        self.assertEqual(self.tracking_scm.remote_branch_ref(), 'refs/remotes/origin/master')
+        self.assertIn(self.tracking_scm.remote_branch_ref(), ('refs/remotes/origin/master', 'refs/remotes/origin/main'))
 
         os.chdir(self.untracking_checkout_path)
         self.assertRaises(ScriptError, self.untracking_scm.remote_branch_ref)
@@ -1198,7 +1179,7 @@
 
     def test_native_branch(self):
         scm = self.tracking_scm
-        self.assertEqual('master', scm.native_branch(scm.checkout_root))
+        self.assertIn(scm.native_branch(scm.checkout_root), ('master', 'main'))
 
     def test_rename_files(self):
         scm = self.tracking_scm

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py (278080 => 278081)


--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py	2021-05-26 13:28:02 UTC (rev 278080)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py	2021-05-26 14:23:15 UTC (rev 278081)
@@ -334,29 +334,21 @@
         # FIXME: This should probably use cwd=self.checkout_root
         return self._run_svn(['diff', '-c', revision], decode_output=False)
 
-    def _bogus_dir_name(self):
-        rnd = ''.join(random.sample(string.ascii_letters, 5))
-        if sys.platform.startswith("win"):
-            parent_dir = tempfile.gettempdir()
-        else:
-            parent_dir = sys.path[0]  # tempdir is not secure.
-        return os.path.join(parent_dir, "temp_svn_config_" + rnd)
+    def _setup_bogus_dir(self, log):
+        if self._bogus_dir:
+            self._teardown_bogus_dir(log)
 
-    def _setup_bogus_dir(self, log):
-        self._bogus_dir = self._bogus_dir_name()
-        if not os.path.exists(self._bogus_dir):
-            os.mkdir(self._bogus_dir)
-            self._delete_bogus_dir = True
-        else:
-            self._delete_bogus_dir = False
+        self._bogus_dir = tempfile.mkdtemp()
         if log:
             log.debug('  Html: temp config dir: "%s".', self._bogus_dir)
 
     def _teardown_bogus_dir(self, log):
-        if self._delete_bogus_dir:
-            shutil.rmtree(self._bogus_dir, True)
-            if log:
-                log.debug('  Html: removed temp config dir: "%s".', self._bogus_dir)
+        if not self._bogus_dir:
+            return
+
+        shutil.rmtree(self._bogus_dir, True)
+        if log:
+            log.debug('  Html: removed temp config dir: "%s".', self._bogus_dir)
         self._bogus_dir = None
 
     def diff_for_file(self, path, log=None):
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to