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

--HG--
extra : rebase_source : a000d27774f224d37f981d6683d96c65846b8a32
This commit is contained in:
Andrew Halberstadt 2018-04-12 12:03:16 -04:00
Родитель f7d6e8df78
Коммит bcf900bf38
1 изменённых файлов: 13 добавлений и 5 удалений

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

@ -15,10 +15,14 @@ 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 = """
@ -29,9 +33,10 @@ environment variable is required.
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)
@ -113,3 +118,6 @@ def binary():
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']