Skip to content

Commit

Permalink
Hack envvar override when running tests in-process.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpakkane committed Jul 8, 2019
1 parent b9a771f commit 380dced
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions run_unittests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1315,8 +1315,14 @@ def run_tests(self, *, inprocess=False, override_envvars=None):
self._run(self.test_command, workdir=self.builddir, override_envvars=override_envvars)
else:
if override_envvars is not None:
raise RuntimeError('Can not combine inprocess and override_envvars.')
run_mtest_inprocess(['-C', self.builddir])
old_envvars = os.environ.copy()
os.environ.update(override_envvars)
try:
run_mtest_inprocess(['-C', self.builddir])
finally:
if override_envvars is not None:
os.environ.clear()
os.environ.update(old_envvars)

def install(self, *, use_destdir=True, override_envvars=None):
if self.backend is not Backend.ninja:
Expand Down

0 comments on commit 380dced

Please sign in to comment.