Bug 1267454 - Set up a mock-able import for os.environ in configure tests. r=glandium

MozReview-Commit-ID: AtkkLC5xEip
This commit is contained in:
Chris Manchester 2016-05-12 11:55:57 -07:00
parent 463051b415
commit a91638058c

View File

@ -4,6 +4,7 @@
from __future__ import absolute_import, print_function, unicode_literals
import copy
import errno
import os
import subprocess
@ -74,6 +75,7 @@ class ConfigureTestSandbox(ConfigureSandbox):
environ['CONFIG_SHELL'] = mozpath.abspath('/bin/sh')
self._subprocess_paths[environ['CONFIG_SHELL']] = self.shell
paths.append(environ['CONFIG_SHELL'])
self._environ = copy.copy(environ)
vfs = ConfigureTestVFS(paths)
@ -107,6 +109,9 @@ class ConfigureTestSandbox(ConfigureSandbox):
Popen=self.Popen,
)
if what == 'os.environ':
return self._environ
return super(ConfigureTestSandbox, self)._get_one_import(what)
def which(self, command, path=None):