Ejemplo n.º 1
0
def test_should_cache_git_sha(script, tmpdir):
    repo_path = _create_test_package(script, name="mypkg")
    commit = script.run(
        "git", "rev-parse", "HEAD", cwd=repo_path
    ).stdout.strip()

    # a link referencing a sha should be cached
    url = "git+https://g.c/o/r@" + commit + "#egg=mypkg"
    req = ReqMock(link=Link(url), source_dir=repo_path)
    assert wheel_builder.should_cache(
        req, check_binary_allowed=lambda r: True,
    )

    # a link not referencing a sha should not be cached
    url = "git+https://g.c/o/r@master#egg=mypkg"
    req = ReqMock(link=Link(url), source_dir=repo_path)
    assert not wheel_builder.should_cache(
        req, check_binary_allowed=lambda r: True,
    )
Ejemplo n.º 2
0
def test_should_cache(req, disallow_binaries, expected):
    def check_binary_allowed(req):
        return not disallow_binaries

    should_cache = wheel_builder.should_cache(req, check_binary_allowed)
    if not wheel_builder.should_build(
            req, need_wheel=False, check_binary_allowed=check_binary_allowed):
        # never cache if pip install (need_wheel=False) would not have built)
        assert not should_cache
    assert should_cache is expected