Skip to content

Commit

Permalink
Windows,python tests: fine if $JAVA_HOME is empty
Browse files Browse the repository at this point in the history
It's no longer fatal for the test if $JAVA_HOME
environment variable is unset.

Before this fix the test was crashing if JAVA_HOME
was not set.

RELNOTES: none
PiperOrigin-RevId: 203350738
  • Loading branch information
laszlocsomor authored and Copybara-Service committed Jul 5, 2018
1 parent f11c6bc commit 2282728
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/test/py/bazel/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def GetEnv(name, default=None):
"""
value = os.getenv(name, '__undefined_envvar__')
if value == '__undefined_envvar__':
if default:
if default is not None:
return default
raise EnvVarUndefinedError(name)
return value
Expand Down Expand Up @@ -357,9 +357,10 @@ def _EnvMap(self, env_remove=None, env_add=None):
'BAZEL_SH':
TestBase.GetEnv('BAZEL_SH',
'c:\\tools\\msys64\\usr\\bin\\bash.exe'),
'JAVA_HOME':
TestBase.GetEnv('JAVA_HOME'),
}
java_home = TestBase.GetEnv('JAVA_HOME', '')
if java_home:
env['JAVA_HOME'] = java_home
else:
env = {'HOME': os.path.join(self._temp, 'home')}

Expand Down

0 comments on commit 2282728

Please sign in to comment.