コード例 #1
0
ファイル: test_wpt.py プロジェクト: yunuem118/servo
def manifest_dir():
    try:
        path = tempfile.mkdtemp()
        shutil.copyfile(get_persistent_manifest_path(),
                        os.path.join(path, "MANIFEST.json"))
        yield path
    finally:
        utils.rmtree(path)
コード例 #2
0
ファイル: test_install.py プロジェクト: svgeesus/wpt
def test_install_firefox():
    if sys.platform == "darwin":
        fx_path = os.path.join(wpt.localpaths.repo_root, wpt.venv_dir(),
                               "browsers", "nightly", "Firefox Nightly.app")
    else:
        fx_path = os.path.join(wpt.localpaths.repo_root, wpt.venv_dir(),
                               "browsers", "nightly", "firefox")
    if os.path.exists(fx_path):
        utils.rmtree(fx_path)
    with pytest.raises(SystemExit) as excinfo:
        wpt.main(argv=["install", "firefox", "browser", "--channel=nightly"])
    assert excinfo.value.code == 0
    assert os.path.exists(fx_path)
    utils.rmtree(fx_path)
コード例 #3
0
ファイル: test_wpt.py プロジェクト: yunuem118/servo
def temp_test():
    os.makedirs("../../.tools-tests")
    test_count = {"value": 0}

    def make_test(body):
        test_count["value"] += 1
        test_name = ".tools-tests/%s.html" % test_count["value"]
        test_path = "../../%s" % test_name

        with open(test_path, "w") as handle:
            handle.write("""
            <!DOCTYPE html>
            <script src="/resources/testharness.js"></script>
            <script src="/resources/testharnessreport.js"></script>
            <script>%s</script>
            """ % body)

        return test_name

    yield make_test

    utils.rmtree("../../.tools-tests")
コード例 #4
0
ファイル: test_install.py プロジェクト: vplentinax/wpt
def test_install_chromium():
    dest = os.path.join(wpt.localpaths.repo_root, wpt.venv_dir(), "browsers",
                        "nightly")
    if sys.platform == "win32":
        chromium_path = os.path.join(dest, "chrome-win")
    elif sys.platform == "darwin":
        chromium_path = os.path.join(dest, "chrome-mac")
    else:
        chromium_path = os.path.join(dest, "chrome-linux")

    if os.path.exists(chromium_path):
        utils.rmtree(chromium_path)
    with pytest.raises(SystemExit) as excinfo:
        wpt.main(argv=["install", "chrome", "browser", "--channel=nightly"])
    assert excinfo.value.code == 0
    assert os.path.exists(chromium_path)

    chrome = browser.Chrome(logging.getLogger("Chrome"))
    binary = chrome.find_nightly_binary(dest)
    assert binary is not None and os.path.exists(binary)

    utils.rmtree(chromium_path)