<s> import os <EOL> import sys <EOL> import pytest <EOL> import glob <EOL> from tests . lib . path import Path <EOL> from tests . lib import TestFailure <EOL> def test_install_from_future_wheel_version ( script , data ) : <EOL> """<STR_LIT>""" <EOL> package = data . packages . join ( "<STR_LIT>" ) <EOL> result = script . pip ( '<STR_LIT>' , package , '<STR_LIT>' , expect_error = True ) <EOL> with pytest . raises ( TestFailure ) : <EOL> result . assert_installed ( '<STR_LIT>' , without_egg_link = True , <EOL> editable = False ) <EOL> package = data . packages . join ( "<STR_LIT>" ) <EOL> result = script . pip ( <EOL> '<STR_LIT>' , package , '<STR_LIT>' , expect_error = False , <EOL> expect_stderr = True , <EOL> ) <EOL> result . assert_installed ( '<STR_LIT>' , without_egg_link = True , <EOL> editable = False ) <EOL> def test_install_from_broken_wheel ( script , data ) : <EOL> """<STR_LIT>""" <EOL> package = data . packages . join ( "<STR_LIT>" ) <EOL> result = script . pip ( '<STR_LIT>' , package , '<STR_LIT>' , expect_error = True ) <EOL> with pytest . raises ( TestFailure ) : <EOL> result . assert_installed ( '<STR_LIT>' , without_egg_link = True , <EOL> editable = False ) <EOL> def test_install_from_wheel ( script , data ) : <EOL> """<STR_LIT>""" <EOL> result = script . pip ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' + data . find_links , <EOL> expect_error = False , <EOL> ) <EOL> dist_info_folder = script . site_packages / '<STR_LIT>' <EOL> assert dist_info_folder in result . files_created , ( dist_info_folder , <EOL> result . files_created , <EOL> result . stdout ) <EOL> script_file = script . bin / '<STR_LIT>' <EOL> assert script_file in result . files_created <EOL> def test_install_from_wheel_with_extras ( script , data ) : <EOL> """<STR_LIT>""" <EOL> result = script . pip ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' + data . find_links , <EOL> expect_error = False , <EOL> ) <EOL> dist_info_folder = script . site_packages / '<STR_LIT>' <EOL> assert dist_info_folder in result . files_created , ( dist_info_folder , <EOL> result . files_created , <EOL> result . stdout ) <EOL> dist_info_folder = script . site_packages / '<STR_LIT>' <EOL> assert dist_info_folder in result . files_created , ( dist_info_folder , <EOL> result . files_created , <EOL> result . stdout ) <EOL> def test_install_from_wheel_file ( script , data ) : <EOL> """<STR_LIT>""" <EOL> package = data . packages . join ( "<STR_LIT>" ) <EOL> result = script . pip ( '<STR_LIT>' , package , '<STR_LIT>' , expect_error = False ) <EOL> dist_info_folder = script . site_packages / '<STR_LIT>' <EOL> assert dist_info_folder in result . files_created , ( dist_info_folder , <EOL> result . files_created , <EOL> result . stdout ) <EOL> installer = dist_info_folder / '<STR_LIT>' <EOL> assert installer in result . files_created , ( dist_info_folder , <EOL> result . files_created , <EOL> result . stdout ) <EOL> with open ( script . base_path / installer , '<STR_LIT:rb>' ) as installer_file : <EOL> installer_details = installer_file . read ( ) <EOL> assert installer_details == b'<STR_LIT>' <EOL> installer_temp = dist_info_folder / '<STR_LIT>' <EOL> assert installer_temp not in result . files_created , ( dist_info_folder , <EOL> result . files_created , <EOL> result . stdout ) <EOL> @ pytest . mark . skipif ( "<STR_LIT>" ) <EOL> def test_install_from_wheel_with_headers ( script , data ) : <EOL> """<STR_LIT>""" <EOL> package = data . packages . join ( "<STR_LIT>" ) <EOL> result = script . pip ( '<STR_LIT>' , package , '<STR_LIT>' , expect_error = False ) <EOL> dist_info_folder = script . site_packages / '<STR_LIT>' <EOL> assert dist_info_folder in result . files_created , ( dist_info_folder , <EOL> result . files_created , <EOL> result . stdout ) <EOL> @ pytest . mark . network <EOL> def test_install_wheel_with_target ( script , data ) : <EOL> """<STR_LIT>""" <EOL> script . pip ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> target_dir = script . scratch_path / '<STR_LIT:target>' <EOL> result = script . pip ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , target_dir , <EOL> '<STR_LIT>' , '<STR_LIT>' + data . find_links , <EOL> ) <EOL> assert Path ( '<STR_LIT>' ) / '<STR_LIT:target>' / '<STR_LIT>' in result . files_created , ( <EOL> str ( result ) <EOL> ) <EOL> def test_install_wheel_with_root ( script , data ) : <EOL> """<STR_LIT>""" <EOL> root_dir = script . scratch_path / '<STR_LIT:root>' <EOL> result = script . pip ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , root_dir , <EOL> '<STR_LIT>' , '<STR_LIT>' + data . find_links , <EOL> ) <EOL> assert Path ( '<STR_LIT>' ) / '<STR_LIT:root>' in result . files_created <EOL> def test_install_wheel_with_prefix ( script , data ) : <EOL> """<STR_LIT>""" <EOL> prefix_dir = script . scratch_path / '<STR_LIT>' <EOL> result = script . pip ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , prefix_dir , <EOL> '<STR_LIT>' , '<STR_LIT>' + data . find_links , <EOL> ) <EOL> if hasattr ( sys , "<STR_LIT>" ) : <EOL> lib = Path ( '<STR_LIT>' ) / '<STR_LIT>' / '<STR_LIT>' <EOL> else : <EOL> lib = Path ( '<STR_LIT>' ) / '<STR_LIT>' / '<STR_LIT>' <EOL> assert lib in result . files_created <EOL> def test_install_from_wheel_installs_deps ( script , data ) : <EOL> """<STR_LIT>""" <EOL> package = data . packages . join ( "<STR_LIT>" ) <EOL> result = script . pip ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , data . find_links , package , <EOL> ) <EOL> result . assert_installed ( '<STR_LIT:source>' , editable = False ) <EOL> def test_install_from_wheel_no_deps ( script , data ) : <EOL> """<STR_LIT>""" <EOL> package = data . packages . join ( "<STR_LIT>" ) <EOL> result = script . pip ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , data . find_links , '<STR_LIT>' , <EOL> package , <EOL> ) <EOL> pkg_folder = script . site_packages / '<STR_LIT:source>' <EOL> assert pkg_folder not in result . files_created <EOL> @ pytest . mark . network <EOL> def test_install_user_wheel ( script , virtualenv , data ) : <EOL> """<STR_LIT>""" <EOL> virtualenv . system_site_packages = True <EOL> script . pip ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> result = script . pip ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' + data . find_links , <EOL> ) <EOL> egg_info_folder = script . user_site / '<STR_LIT>' <EOL> assert egg_info_folder in result . files_created , str ( result ) <EOL> script_file = script . user_bin / '<STR_LIT>' <EOL> assert script_file in result . files_created <EOL> def test_install_from_wheel_gen_entrypoint ( script , data ) : <EOL> """<STR_LIT>""" <EOL> result = script . pip ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' + data . find_links , <EOL> expect_error = False , <EOL> ) <EOL> if os . name == '<STR_LIT>' : <EOL> wrapper_file = script . bin / '<STR_LIT>' <EOL> else : <EOL> wrapper_file = script . bin / '<STR_LIT>' <EOL> assert wrapper_file in result . files_created <EOL> if os . name != "<STR_LIT>" : <EOL> assert bool ( os . access ( script . base_path / wrapper_file , os . X_OK ) ) <EOL> def test_install_from_wheel_gen_uppercase_entrypoint ( script , data ) : <EOL> """<STR_LIT>""" <EOL> result = script . pip ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' + data . find_links , <EOL> expect_error = False , <EOL> ) <EOL> if os . name == '<STR_LIT>' : <EOL> wrapper_file = script . bin / '<STR_LIT>' <EOL> else : <EOL> wrapper_file = script . bin / '<STR_LIT>' <EOL> assert wrapper_file in result . files_created <EOL> if os . name != "<STR_LIT>" : <EOL> assert bool ( os . access ( script . base_path / wrapper_file , os . X_OK ) ) <EOL> def test_install_from_wheel_with_legacy ( script , data ) : <EOL> """<STR_LIT>""" <EOL> result = script . pip ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' + data . find_links , <EOL> expect_error = False , <EOL> ) <EOL> legacy_file1 = script . bin / '<STR_LIT>' <EOL> legacy_file2 = script . bin / '<STR_LIT>' <EOL> assert legacy_file1 in result . files_created <EOL> assert legacy_file2 in result . files_created <EOL> def test_install_from_wheel_no_setuptools_entrypoint ( script , data ) : <EOL> """<STR_LIT>""" <EOL> result = script . pip ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' + data . find_links , <EOL> expect_error = False , <EOL> ) <EOL> if os . name == '<STR_LIT>' : <EOL> wrapper_file = script . bin / '<STR_LIT>' <EOL> else : <EOL> wrapper_file = script . bin / '<STR_LIT>' <EOL> wrapper_helper = script . bin / '<STR_LIT>' <EOL> assert wrapper_file in result . files_created <EOL> assert wrapper_helper not in result . files_created <EOL> def test_skipping_setuptools_doesnt_skip_legacy ( script , data ) : <EOL> """<STR_LIT>""" <EOL> result = script . pip ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' + data . find_links , <EOL> expect_error = False , <EOL> ) <EOL> legacy_file1 = script . bin / '<STR_LIT>' <EOL> legacy_file2 = script . bin / '<STR_LIT>' <EOL> wrapper_helper = script . bin / '<STR_LIT>' <EOL> assert legacy_file1 in result . files_created <EOL> assert legacy_file2 in result . files_created <EOL> assert wrapper_helper not in result . files_created <EOL> def test_install_from_wheel_gui_entrypoint ( script , data ) : <EOL> """<STR_LIT>""" <EOL> result = script . pip ( <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' + data . find_links , <EOL> expect_error = False , <EOL> ) <EOL> if os . name == '<STR_LIT>' : <EOL> wrapper_file = script . bin / '<STR_LIT>' <EOL> else : <EOL> wrapper_file = script . bin / '<STR_LIT>' <EOL> assert wrapper_file in result . files_created <EOL> def test_wheel_compiles_pyc ( script , data ) : <EOL> """<STR_LIT>""" <EOL> script . pip ( <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" + data . find_links <EOL> ) <EOL> exists = [ <EOL> os . path . exists ( script . site_packages_path / "<STR_LIT>" ) , <EOL> ] <EOL> exists += glob . glob ( <EOL> script . site_packages_path / "<STR_LIT>" <EOL> ) <EOL> assert any ( exists ) <EOL> def test_wheel_no_compiles_pyc ( script , data ) : <EOL> """<STR_LIT>""" <EOL> script . pip ( <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" + data . find_links <EOL> ) <EOL> exists = [ <EOL> os . path . exists ( script . site_packages_path / "<STR_LIT>" ) , <EOL> ] <EOL> exists += glob . glob ( <EOL> script . site_packages_path / "<STR_LIT>" <EOL> ) <EOL> assert not any ( exists ) <EOL> def test_install_from_wheel_uninstalls_old_version ( script , data ) : <EOL> package = data . packages . join ( "<STR_LIT>" ) <EOL> result = script . pip ( '<STR_LIT>' , package , '<STR_LIT>' , expect_error = True ) <EOL> package = data . packages . join ( "<STR_LIT>" ) <EOL> result = script . pip ( '<STR_LIT>' , package , '<STR_LIT>' , expect_error = False ) <EOL> dist_info_folder = script . site_packages / '<STR_LIT>' <EOL> assert dist_info_folder in result . files_created <EOL> dist_info_folder = script . site_packages / '<STR_LIT>' <EOL> assert dist_info_folder not in result . files_created <EOL> def test_wheel_compile_syntax_error ( script , data ) : <EOL> package = data . packages . join ( "<STR_LIT>" ) <EOL> result = script . pip ( '<STR_LIT>' , '<STR_LIT>' , package , '<STR_LIT>' ) <EOL> assert '<STR_LIT>' not in result . stdout <EOL> assert '<STR_LIT>' not in result . stdout </s>
