コード例 #1
0
def test_get_coverage_artifacts(tmpdir, fake_artifacts):
    def add_dir(files):
        return set([os.path.join(tmpdir.strpath, f) for f in files])

    a = ArtifactsHandler([])
    a.artifacts = fake_artifacts
    assert set(a.get()) == add_dir(FILES)
    assert set(a.get(suite="mochitest")) == add_dir(
        [
            "windows_mochitest-1_code-coverage-jsvm.info",
            "linux_mochitest-2_code-coverage-grcov.zip",
        ]
    )
    assert set(a.get(chunk="xpcshell-7")) == add_dir(
        [
            "windows_xpcshell-7_code-coverage-jsvm.info",
            "linux_xpcshell-7_code-coverage-grcov.zip",
        ]
    )
    assert set(a.get(chunk="cppunit")) == add_dir(
        ["windows_cppunit_code-coverage-grcov.zip"]
    )
    assert set(a.get(platform="windows")) == add_dir(
        [
            "windows_mochitest-1_code-coverage-jsvm.info",
            "windows_xpcshell-7_code-coverage-jsvm.info",
            "windows_cppunit_code-coverage-grcov.zip",
        ]
    )
    assert set(a.get(platform="linux", chunk="xpcshell-7")) == add_dir(
        ["linux_xpcshell-7_code-coverage-grcov.zip"]
    )

    with pytest.raises(Exception, match="suite and chunk can't both have a value"):
        a.get(chunk="xpcshell-7", suite="mochitest")
コード例 #2
0
def test_get_chunks(fake_artifacts):
    a = ArtifactsHandler([])
    a.artifacts = fake_artifacts
    assert a.get_chunks("windows") == {"mochitest-1", "xpcshell-7", "cppunit"}
    assert a.get_chunks("linux") == {
        "mochitest-2",
        "xpcshell-3",
        "xpcshell-7",
        "firefox-ui-functional-remote",
    }
コード例 #3
0
def test_get_combinations(tmpdir, fake_artifacts):
    def add_dir(files):
        return [os.path.join(tmpdir.strpath, f) for f in files]

    a = ArtifactsHandler([])
    a.artifacts = fake_artifacts
    assert dict(a.get_combinations()) == {
        ("all", "all"): add_dir(
            [
                "windows_mochitest-1_code-coverage-jsvm.info",
                "linux_mochitest-2_code-coverage-grcov.zip",
                "windows_xpcshell-7_code-coverage-jsvm.info",
                "linux_xpcshell-7_code-coverage-grcov.zip",
                "linux_xpcshell-3_code-coverage-grcov.zip",
                "windows_cppunit_code-coverage-grcov.zip",
                "linux_firefox-ui-functional-remote_code-coverage-jsvm.info",
            ]
        ),
        ("linux", "all"): add_dir(
            [
                "linux_firefox-ui-functional-remote_code-coverage-jsvm.info",
                "linux_mochitest-2_code-coverage-grcov.zip",
                "linux_xpcshell-7_code-coverage-grcov.zip",
                "linux_xpcshell-3_code-coverage-grcov.zip",
            ]
        ),
        ("windows", "all"): add_dir(
            [
                "windows_cppunit_code-coverage-grcov.zip",
                "windows_mochitest-1_code-coverage-jsvm.info",
                "windows_xpcshell-7_code-coverage-jsvm.info",
            ]
        ),
        ("all", "cppunit"): add_dir(["windows_cppunit_code-coverage-grcov.zip"]),
        ("windows", "cppunit"): add_dir(["windows_cppunit_code-coverage-grcov.zip"]),
        ("all", "firefox-ui-functional"): add_dir(
            ["linux_firefox-ui-functional-remote_code-coverage-jsvm.info"]
        ),
        ("linux", "firefox-ui-functional"): add_dir(
            ["linux_firefox-ui-functional-remote_code-coverage-jsvm.info"]
        ),
        ("all", "mochitest"): add_dir(
            [
                "windows_mochitest-1_code-coverage-jsvm.info",
                "linux_mochitest-2_code-coverage-grcov.zip",
            ]
        ),
        ("linux", "mochitest"): add_dir(["linux_mochitest-2_code-coverage-grcov.zip"]),
        ("windows", "mochitest"): add_dir(
            ["windows_mochitest-1_code-coverage-jsvm.info"]
        ),
        ("all", "xpcshell"): add_dir(
            [
                "windows_xpcshell-7_code-coverage-jsvm.info",
                "linux_xpcshell-7_code-coverage-grcov.zip",
                "linux_xpcshell-3_code-coverage-grcov.zip",
            ]
        ),
        ("linux", "xpcshell"): add_dir(
            [
                "linux_xpcshell-7_code-coverage-grcov.zip",
                "linux_xpcshell-3_code-coverage-grcov.zip",
            ]
        ),
        ("windows", "xpcshell"): add_dir(
            ["windows_xpcshell-7_code-coverage-jsvm.info"]
        ),
    }