Skip to content

Commit

Permalink
Some tests really need wheel to be absent
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul committed Jul 9, 2020
1 parent 3faf175 commit 7dfe724
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
17 changes: 11 additions & 6 deletions tests/functional/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -1081,14 +1081,14 @@ def test_install_package_conflict_prefix_and_user(script, data):
)


def test_install_package_that_emits_unicode(script, data):
def test_install_package_that_emits_unicode(script_no_wheel, data):
"""
Install a package with a setup.py that emits UTF-8 output and then fails.
Refs https://github.com/pypa/pip/issues/326
"""
to_install = data.packages.joinpath("BrokenEmitsUTF8")
result = script.pip(
result = script_no_wheel.pip(
'install', to_install, expect_error=True, expect_temp=True, quiet=True,
)
assert (
Expand Down Expand Up @@ -1648,17 +1648,22 @@ def test_installing_scripts_on_path_does_not_print_warning(script):
assert "--no-warn-script-location" not in result.stderr


def test_installed_files_recorded_in_deterministic_order(script, data):
def test_installed_files_recorded_in_deterministic_order(
script_no_wheel, data
):
"""
Ensure that we record the files installed by a package in a deterministic
order, to make installs reproducible.
"""
to_install = data.packages.joinpath("FSPkg")
result = script.pip('install', to_install)
fspkg_folder = script.site_packages / 'fspkg'
# allow_stderr_warning for https://github.com/pypa/pip/issues/8559
result = script_no_wheel.pip(
'install', to_install, allow_stderr_warning=True
)
fspkg_folder = script_no_wheel.site_packages / 'fspkg'
egg_info = 'FSPkg-0.1.dev0-py{pyversion}.egg-info'.format(**globals())
installed_files_path = (
script.site_packages / egg_info / 'installed-files.txt'
script_no_wheel.site_packages / egg_info / 'installed-files.txt'
)
result.did_create(fspkg_folder)
result.did_create(installed_files_path)
Expand Down
23 changes: 15 additions & 8 deletions tests/functional/test_install_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


@pytest.mark.network
def test_debian_egg_name_workaround(script):
def test_debian_egg_name_workaround(script_no_wheel):
"""
We can uninstall packages installed with the pyversion removed from the
egg-info metadata directory name.
Expand All @@ -22,10 +22,13 @@ def test_debian_egg_name_workaround(script):
https://bitbucket.org/ianb/pip/issue/104/pip-uninstall-on-ubuntu-linux
"""
result = script.pip('install', 'INITools==0.2')
# allow_stderr_warning for https://github.com/pypa/pip/issues/8559
result = script_no_wheel.pip(
'install', 'INITools==0.2', allow_stderr_warning=True
)

egg_info = os.path.join(
script.site_packages,
script_no_wheel.site_packages,
"INITools-0.2-py{pyversion}.egg-info".format(**globals()))

# Debian only removes pyversion for global installs, not inside a venv
Expand All @@ -38,22 +41,26 @@ def test_debian_egg_name_workaround(script):
)

# The Debian no-pyversion version of the .egg-info
mangled = os.path.join(script.site_packages, "INITools-0.2.egg-info")
mangled = os.path.join(
script_no_wheel.site_packages, "INITools-0.2.egg-info"
)
result.did_not_create(
mangled,
message="Found unexpected {mangled}".format(**locals())
)

# Simulate a Debian install by copying the .egg-info to their name for it
full_egg_info = os.path.join(script.base_path, egg_info)
full_egg_info = os.path.join(script_no_wheel.base_path, egg_info)
assert os.path.isdir(full_egg_info)
full_mangled = os.path.join(script.base_path, mangled)
full_mangled = os.path.join(script_no_wheel.base_path, mangled)
os.renames(full_egg_info, full_mangled)
assert os.path.isdir(full_mangled)

# Try the uninstall and verify that everything is removed.
result2 = script.pip("uninstall", "INITools", "-y")
assert_all_changes(result, result2, [script.venv / 'build', 'cache'])
result2 = script_no_wheel.pip("uninstall", "INITools", "-y")
assert_all_changes(
result, result2, [script_no_wheel.venv / 'build', 'cache']
)


def test_setup_py_with_dos_line_endings(script, data):
Expand Down

0 comments on commit 7dfe724

Please sign in to comment.