Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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)
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)
],
"version": "==3.0.4"
},
"requests": {
"path": ".",
"editable": true
}
}
}
""".strip()
)
)
loaded = Lockfile.load(lockfile.as_posix())
dump_to = pathlib_tmpdir.joinpath("new_lockfile")
dump_to.mkdir()
from_data = Lockfile.from_data(
dump_to.as_posix(), json.loads(lockfile.read_text()), meta_from_project=False
)
assert isinstance(loaded.dev_requirements[0], Requirement)
assert isinstance(loaded.dev_requirements_list[0], dict)
with cd(pathlib_tmpdir.as_posix()):
auto_detected_path = Lockfile()
assert (
auto_detected_path.path.absolute().as_posix()
== lockfile.absolute().as_posix()
)
assert auto_detected_path["develop-editable"]["requests"] is not None