Bug 1445944 - [moztest] Update shared test fixtures so they can work outside of mozilla-central r=rwood
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Thu, 12 Apr 2018 12:03:16 -0400
changeset 467466 92a5018d1ecfd58024a55a6d30348caf095aa7b7
parent 467465 50aeb30fd283f1f245a04e1e2861ebf028008d61
child 467467 eeb6b72619b6c696b6435128fd79d888ed86d221
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrwood
bugs1445944
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1445944 - [moztest] Update shared test fixtures so they can work outside of mozilla-central r=rwood This isn't strictly related to this bug, but it is a change made to mozbase in the raptor repo that is worth backporting here. Figured it's easiest to land it alongside the other mozbase backports. MozReview-Commit-ID: DW7I2zKZZNk
testing/mozbase/moztest/moztest/selftest/fixtures.py
--- a/testing/mozbase/moztest/moztest/selftest/fixtures.py
+++ b/testing/mozbase/moztest/moztest/selftest/fixtures.py
@@ -10,33 +10,38 @@ from __future__ import absolute_import
 import os
 import shutil
 import sys
 
 import mozfile
 import mozinstall
 import pytest
 import requests
-from mozbuild.base import MozbuildObject
 
 here = os.path.abspath(os.path.dirname(__file__))
-build = MozbuildObject.from_environment(cwd=here)
+
+try:
+    from mozbuild.base import MozbuildObject
+    build = MozbuildObject.from_environment(cwd=here)
+except ImportError:
+    build = None
 
 
 HARNESS_ROOT_NOT_FOUND = """
 Could not find test harness root. Either a build or the 'GECKO_INSTALLER_URL'
 environment variable is required.
 """.lstrip()
 
 
 def _get_test_harness(suite, install_dir):
     # Check if there is a local build
-    harness_root = os.path.join(build.topobjdir, '_tests', install_dir)
-    if os.path.isdir(harness_root):
-        return harness_root
+    if build:
+        harness_root = os.path.join(build.topobjdir, '_tests', install_dir)
+        if os.path.isdir(harness_root):
+            return harness_root
 
     # Check if it was previously set up by another test
     harness_root = os.path.join(os.environ['PYTHON_TEST_TMP'], 'tests', suite)
     if os.path.isdir(harness_root):
         return harness_root
 
     # Check if there is a test package to download
     if 'GECKO_INSTALLER_URL' in os.environ:
@@ -108,8 +113,11 @@ def binary():
             return mozinstall.get_binary(bindir, app_name=app)
         except Exception:
             pass
 
     if 'GECKO_INSTALLER_URL' in os.environ:
         bindir = mozinstall.install(
             os.environ['GECKO_INSTALLER_URL'], os.environ['PYTHON_TEST_TMP'])
         return mozinstall.get_binary(bindir, app_name='firefox')
+
+    if 'GECKO_BINARY_PATH' in os.environ:
+        return os.environ['GECKO_BINARY_PATH']