How to use the requirementslib.models.lockfile.Lockfile.lockfile_from_pipfile function in requirementslib

To help you get started, we’ve selected a few requirementslib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sarugaku / requirementslib / tests / unit / test_pipfile.py View on Github external
expected_len = dev_len if dev else default_len
        if dev and not only:
            expected_len += default_len
        assert len(pipfile.get_deps(dev=dev, only=only)) == expected_len
    if default_len > 0:
        assert pipfile["packages"] is not None
    if dev_len > 0:
        assert pipfile["dev-packages"] is not None
    if (default_len + dev_len) > 0:
        assert "requests" in pipfile
    assert pipfile.path.as_posix() == pipfile_path.absolute().as_posix()
    assert pipfile.requires_python == requires_python
    assert pipfile.allow_prereleases is True
    assert isinstance(pipfile.build_requires, list)
    assert pipfile.build_backend is not None
    lockfile_from_pipfile = Lockfile.lockfile_from_pipfile(pipfile.path.as_posix())
    assert lockfile_from_pipfile is not None
    pipfile["dev-packages"]["six"] = "*"
    pipfile.write()
github sarugaku / requirementslib / tests / unit / test_lockfile.py View on Github external
def test_failure(pipfile_dir):
    pipfile_location = pipfile_dir / "Pipfile.both-sections"
    with pytest.raises(PipfileNotFound):
        Lockfile.lockfile_from_pipfile("some_fake_pipfile_path")
    with pytest.raises(MissingParameter):
        Lockfile.from_data(None, None)
    with pytest.raises(MissingParameter):
        Lockfile.from_data(pipfile_location.as_posix(), None)
    with pytest.raises(MissingParameter):
        Lockfile.from_data(None, {})
    with pytest.raises(TypeError):
        Lockfile.from_data(pipfile_location.as_posix(), True)