summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-02-28 07:46:52 -0800
committerRich Trott <rtrott@gmail.com>2017-03-02 10:27:52 -0800
commit22d7dc221211678dd1d5ce30d298791df7dfd956 (patch)
treed7319c500ceddd8beed304fb178a9d4449ded090
parent172be50fe173ee24cdfec8b5cb2b54b28f74557a (diff)
downloadandroid-node-v8-22d7dc221211678dd1d5ce30d298791df7dfd956.tar.gz
android-node-v8-22d7dc221211678dd1d5ce30d298791df7dfd956.tar.bz2
android-node-v8-22d7dc221211678dd1d5ce30d298791df7dfd956.zip
tools: remove NODE_PATH from environment for tests
Unset NODE_PATH environment variable when running tests. On Ubuntu 16.04, some users experience test failures due to internal libraries being installed in /usr/lib/nodejs/internal and NODE_PATH including /usr/lib/nodejs. Tests that expect internal libraries to be off limits without the --expose-internals flag will fail in this situation. Currently, those tests are test/parallel/test-repl.js and test/parallel/test-internal-modules.js. This situation seems to (probably) be caused by some not-entirely-uncommon package that gets installed. Regardless, tests should ignore the user's NODE_PATH. (NODE_PATH is tested in test/parallel/test-module-globalpaths-nodepath.js and test/parallel/test-require-dot.js.) PR-URL: https://github.com/nodejs/node/pull/11612 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Bryan English <bryan@bryanenglish.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Refs: https://twitter.com/trott/status/835729396900061184
-rwxr-xr-xtools/test.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/test.py b/tools/test.py
index f46b13fa30..d6715937b6 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -702,8 +702,13 @@ def Execute(args, context, timeout=None, env={}, faketty=False):
fd_in = 0
pty_out = None
- # Extend environment
env_copy = os.environ.copy()
+
+ # Remove NODE_PATH
+ if "NODE_PATH" in env_copy:
+ del env_copy["NODE_PATH"]
+
+ # Extend environment
for key, value in env.iteritems():
env_copy[key] = value