D10940: run-tests: factor appdata out

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Fri Jul 2 22:37:52 UTC 2021


marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is a gratuitous readability change.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -3575,9 +3575,10 @@
             # not be in PATH by default.
             extra_paths = [exedir]
             vi = sys.version_info
-            if 'APPDATA' in os.environ:
+            appdata = os.environ.get('APPDATA')
+            if appdata is not None:
                 scripts_dir = os.path.join(
-                    os.environ['APPDATA'],
+                    appdata,
                     'Python',
                     'Python%d%d' % (vi[0], vi[1]),
                     'Scripts',
@@ -3585,7 +3586,7 @@
 
                 if vi.major == 2:
                     scripts_dir = os.path.join(
-                        os.environ['APPDATA'],
+                        appdata,
                         'Python',
                         'Scripts',
                     )



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list