Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Remove exhaustive file checks #7141

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 42 additions & 40 deletions tests/functional/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_download_if_requested(script):
'download', '-d', 'pip_downloads', 'INITools==0.1'
)
assert Path('scratch') / 'pip_downloads' / 'INITools-0.1.tar.gz' \
in result.files_created
in result.files_created2
assert script.site_packages / 'initools' not in result.files_created


Expand All @@ -33,11 +33,11 @@ def test_basic_download_setuptools(script):
"""
It should download (in the scratch path) and not install if requested.
"""
result = script.pip('download', 'setuptools')
setuptools_prefix = str(Path('scratch') / 'setuptools')
assert any(
path.startswith(setuptools_prefix) for path in result.files_created
)
result = script.pip('download', 'setuptools') # noqa
setuptools_prefix = str(Path('scratch') / 'setuptools') # noqa
# assert any(
# path.startswith(setuptools_prefix) for path in result.files_created
# )


def test_download_wheel(script, data):
Expand All @@ -52,7 +52,7 @@ def test_download_wheel(script, data):
)
assert (
Path('scratch') / 'meta-1.0-py2.py3-none-any.whl'
in result.files_created
in result.files_created2
)
assert script.site_packages / 'piptestpackage' not in result.files_created

Expand All @@ -69,7 +69,7 @@ def test_single_download_from_requirements_file(script):
result = script.pip(
'download', '-r', script.scratch_path / 'test-req.txt', '-d', '.',
)
assert Path('scratch') / 'INITools-0.1.tar.gz' in result.files_created
assert Path('scratch') / 'INITools-0.1.tar.gz' in result.files_created2
assert script.site_packages / 'initools' not in result.files_created


Expand All @@ -81,11 +81,12 @@ def test_basic_download_should_download_dependencies(script):
result = script.pip(
'download', 'Paste[openid]==1.7.5.1', '-d', '.'
)
assert Path('scratch') / 'Paste-1.7.5.1.tar.gz' in result.files_created
openid_tarball_prefix = str(Path('scratch') / 'python-openid-')
assert any(
path.startswith(openid_tarball_prefix) for path in result.files_created
)
assert Path('scratch') / 'Paste-1.7.5.1.tar.gz' in result.files_created2
openid_tarball_prefix = str(Path('scratch') / 'python-openid-') # noqa
# assert any(
# path.startswith(openid_tarball_prefix) for path in
# result.files_created
# )
assert script.site_packages / 'openid' not in result.files_created


Expand All @@ -99,7 +100,7 @@ def test_download_wheel_archive(script, data):
'download', wheel_path,
'-d', '.', '--no-deps'
)
assert Path('scratch') / wheel_filename in result.files_created
assert Path('scratch') / wheel_filename in result.files_created2


def test_download_should_download_wheel_deps(script, data):
Expand All @@ -113,8 +114,8 @@ def test_download_should_download_wheel_deps(script, data):
'download', wheel_path,
'-d', '.', '--find-links', data.find_links, '--no-index'
)
assert Path('scratch') / wheel_filename in result.files_created
assert Path('scratch') / dep_filename in result.files_created
assert Path('scratch') / wheel_filename in result.files_created2
assert Path('scratch') / dep_filename in result.files_created2


@pytest.mark.network
Expand All @@ -129,7 +130,7 @@ def test_download_should_skip_existing_files(script):
result = script.pip(
'download', '-r', script.scratch_path / 'test-req.txt', '-d', '.',
)
assert Path('scratch') / 'INITools-0.1.tar.gz' in result.files_created
assert Path('scratch') / 'INITools-0.1.tar.gz' in result.files_created2
assert script.site_packages / 'initools' not in result.files_created

# adding second package to test-req.txt
Expand All @@ -142,10 +143,11 @@ def test_download_should_skip_existing_files(script):
result = script.pip(
'download', '-r', script.scratch_path / 'test-req.txt', '-d', '.',
)
openid_tarball_prefix = str(Path('scratch') / 'python-openid-')
assert any(
path.startswith(openid_tarball_prefix) for path in result.files_created
)
openid_tarball_prefix = str(Path('scratch') / 'python-openid-') # noqa
# assert any(
# path.startswith(openid_tarball_prefix) for path in
# result.files_created
# )
assert Path('scratch') / 'INITools-0.1.tar.gz' not in result.files_created
assert script.site_packages / 'initools' not in result.files_created
assert script.site_packages / 'openid' not in result.files_created
Expand All @@ -161,7 +163,7 @@ def test_download_vcs_link(script):
)
assert (
Path('scratch') / 'pip-test-package-0.1.1.zip'
in result.files_created
in result.files_created2
)
assert script.site_packages / 'piptestpackage' not in result.files_created

Expand All @@ -182,7 +184,7 @@ def test_only_binary_set_then_download_specific_platform(script, data):
)
assert (
Path('scratch') / 'fake-1.0-py2.py3-none-any.whl'
in result.files_created
in result.files_created2
)


Expand All @@ -202,7 +204,7 @@ def test_no_deps_set_then_download_specific_platform(script, data):
)
assert (
Path('scratch') / 'fake-1.0-py2.py3-none-any.whl'
in result.files_created
in result.files_created2
)


Expand Down Expand Up @@ -260,7 +262,7 @@ def test_download_specify_platform(script, data):
)
assert (
Path('scratch') / 'fake-1.0-py2.py3-none-any.whl'
in result.files_created
in result.files_created2
)

result = script.pip(
Expand All @@ -285,7 +287,7 @@ def test_download_specify_platform(script, data):
assert (
Path('scratch') /
'fake-1.0-py2.py3-none-macosx_10_9_x86_64.whl'
in result.files_created
in result.files_created2
)

# OSX platform wheels are not backward-compatible.
Expand Down Expand Up @@ -317,7 +319,7 @@ def test_download_specify_platform(script, data):
)
assert (
Path('scratch') / 'fake-2.0-py2.py3-none-linux_x86_64.whl'
in result.files_created
in result.files_created2
)


Expand Down Expand Up @@ -346,7 +348,7 @@ def test_download_universal(self, platform, script, data):
)
assert (
Path('scratch') / 'fake-1.0-py2.py3-none-any.whl'
in result.files_created
in result.files_created2
)

@pytest.mark.parametrize("wheel_abi,platform", [
Expand All @@ -369,7 +371,7 @@ def test_download_compatible_manylinuxes(
'--platform', platform,
'fake',
)
assert Path('scratch') / wheel in result.files_created
assert Path('scratch') / wheel in result.files_created2

def test_explicit_platform_only(self, data, script):
"""
Expand Down Expand Up @@ -402,7 +404,7 @@ def test_download__python_version(script, data):
)
assert (
Path('scratch') / 'fake-1.0-py2.py3-none-any.whl'
in result.files_created
in result.files_created2
)

result = script.pip(
Expand Down Expand Up @@ -452,7 +454,7 @@ def test_download__python_version(script, data):
)
assert (
Path('scratch') / 'fake-1.0-py2-none-any.whl'
in result.files_created
in result.files_created2
)

result = script.pip(
Expand All @@ -472,7 +474,7 @@ def test_download__python_version(script, data):
)
assert (
Path('scratch') / 'fake-2.0-py3-none-any.whl'
in result.files_created
in result.files_created2
)


Expand Down Expand Up @@ -549,7 +551,7 @@ def test_download_specify_abi(script, data):
)
assert (
Path('scratch') / 'fake-1.0-py2.py3-none-any.whl'
in result.files_created
in result.files_created2
)

result = script.pip(
Expand Down Expand Up @@ -583,7 +585,7 @@ def test_download_specify_abi(script, data):
)
assert (
Path('scratch') / 'fake-1.0-fk2-fakeabi-fake_platform.whl'
in result.files_created
in result.files_created2
)

result = script.pip(
Expand Down Expand Up @@ -613,7 +615,7 @@ def test_download_specify_implementation(script, data):
)
assert (
Path('scratch') / 'fake-1.0-py2.py3-none-any.whl'
in result.files_created
in result.files_created2
)

data.reset()
Expand All @@ -627,7 +629,7 @@ def test_download_specify_implementation(script, data):
)
assert (
Path('scratch') / 'fake-1.0-fk2.fk3-none-any.whl'
in result.files_created
in result.files_created2
)

data.reset()
Expand All @@ -642,7 +644,7 @@ def test_download_specify_implementation(script, data):
)
assert (
Path('scratch') / 'fake-1.0-fk3-none-any.whl'
in result.files_created
in result.files_created2
)

result = script.pip(
Expand Down Expand Up @@ -686,7 +688,7 @@ def test_download_prefer_binary_when_tarball_higher_than_wheel(script, data):
)
assert (
Path('scratch') / 'source-0.8-py2.py3-none-any.whl'
in result.files_created
in result.files_created2
)
assert (
Path('scratch') / 'source-1.0.tar.gz'
Expand All @@ -710,7 +712,7 @@ def test_download_prefer_binary_when_wheel_doesnt_satisfy_req(script, data):
)
assert (
Path('scratch') / 'source-1.0.tar.gz'
in result.files_created
in result.files_created2
)
assert (
Path('scratch') / 'source-0.8-py2.py3-none-any.whl'
Expand All @@ -728,5 +730,5 @@ def test_download_prefer_binary_when_only_tarball_exists(script, data):
)
assert (
Path('scratch') / 'source-1.0.tar.gz'
in result.files_created
in result.files_created2
)
Loading