[Commented On] D11035: run-tests: enforce the drive letter from `getcwd` to upper case

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Sat Jul 10 01:25:38 UTC 2021


baymax added a comment.
baymax updated this revision to Diff 29076.


  ✅ refresh by Heptapod after a successful CI run (🐙 💚)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11035?vs=29055&id=29076

BRANCH
  default

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

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

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
@@ -230,6 +230,18 @@
     osenvironb = os.environ
     getcwdb = os.getcwd
 
+if WINDOWS:
+    _getcwdb = getcwdb
+
+    def getcwdb():
+        cwd = _getcwdb()
+        if re.match(b'^[a-z]:', cwd):
+            # os.getcwd() is inconsistent on the capitalization of the drive
+            # letter, so adjust it.
+            cwd = cwd[0:1].upper() + cwd[1:]
+        return cwd
+
+
 # For Windows support
 wifexited = getattr(os, "WIFEXITED", lambda x: False)
 
@@ -3060,7 +3072,6 @@
 
     def _run(self, testdescs):
         testdir = getcwdb()
-        self._testdir = osenvironb[b'TESTDIR'] = getcwdb()
         # assume all tests in same folder for now
         if testdescs:
             pathname = os.path.dirname(testdescs[0]['path'])



To: marmoute, #hg-reviewers
Cc: mharbison72, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210710/47694a45/attachment-0002.html>


More information about the Mercurial-patches mailing list