1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Fix all failing tests

This commit is contained in:
ofrinevo 2019-09-02 19:41:51 +03:00
parent 35c2161785
commit bc65d55d8b
5 changed files with 18 additions and 8 deletions

View file

@ -141,7 +141,7 @@ def print_results(distributions, list_files=False, verbose=False):
canonical_name = canonicalize_name(name) canonical_name = canonicalize_name(name)
required_by = [ required_by = [
pkg.project_name for pkg in pkg_resources.working_set pkg.project_name for pkg in pkg_resources.working_set
if canonical_name in [required.name for required in pkg.requires()] if canonical_name in [canonicalize_name(required.name) for required in pkg.requires()]
] ]
write_output("Name: %s", name) write_output("Name: %s", name)

View file

@ -0,0 +1,5 @@
from setuptools import setup
setup(name='Required_By_Capitalized',
version='1.0',
)

View file

@ -1,6 +1,6 @@
from setuptools import setup from setuptools import setup
setup(name='requires_Capitalized', setup(name='simple',
version='0.1', version='1.0',
install_requires=['simple==1.0'] install_requires=['required_by_Capitalized==1.0']
) )

View file

@ -205,7 +205,7 @@ def test_package_name_is_canonicalized(script, data):
assert underscore_upper_show_result.stdout == dash_show_result.stdout assert underscore_upper_show_result.stdout == dash_show_result.stdout
def test_show_required_by_packages_simple(script, data): def test_show_required_by_packages_basic(script, data):
""" """
Test that installed packages that depend on this package are shown Test that installed packages that depend on this package are shown
""" """
@ -238,19 +238,23 @@ def test_show_required_by_packages_capitalized(script, data):
assert 'Required-by: Requires-Capitalized' in lines assert 'Required-by: Requires-Capitalized' in lines
def test_show_required_by_with_mixed_capitalization(script, data): def test_show_required_by_packages_requiring_capitalized(script, data):
""" """
Test that the installed packages which depend on a package are shown Test that the installed packages which depend on a package are shown
where the package has a name with a mix of where the package has a name with a mix of
lower and upper case letters lower and upper case letters
""" """
required_package_path = os.path.join(data.src, 'required_by_capitalized')
script.pip(
'install', '--no-index', '-f', data.find_links, required_package_path
)
editable_path = os.path.join(data.src, 'required_by_mixed_capitalization') editable_path = os.path.join(data.src, 'required_by_mixed_capitalization')
script.pip( script.pip(
'install', '--no-index', '-f', data.find_links, editable_path 'install', '--no-index', '-f', data.find_links, editable_path
) )
result = script.pip('show', 'Requires_CapitalizeD') result = script.pip('show', 'Required_By_Capitalized')
lines = result.stdout.splitlines() lines = result.stdout.splitlines()
assert 'Name: Requires-Capitalized' in lines assert 'Name: Required-By-Capitalized' in lines
assert 'Required-by: simple' in lines assert 'Required-by: simple' in lines