From a91638058cffe09d668a95f3df11acd59c34d02a Mon Sep 17 00:00:00 2001 From: Chris Manchester Date: Thu, 12 May 2016 11:55:57 -0700 Subject: [PATCH] Bug 1267454 - Set up a mock-able import for os.environ in configure tests. r=glandium MozReview-Commit-ID: AtkkLC5xEip --- python/mozbuild/mozbuild/test/configure/common.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/mozbuild/mozbuild/test/configure/common.py b/python/mozbuild/mozbuild/test/configure/common.py index 03dc016ab085..0c7d73d30e2b 100644 --- a/python/mozbuild/mozbuild/test/configure/common.py +++ b/python/mozbuild/mozbuild/test/configure/common.py @@ -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):