Ejemplo n.º 1
0
def test_all_dependency(cli, datafiles):
    project = os.path.join(str(datafiles), "dependencies1")

    elements = cli.get_pipeline(project, ["alldep.bst"], scope="build")
    assert elements == ["firstdep.bst"]

    elements = cli.get_pipeline(project, ["alldep.bst"], scope="run")
    assert elements == ["firstdep.bst", "alldep.bst"]
Ejemplo n.º 2
0
def test_list_overlap(cli, datafiles):
    project = os.path.join(str(datafiles), "dependencies1")

    # Check that dependencies get merged
    rundeps = cli.get_pipeline(project, ["list-overlap.bst"], scope="run")
    assert "firstdep.bst" in rundeps
    builddeps = cli.get_pipeline(project, ["list-overlap.bst"], scope="build")
    assert "firstdep.bst" in builddeps
Ejemplo n.º 3
0
def test_runtime_dependency(cli, datafiles):
    project = os.path.join(str(datafiles), "dependencies1")
    elements = cli.get_pipeline(project, ["runtimedep.bst"], scope="build")

    # FIXME: The empty line should probably never happen here when there are no results.
    assert elements == [""]
    elements = cli.get_pipeline(project, ["runtimedep.bst"], scope="run")
    assert elements == ["firstdep.bst", "runtimedep.bst"]
Ejemplo n.º 4
0
def test_merge(cli, datafiles, target):
    project = os.path.join(str(datafiles), "dependencies2")

    # Test both build and run scopes, showing that the two dependencies
    # have been merged and the run-build.bst is both a runtime and build
    # time dependency, and is not loaded twice into the build graph.
    #
    element_list = cli.get_pipeline(project, [target], scope="build")
    assert element_list == ["run-build.bst"]

    element_list = cli.get_pipeline(project, [target], scope="run")
    assert element_list == ["run-build.bst", target]
Ejemplo n.º 5
0
def test_scope_build_of_child(cli, datafiles):
    project = os.path.join(str(datafiles), "dependencies2")
    elements = ["target.bst"]

    element_list = cli.get_pipeline(project, elements, scope="build")

    # First pass, lets check dep-two
    element = element_list[2]

    # Pass two, let's look at these
    element_list = cli.get_pipeline(project, [element], scope="build")

    assert element_list == ["run-build.bst", "build.bst"]
Ejemplo n.º 6
0
def test_list_dependencies_combined(cli, datafiles):
    project = os.path.join(str(datafiles), "dependencies1")

    # Check that runtime deps get combined
    rundeps = cli.get_pipeline(project, ["list-combine.bst"], scope="run")
    assert "firstdep.bst" not in rundeps
    assert "seconddep.bst" in rundeps
    assert "thirddep.bst" in rundeps

    # Check that build deps get combined
    builddeps = cli.get_pipeline(project, ["list-combine.bst"], scope="build")
    assert "firstdep.bst" in builddeps
    assert "seconddep.bst" not in builddeps
    assert "thirddep.bst" in builddeps
Ejemplo n.º 7
0
def test_scope_build(cli, datafiles):
    project = os.path.join(str(datafiles), "dependencies2")
    elements = ["target.bst"]

    element_list = cli.get_pipeline(project, elements, scope="build")

    assert element_list == ["dep-one.bst", "run.bst", "dep-two.bst"]
Ejemplo n.º 8
0
def test_show_except(cli, datafiles, targets, exceptions, expected):
    basedir = str(datafiles)
    results = cli.get_pipeline(basedir,
                               targets,
                               except_=exceptions,
                               scope="all")
    if results != expected:
        raise AssertionError(
            "Expected elements:\n{}\nInstead received elements:\n{}".format(
                expected, results))
Ejemplo n.º 9
0
def test_tar_show(cli, tmpdir, datafiles):
    project = os.path.join(str(datafiles), "use-repo")

    # Create the repo from 'baserepo' subdir
    repo = create_repo("tar", str(tmpdir))
    ref = repo.create(os.path.join(project, "baserepo"))

    # Write out junction element with tar source
    element = {"kind": "junction", "sources": [repo.source_config(ref=ref)]}
    _yaml.roundtrip_dump(element, os.path.join(project, "base.bst"))

    # Check that bst show succeeds with implicit subproject fetching and the
    # pipeline includes the subproject element
    element_list = cli.get_pipeline(project, ["target.bst"])
    assert "base.bst:target.bst" in element_list
Ejemplo n.º 10
0
def test_no_recurse(cli, datafiles):
    project = os.path.join(str(datafiles), "dependencies2")
    elements = ["target.bst"]

    # We abuse the 'plan' scope here to ensure that we call
    # element.dependencies() with recurse=False - currently, no `bst
    # show` option does this directly.
    element_list = cli.get_pipeline(project, elements, scope="plan")

    assert element_list == [
        "build-build.bst",
        "run-build.bst",
        "build.bst",
        "dep-one.bst",
        "run.bst",
        "dep-two.bst",
        "target.bst",
    ]
Ejemplo n.º 11
0
def test_dependency_dict(cli, datafiles):
    project = os.path.join(str(datafiles), "dependencies1")
    elements = cli.get_pipeline(project, ["target-depdict.bst"])
    assert elements == ["firstdep.bst", "target-depdict.bst"]
Ejemplo n.º 12
0
def test_shared_dependency(cli, datafiles):
    project = os.path.join(str(datafiles), "dependencies1")

    elements = cli.get_pipeline(project, ["shareddeptarget.bst"])
    assert elements == ["firstdep.bst", "shareddep.bst", "shareddeptarget.bst"]
Ejemplo n.º 13
0
def test_list_runtime_dependency(cli, datafiles):
    project = os.path.join(str(datafiles), "dependencies1")

    # Check that the pipeline includes the runtime dependency
    deps = cli.get_pipeline(project, ["runtimedep-list.bst"], scope="run")
    assert "firstdep.bst" in deps