Skip to content

Commit

Permalink
[WIP] rework this test
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul committed Mar 18, 2023
1 parent a788178 commit cbed7f9
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions tests/functional/test_show.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import os
import pathlib
import re

from pip import __version__
from pip._internal.commands.show import search_packages_info
from pip._internal.utils.unpacking import untar_file
from tests.lib import PipTestEnvironment, TestData, create_test_package_with_setup


Expand Down Expand Up @@ -53,40 +51,6 @@ def test_show_with_files_from_wheel(script: PipTestEnvironment, data: TestData)
assert f" simpledist{os.sep}__init__.py" in lines[6:]


def test_show_with_files_from_legacy(
tmp_path: pathlib.Path, script: PipTestEnvironment, data: TestData
) -> None:
"""
Test listing files in the show command (legacy installed-files.txt).
"""
# Since 'pip install' now always tries to build a wheel from sdist, it
# cannot properly generate a setup. The legacy code path is basically
# 'setup.py install' plus installed-files.txt, which we manually generate.
source_dir = tmp_path.joinpath("unpacked-sdist")
setuptools_record = tmp_path.joinpath("installed-record.txt")
untar_file(os.fspath(data.packages.joinpath("simple-1.0.tar.gz")), str(source_dir))
script.run(
"python",
"setup.py",
"install",
"--single-version-externally-managed",
"--record",
str(setuptools_record),
cwd=source_dir,
)
write_installed_files_from_setuptools_record(
setuptools_record.read_text().splitlines(),
root=None,
req_description="simple==1.0",
)

result = script.pip("show", "--files", "simple")
lines = result.stdout.splitlines()
assert "Cannot locate RECORD or installed-files.txt" not in lines[6], lines[6]
assert re.search(r"Files:\n( .+\n)+", result.stdout)
assert f" simple{os.sep}__init__.py" in lines[6:]


def test_missing_argument(script: PipTestEnvironment) -> None:
"""
Test show command with no arguments.
Expand Down

0 comments on commit cbed7f9

Please sign in to comment.