run-tests: factor appdata out
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 02 Jul 2021 22:50:43 +0200
changeset 47496 810022009cee
parent 47495 38f00245edb3
child 47497 50829b9149b0
run-tests: factor appdata out This is a gratuitous readability change. Differential Revision: https://phab.mercurial-scm.org/D10940
tests/run-tests.py
--- a/tests/run-tests.py	Fri Jul 02 22:48:47 2021 +0200
+++ b/tests/run-tests.py	Fri Jul 02 22:50:43 2021 +0200
@@ -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',
                     )