[Updated] D10942: run-tests: avoid an early return

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Tue Jul 6 14:36:23 UTC 2021


Closed by commit rHG9d929f9cb9b4: run-tests: avoid an early return (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D10942?vs=28826&id=28834

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D10942/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D10942

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -3540,22 +3540,23 @@
             msg = "# Making python executable in test path a symlink to '%s'"
             msg %= sysexecutable
             vlog(msg)
-            mypython = os.path.join(self._tmpbindir, pyexename)
-            try:
-                if os.readlink(mypython) == sysexecutable:
-                    return
-                os.unlink(mypython)
-            except OSError as err:
-                if err.errno != errno.ENOENT:
-                    raise
-            if self._findprogram(pyexename) != sysexecutable:
+            for pyexename in [pyexename]:
+                mypython = os.path.join(self._tmpbindir, pyexename)
                 try:
-                    os.symlink(sysexecutable, mypython)
-                    self._createdfiles.append(mypython)
+                    if os.readlink(mypython) == sysexecutable:
+                        continue
+                    os.unlink(mypython)
                 except OSError as err:
-                    # child processes may race, which is harmless
-                    if err.errno != errno.EEXIST:
+                    if err.errno != errno.ENOENT:
                         raise
+                if self._findprogram(pyexename) != sysexecutable:
+                    try:
+                        os.symlink(sysexecutable, mypython)
+                        self._createdfiles.append(mypython)
+                    except OSError as err:
+                        # child processes may race, which is harmless
+                        if err.errno != errno.EEXIST:
+                            raise
         else:
             # Windows doesn't have `python3.exe`, and MSYS cannot understand the
             # reparse point with that name provided by Microsoft.  Create a



To: marmoute, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210706/3831e5cb/attachment-0002.html>


More information about the Mercurial-patches mailing list