Bug 1292439 - Use a fake _winreg module during tests. r=chmanchester

While on automation, there is no MSVC to find through the registry, the
story is different on local builds, and that can interfere with tests.

Specifically, it breaks test_toolchain_configure.py because it's not
expecting the registry to provide a valid path to an almost valid
compiler, and then fails because that compiler doesn't match the
expected target CPU.

And because build/moz.configure/toolchain.configure also affects the PATH
environment variable, subsequent tests end up failing even earlier
because executing the empty mozconfig with the modified environment then
fails because of the unicode value of PATH.

This change implements enough of _winreg to make the get_registry_values
function return nothing.

--HG--
extra : rebase_source : f70e40ddabaed1197f6cddce67832bb112f1969d
This commit is contained in:
Mike Hommey 2016-08-05 14:16:35 +09:00
Родитель 035d0ca1a0
Коммит 69e768cba4
1 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -145,6 +145,15 @@ class ConfigureTestSandbox(ConfigureSandbox):
),
)
if what == '_winreg':
def OpenKey(*args, **kwargs):
raise WindowsError()
return ReadOnlyNamespace(
HKEY_LOCAL_MACHINE=0,
OpenKey=OpenKey,
)
return super(ConfigureTestSandbox, self)._get_one_import(what)
def create_unicode_buffer(self, *args, **kwargs):