mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Get packages for pipenv check from the target venv.
This commit is contained in:
@@ -2959,6 +2959,16 @@ def do_check(
|
||||
if safety_project:
|
||||
options.append(f"--project={safety_project}")
|
||||
|
||||
target_venv_packages = run_command(
|
||||
_cmd + ["-m", "pip", "list", "--format=freeze"], is_verbose=project.s.is_verbose()
|
||||
)
|
||||
|
||||
temp_requirements = tempfile.NamedTemporaryFile(prefix=f"{project.virtualenv_name}_")
|
||||
temp_requirements.write(target_venv_packages.stdout.strip().encode("utf-8"))
|
||||
temp_requirements.seek(0)
|
||||
|
||||
options.extend(["--file", temp_requirements.name])
|
||||
|
||||
cmd = _cmd + [safety_path, "check"] + options
|
||||
|
||||
if db:
|
||||
@@ -3044,6 +3054,8 @@ def do_check(
|
||||
|
||||
cli(prog_name="pipenv")
|
||||
|
||||
temp_requirements.close()
|
||||
|
||||
|
||||
def do_graph(project, bare=False, json=False, json_tree=False, reverse=False):
|
||||
import json as jsonlib
|
||||
|
||||
@@ -140,7 +140,6 @@ def test_pipenv_graph_reverse(pipenv_instance_private_pypi):
|
||||
|
||||
@pytest.mark.cli
|
||||
@pytest.mark.needs_internet(reason='required by check')
|
||||
@pytest.mark.skip("Safety 2 ends up scanning the project virtualenv and not the instance created by this test.")
|
||||
def test_pipenv_check(pipenv_instance_private_pypi):
|
||||
with pipenv_instance_private_pypi() as p:
|
||||
c = p.pipenv('install pyyaml')
|
||||
|
||||
Reference in New Issue
Block a user