Beispiel #1
0
def test_run_script(is_library, tmpdir):
    build_dir = Path(tmpdir.mkdir("build"))
    src_dir = Path(tmpdir.mkdir("build/package_name"))
    script = "touch out.txt"
    build_metadata = {"script": script, "library": is_library}
    with buildpkg.BashRunnerWithSharedEnvironment() as shared_env:
        buildpkg.run_script(build_dir, src_dir, build_metadata, shared_env)
        assert (src_dir / "out.txt").exists()
Beispiel #2
0
def test_run_script_environment(tmpdir):
    build_dir = Path(tmpdir.mkdir("build"))
    src_dir = Path(tmpdir.mkdir("build/package_name"))
    script = "export A=2"
    build_metadata = {"script": script, "library": False}
    with buildpkg.BashRunnerWithSharedEnvironment() as shared_env:
        shared_env.env.pop("A", None)
        buildpkg.run_script(build_dir, src_dir, build_metadata, shared_env)
        assert shared_env.env["A"] == "2"
Beispiel #3
0
def test_run_script(is_library, tmpdir):
    build_dir = Path(tmpdir.mkdir("build"))
    src_dir = Path(tmpdir.mkdir("build/package_name"))
    script = "touch out.txt"
    pkg = {"build": {"script": script, "library": is_library}}
    buildpkg.run_script(build_dir, src_dir, pkg)
    assert (src_dir / "out.txt").exists()
    if is_library:
        assert (build_dir / ".packaged").exists()
    else:
        assert not (build_dir / ".packaged").exists()