зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1335873 - Ignore MozconfigFindException when looking for a mozinfo.json, r=maja_zf
This gets raised when trying to run the marionette-harness python tests without an objdir. It's safe to ignore because mozinfo.json will still be found via the 'dirs' variable which gets passed in from the marionette harness. MozReview-Commit-ID: Ata99evHxbd --HG-- extra : rebase_source : 6e3910667146b9caf0a9abe9a707b34627ba272b
This commit is contained in:
Родитель
2a9fbc500e
Коммит
9e94d21674
|
@ -218,6 +218,7 @@ def find_and_update_from_json(*dirs):
|
|||
# First, see if we're in an objdir
|
||||
try:
|
||||
from mozbuild.base import MozbuildObject, BuildEnvironmentNotFoundException
|
||||
from mozbuild.mozconfig import MozconfigFindException
|
||||
build = MozbuildObject.from_environment()
|
||||
json_path = _os.path.join(build.topobjdir, "mozinfo.json")
|
||||
if _os.path.isfile(json_path):
|
||||
|
@ -225,7 +226,7 @@ def find_and_update_from_json(*dirs):
|
|||
return json_path
|
||||
except ImportError:
|
||||
pass
|
||||
except BuildEnvironmentNotFoundException:
|
||||
except (BuildEnvironmentNotFoundException, MozconfigFindException):
|
||||
pass
|
||||
|
||||
for d in dirs:
|
||||
|
|
|
@ -83,7 +83,13 @@ class TestMozinfo(unittest.TestCase):
|
|||
m = mock.MagicMock()
|
||||
# Mock the value of MozbuildObject.from_environment().topobjdir.
|
||||
m.MozbuildObject.from_environment.return_value.topobjdir = self.tempdir
|
||||
with mock.patch.dict(sys.modules, {"mozbuild": m, "mozbuild.base": m}):
|
||||
|
||||
mocked_modules = {
|
||||
"mozbuild": m,
|
||||
"mozbuild.base": m,
|
||||
"mozbuild.mozconfig": m,
|
||||
}
|
||||
with mock.patch.dict(sys.modules, mocked_modules):
|
||||
self.assertEqual(mozinfo.find_and_update_from_json(), j)
|
||||
self.assertEqual(mozinfo.info["foo"], "123456")
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче