# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/.
import io import json import os from argparse import Namespace
import mozinfo import pytest from manifestparser import TestManifest, expression from moztest.selftest.fixtures import binary_fixture, setup_test_harness # noqa
here = os.path.abspath(os.path.dirname(__file__))
setup_args = [os.path.join(here, "files"), "mochitest", "testing/mochitest"]
@pytest.fixture(scope="function") def runtests(setup_test_harness, binary, parser, request): """Creates an easy to use entry point into the mochitest harness.
:returns: A function with the signature `*tests, **opts`. Each test is a file name
(relative to the `files` dir). At least one is required. The opts are
used to override the default mochitest options, they are optional. """
flavor = "plain" if"flavor"in request.fixturenames:
flavor = request.getfixturevalue("flavor")
def normalize(test): if isinstance(test, str):
test = [test] return [
{ "name": t, "relpath": t, "path": os.path.join(test_root, t), # add a dummy manifest file because mochitest expects it "manifest": os.path.join(test_root, manifest_name), "manifest_relpath": manifest_name, "skip-if": runFailures,
} for t in test
]
def inner(*tests, **opts): assert len(tests) > 0
# Inject a TestManifest in the runtests option if one # has not been already included by the caller. ifnot isinstance(options["manifestFile"], TestManifest):
manifest = TestManifest()
options["manifestFile"] = manifest # pylint --py3k: W1636
manifest.tests.extend(list(map(normalize, tests))[0])
options.update(opts)
result = runtests.run_test_harness(parser, Namespace(**options))
out = json.loads("[" + ",".join(buf.getvalue().splitlines()) + "]")
buf.close() return result, out
skip_mozinfo = request.node.get_closest_marker("skip_mozinfo") if skip_mozinfo:
value = skip_mozinfo.args[0] if expression.parse(value, **mozinfo.info):
pytest.skip("skipped due to mozinfo match: \n{}".format(value))
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.