def test_freeze_with_local_option(): """ Test that wsgiref (from global site-packages) is reported normally, but not with --local. """ reset_env() result = run_pip('install', 'initools==0.2') result = run_pip('freeze', expect_stderr=True) expected = textwrap.dedent("""\ Script result: ...pip freeze -- stdout: -------------------- INITools==0.2 wsgiref==... <BLANKLINE>""") # The following check is broken (see # http://bitbucket.org/ianb/pip/issue/110). For now we are simply # neutering this test, but if we can't find a way to fix it, # this whole function should be removed. # _check_output(result, expected) result = run_pip('freeze', '--local', expect_stderr=True) expected = textwrap.dedent("""\ Script result: ...pip freeze --local -- stdout: -------------------- INITools==0.2 <BLANKLINE>""") _check_output(result, expected)
def test_freeze_mercurial_clone(): """ Test freezing a Mercurial clone. """ reset_env() env = get_env() result = env.run( "hg", "clone", "-r", "f8f7eaf275c5", "http://bitbucket.org/jezdez/django-dbtemplates/", "django-dbtemplates" ) result = env.run("python", "setup.py", "develop", cwd=env.scratch_path / "django-dbtemplates") result = run_pip("freeze", expect_stderr=True) expected = textwrap.dedent( """\ Script result: ...pip freeze -- stdout: -------------------- -e hg+http://bitbucket.org/jezdez/django-dbtemplates/@...#egg=django_dbtemplates-... ...""" ) _check_output(result, expected) result = run_pip( "freeze", "-f", "hg+http://bitbucket.org/jezdez/django-dbtemplates#egg=django_dbtemplates", expect_stderr=True ) expected = textwrap.dedent( """\ Script result: ...pip freeze -f hg+http://bitbucket.org/jezdez/django-dbtemplates#egg=django_dbtemplates -- stdout: -------------------- -f hg+http://bitbucket.org/jezdez/django-dbtemplates#egg=django_dbtemplates -e hg+http://bitbucket.org/jezdez/django-dbtemplates/@...#egg=django_dbtemplates-... ...""" ) _check_output(result, expected)
def test_install_with_pax_header(): """ test installing from a tarball with pax header for python<2.6 """ reset_env() run_from = abspath(join(here, 'packages')) result = run_pip('install', 'paxpkg.tar.bz2', cwd=run_from)
def test_editable_no_install_followed_by_no_download(): """ Test installing an editable in two steps (first with --no-install, then with --no-download). """ reset_env() result = run_pip( 'install', '-e', '%s#egg=initools-dev' % local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'), '--no-install', expect_error=True) result.assert_installed('INITools', without_egg_link=True, with_files=['.svn']) result = run_pip( 'install', '-e', '%s#egg=initools-dev' % local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'), '--no-download', expect_error=True) result.assert_installed('INITools', without_files=[curdir, '.svn'])
def test_freeze_mercurial_clone(): """ Test freezing a Mercurial clone. """ reset_env() env = get_env() result = env.run('hg', 'clone', '-r', 'f8f7eaf275c5', local_repo('hg+http://bitbucket.org/jezdez/django-dbtemplates'), 'django-dbtemplates') result = env.run('python', 'setup.py', 'develop', cwd=env.scratch_path/'django-dbtemplates') result = run_pip('freeze', expect_stderr=True) expected = textwrap.dedent("""\ Script result: ...pip freeze -- stdout: -------------------- -e %s@...#egg=django_dbtemplates-... ...""" % local_checkout('hg+http://bitbucket.org/jezdez/django-dbtemplates')) _check_output(result, expected) result = run_pip('freeze', '-f', '%s#egg=django_dbtemplates' % local_checkout('hg+http://bitbucket.org/jezdez/django-dbtemplates'), expect_stderr=True) expected = textwrap.dedent("""\ Script result: ...pip freeze -f %(repo)s#egg=django_dbtemplates -- stdout: -------------------- -f %(repo)s#egg=django_dbtemplates -e %(repo)s@...#egg=django_dbtemplates-... ...""" % {'repo': local_checkout('hg+http://bitbucket.org/jezdez/django-dbtemplates')}) _check_output(result, expected)
def test_correct_pip_version(): """ Check we are running proper version of pip in run_pip. """ reset_env() # output is like: # pip PIPVERSION from PIPDIRECTORY (python PYVERSION) result = run_pip('--version') # compare the directory tree of the invoked pip with that of this source distribution dir = re.match(r'pip \d(.[\d])+ from (.*) \(python \d(.[\d])+\)$', result.stdout).group(2) pip_folder = join(src_folder, 'pip') pip_folder_outputed = join(dir, 'pip') diffs = filecmp.dircmp(pip_folder, pip_folder_outputed) # If any non-matching .py files exist, we have a problem: run_pip # is picking up some other version! N.B. if this project acquires # primary resources other than .py files, this code will need # maintenance mismatch_py = [ x for x in diffs.left_only + diffs.right_only + diffs.diff_files if x.endswith('.py') ] assert not mismatch_py, 'mismatched source files in %r and %r' % ( pip_folder, pip_folder_outputed)
def test_freeze_bazaar_clone(): """ Test freezing a Bazaar clone. """ reset_env() env = get_env() result = env.run('bzr', 'checkout', '-r', '174', local_repo('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1'), 'django-wikiapp') result = env.run('python', 'setup.py', 'develop', cwd=env.scratch_path/'django-wikiapp') result = run_pip('freeze', expect_stderr=True) expected = textwrap.dedent("""\ Script result: ...pip freeze -- stdout: -------------------- -e %s@...#egg=django_wikiapp-... ...""" % local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1')) _check_output(result, expected) result = run_pip('freeze', '-f', '%s/#egg=django-wikiapp' % local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1'), expect_stderr=True) expected = textwrap.dedent("""\ Script result: ...pip freeze -f %(repo)s/#egg=django-wikiapp -- stdout: -------------------- -f %(repo)s/#egg=django-wikiapp -e %(repo)s@...#egg=django_wikiapp-... ...""" % {'repo': local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1')}) _check_output(result, expected)
def _test_config_file_override_stack(config_file): environ = clear_environ(os.environ.copy()) environ['PIP_CONFIG_FILE'] = config_file # set this to make pip load it reset_env(environ) write_file( config_file, textwrap.dedent("""\ [global] index-url = http://download.zope.org/ppix """)) result = run_pip('install', '-vvv', 'INITools', expect_error=True) assert "Getting page http://download.zope.org/ppix/INITools" in result.stdout reset_env(environ) write_file( config_file, textwrap.dedent("""\ [global] index-url = http://download.zope.org/ppix [install] index-url = http://pypi.appspot.com/ """)) result = run_pip('install', '-vvv', 'INITools', expect_error=True) assert "Getting page http://pypi.appspot.com/INITools" in result.stdout result = run_pip('install', '-vvv', '--index-url', 'http://pypi.python.org/simple', 'INITools', expect_error=True) assert "Getting page http://download.zope.org/ppix/INITools" not in result.stdout assert "Getting page http://pypi.appspot.com/INITools" not in result.stdout assert "Getting page http://pypi.python.org/simple/INITools" in result.stdout
def _test_config_file_override_stack(config_file): environ = clear_environ(os.environ.copy()) environ["PIP_CONFIG_FILE"] = config_file # set this to make pip load it reset_env(environ) write_file( config_file, textwrap.dedent( """\ [global] index-url = http://download.zope.org/ppix """ ), ) result = run_pip("install", "-vvv", "INITools", expect_error=True) assert "Getting page http://download.zope.org/ppix/INITools" in result.stdout reset_env(environ) write_file( config_file, textwrap.dedent( """\ [global] index-url = http://download.zope.org/ppix [install] index-url = http://pypi.appspot.com/ """ ), ) result = run_pip("install", "-vvv", "INITools", expect_error=True) assert "Getting page http://pypi.appspot.com/INITools" in result.stdout result = run_pip("install", "-vvv", "--index-url", "http://pypi.python.org/simple", "INITools", expect_error=True) assert "Getting page http://download.zope.org/ppix/INITools" not in result.stdout assert "Getting page http://pypi.appspot.com/INITools" not in result.stdout assert "Getting page http://pypi.python.org/simple/INITools" in result.stdout
def test_config_file_override_stack(): """ Test config files (global, overriding a global config with a local, overriding all with a command line flag). """ f, config_file = tempfile.mkstemp('-pip.cfg', 'test-') environ = clear_environ(os.environ.copy()) environ['PIP_CONFIG_FILE'] = config_file # set this to make pip load it reset_env(environ) write_file(config_file, textwrap.dedent("""\ [global] index-url = http://download.zope.org/ppix """)) result = run_pip('install', '-vvv', 'INITools', expect_error=True) assert "Getting page http://download.zope.org/ppix/INITools" in result.stdout reset_env(environ) write_file(config_file, textwrap.dedent("""\ [global] index-url = http://download.zope.org/ppix [install] index-url = http://pypi.appspot.com/ """)) result = run_pip('install', '-vvv', 'INITools', expect_error=True) assert "Getting page http://pypi.appspot.com/INITools" in result.stdout result = run_pip('install', '-vvv', '--index-url', 'http://pypi.python.org/simple', 'INITools', expect_error=True) assert "Getting page http://download.zope.org/ppix/INITools" not in result.stdout assert "Getting page http://pypi.appspot.com/INITools" not in result.stdout assert "Getting page http://pypi.python.org/simple/INITools" in result.stdout
def test_vcs_url_urlquote_normalization(): """ Test that urlquoted characters are normalized for repo URL comparison. """ reset_env() result = run_pip('install', '-e', 'bzr+http://bazaar.launchpad.net/~django-wikiapp/django-wikiapp/release-0.1#egg=django-wikiapp', expect_error=True) assert 'pip-log.txt' not in result.files_created, result.files_created['pip-log.txt'].bytes
def test_vcs_url_final_slash_normalization(): """ Test that presence or absence of final slash in VCS URL is normalized. """ reset_env() result = run_pip('install', '-e', 'hg+http://bitbucket.org/ubernostrum/django-registration#egg=django-registration', expect_error=True) assert 'pip-log.txt' not in result.files_created, result.files_created['pip-log.txt'].bytes
def test_search(): """ End to end test of search command. """ reset_env() output = run_pip('search', 'pip') assert 'pip installs packages' in output.stdout
def test_git_with_editable_where_egg_contains_dev_string(): """ Test cloning a git repository from an editable url witch contains "dev" string """ reset_env() result = run_pip('install', '-e', '%s#egg=django-devserver' % local_checkout('git+git://github.com/dcramer/django-devserver.git')) result.assert_installed('django-devserver', with_files=['.git'])
def test_install_global_option(): """ Test using global distutils options. (In particular those that disable the actual install action) """ reset_env() result = run_pip('install', '--global-option=--version', "INITools==0.1") assert '0.1\n' in result.stdout
def test_completion_alone(): """ Test getting completion for none shell, just pip completion """ reset_env() result = run_pip('completion', expect_error=True) assert 'ERROR: You must pass --bash or --zsh' in result.stderr,\ 'completion alone failed -- ' + result.stderr
def test_search(): """ End to end test of search command. """ reset_env() output = run_pip('search', 'pip', expect_error=True) assert 'pip installs packages' in output.stdout
def test_completion_for_unknown_shell(): """ Test getting completion for an unknown shell """ reset_env() error_msg = 'error: no such option: --myfooshell' result = run_pip('completion', '--myfooshell', expect_error=True) assert error_msg in result.stderr, 'tests for an unknown shell failed'
def test_bad_install_with_no_download(): """ Test that --no-download behaves sensibly if the package source can't be found. """ reset_env() result = run_pip('install', 'INITools==0.2', '--no-download', expect_error=True) assert "perhaps --no-download was used without first running "\ "an equivalent install with --no-install?" in result.stdout
def test_editable_install(): """ Test editable installation. """ reset_env() result = run_pip('install', '-e', 'INITools==0.2', expect_error=True) assert "--editable=INITools==0.2 should be formatted with svn+URL" in result.stdout assert len(result.files_created) == 1, result.files_created assert not result.files_updated, result.files_updated
def test_no_upgrade_unless_requested(): """ No upgrade if not specifically requested. """ reset_env() run_pip('install', 'INITools==0.1', expect_error=True) result = run_pip('install', 'INITools', expect_error=True) assert not result.files_created, 'pip install INITools upgraded when it should not have'
def test_install_from_local_directory_with_no_setup_py(): """ Test installing from a local directory with no 'setup.py'. """ reset_env() result = run_pip('install', here, expect_error=True) assert len(result.files_created) == 1, result.files_created assert 'pip-log.txt' in result.files_created, result.files_created assert "is not installable. File 'setup.py' not found." in result.stdout
def test_upgrade_if_requested(): """ And it does upgrade if requested. """ reset_env() run_pip('install', 'INITools==0.1', expect_error=True) result = run_pip('install', '--upgrade', 'INITools', expect_error=True) assert result.files_created, 'pip install --upgrade did not upgrade'
def test_upgrade_to_specific_version(): """ It does upgrade to specific version requested. """ reset_env() run_pip('install', 'INITools==0.1', expect_error=True) result = run_pip('install', 'INITools==0.2', expect_error=True) assert result.files_created, 'pip install with specific version did not upgrade'
def test_install_global_option_using_editable(): """ Test using global distutils options, but in an editable installation """ reset_env() result = run_pip( 'install', '--global-option=--version', '-e', '%s#egg=virtualenv' % local_checkout('hg+http://bitbucket.org/ianb/[email protected]')) assert '1.4.1\n' in result.stdout
def test_install_editable_from_svn(): """ Test checking out from svn. """ reset_env() result = run_pip( 'install', '-e', '%s#egg=initools-dev' % local_checkout('svn+http://svn.colorstudy.com/INITools/trunk')) result.assert_installed('INITools', with_files=['.svn'])
def test_git_with_non_editable_unpacking(): """ Test cloning a git repository from a non-editable URL with a given tag. """ reset_env() result = run_pip('install', '--global-option=--version', local_checkout( 'git+http://github.com/jezdez/[email protected]#egg=django-staticfiles' ), expect_error=True) assert '0.3.1\n' in result.stdout
def test_git_with_editable_where_egg_contains_dev_string(): """ Test cloning a git repository from an editable url witch contains "dev" string """ reset_env() result = run_pip( 'install', '-e', '%s#egg=django-devserver' % local_checkout('git+git://github.com/dcramer/django-devserver.git')) result.assert_installed('django-devserver', with_files=['.git'])
def test_install_global_option_using_editable(): """ Test using global distutils options, but in an editable installation """ reset_env() result = run_pip('install', '--global-option=--version', '-e', '%s#egg=virtualenv' % local_checkout('hg+http://bitbucket.org/ianb/[email protected]')) assert '1.4.1\n' in result.stdout
def test_install_editable_from_bazaar(): """ Test checking out from Bazaar. """ reset_env() result = run_pip('install', '-e', '%s/@174#egg=django-wikiapp' % local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1'), expect_error=True) result.assert_installed('django-wikiapp', with_files=['.bzr'])
def test_install_editable_from_hg(): """ Test cloning from Mercurial. """ reset_env() result = run_pip('install', '-e', '%s#egg=django-registration' % local_checkout('hg+http://bitbucket.org/ubernostrum/django-registration'), expect_error=True) result.assert_installed('django-registration', with_files=['.hg'])
def test_install_editable_from_svn(): """ Test checking out from svn. """ reset_env() result = run_pip('install', '-e', '%s#egg=initools-dev' % local_checkout('svn+http://svn.colorstudy.com/INITools/trunk')) result.assert_installed('INITools', with_files=['.svn'])
def test_install_editable_from_git(): """ Test cloning from Git. """ reset_env() result = run_pip('install', '-e', '%s#egg=django-feedutil' % local_checkout('git+http://github.com/jezdez/django-feedutil.git'), expect_error=True) result.assert_installed('django-feedutil', with_files=['.git'])
def test_options_from_env_vars(): """ Test if ConfigOptionParser reads env vars (e.g. not using PyPI here) """ environ = clear_environ(os.environ.copy()) environ['PIP_NO_INDEX'] = '1' reset_env(environ) result = run_pip('install', '-vvv', 'INITools', expect_error=True) assert "Ignoring indexes:" in result.stdout, str(result) assert "DistributionNotFound: No distributions at all found for INITools" in result.stdout
def test_install_editable_from_git(): """ Test cloning from Git. """ reset_env() result = run_pip( 'install', '-e', '%s#egg=django-feedutil' % local_checkout('git+http://github.com/jezdez/django-feedutil.git'), expect_error=True) result.assert_installed('django-feedutil', with_files=['.git'])
def test_install_editable_from_hg(): """ Test cloning from Mercurial. """ reset_env() result = run_pip( 'install', '-e', '%s#egg=django-registration' % local_checkout( 'hg+http://bitbucket.org/ubernostrum/django-registration'), expect_error=True) result.assert_installed('django-registration', with_files=['.hg'])
def test_command_line_appends_correctly(): """ Test multiple appending options set by environmental variables. """ environ = clear_environ(os.environ.copy()) environ["PIP_FIND_LINKS"] = "http://pypi.pinaxproject.com http://example.com" reset_env(environ) result = run_pip("install", "-vvv", "INITools", expect_error=True) print result.stdout assert "Analyzing links from page http://pypi.pinaxproject.com" in result.stdout assert "Analyzing links from page http://example.com" in result.stdout
def test_install_editable_from_bazaar(): """ Test checking out from Bazaar. """ reset_env() result = run_pip( 'install', '-e', '%s/@174#egg=django-wikiapp' % local_checkout( 'bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1' ), expect_error=True) result.assert_installed('django-wikiapp', with_files=['.bzr'])
def test_git_with_non_editable_unpacking(): """ Test cloning a git repository from a non-editable URL with a given tag. """ reset_env() result = run_pip( 'install', '--global-option=--version', local_checkout( 'git+http://github.com/jezdez/[email protected]#egg=django-staticfiles' ), expect_error=True) assert '0.3.1\n' in result.stdout
def test_command_line_appends_correctly(): """ Test multiple appending options set by environmental variables. """ environ = clear_environ(os.environ.copy()) environ[ 'PIP_FIND_LINKS'] = 'http://pypi.pinaxproject.com http://example.com' reset_env(environ) result = run_pip('install', '-vvv', 'INITools', expect_error=True) print result.stdout assert "Analyzing links from page http://pypi.pinaxproject.com" in result.stdout assert "Analyzing links from page http://example.com" in result.stdout
def test_vcs_url_final_slash_normalization(): """ Test that presence or absence of final slash in VCS URL is normalized. """ reset_env() result = run_pip( 'install', '-e', '%s/#egg=django-registration' % local_checkout( 'hg+http://bitbucket.org/ubernostrum/django-registration'), expect_error=True) assert 'pip-log.txt' not in result.files_created, result.files_created[ 'pip-log.txt'].bytes
def test_vcs_url_urlquote_normalization(): """ Test that urlquoted characters are normalized for repo URL comparison. """ reset_env() result = run_pip( 'install', '-e', '%s/#egg=django-wikiapp' % local_checkout( 'bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1' ), expect_error=True) assert 'pip-log.txt' not in result.files_created, result.files_created[ 'pip-log.txt'].bytes
def test_command_line_append_flags(): """ Test command line flags that append to defaults set by environmental variables. """ environ = clear_environ(os.environ.copy()) environ['PIP_FIND_LINKS'] = 'http://pypi.pinaxproject.com' reset_env(environ) result = run_pip('install', '-vvv', 'INITools', expect_error=True) assert "Analyzing links from page http://pypi.pinaxproject.com" in result.stdout reset_env(environ) result = run_pip('install', '-vvv', '--find-links', 'http://example.com', 'INITools', expect_error=True) assert "Analyzing links from page http://pypi.pinaxproject.com" in result.stdout assert "Analyzing links from page http://example.com" in result.stdout
def test_command_line_options_override_env_vars(): """ Test that command line options override environmental variables. """ environ = clear_environ(os.environ.copy()) environ['PIP_INDEX_URL'] = 'http://pypi.appspot.com/' reset_env(environ) result = run_pip('install', '-vvv', 'INITools', expect_error=True) assert "Getting page http://pypi.appspot.com/INITools" in result.stdout reset_env(environ) result = run_pip('install', '-vvv', '--index-url', 'http://download.zope.org/ppix', 'INITools', expect_error=True) assert "http://pypi.appspot.com/INITools" not in result.stdout assert "Getting page http://download.zope.org/ppix" in result.stdout
def test_outdated_default(): """ Test default behavor of oudated command """ env = reset_env() total_re = re.compile('LATEST: +([0-9.]+)') write_file( 'initools-req.txt', textwrap.dedent("""\ INITools==0.2 # and something else to test out: simplejson==2.0.0 """)) run_pip('install', '-r', env.scratch_path / 'initools-req.txt') result = run_pip('search', 'simplejson') simplejson_ver = total_re.search(str(result)).group(1) result = run_pip('search', 'INITools') initools_ver = total_re.search(str(result)).group(1) result = run_pip('outdated', expect_stderr=True) expected = textwrap.dedent("""\ Script result: pip outdated -- stdout: -------------------- simplejson==2.0.0 (LATEST: %s) INITools==0.2 (LATEST: %s) <BLANKLINE>""" % (simplejson_ver, initools_ver)) _check_output(result, expected)
def test_completion_for_bash(): """ Test getting completion for bash shell """ reset_env() bash_completion = """\ _pip_completion() { COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \\ COMP_CWORD=$COMP_CWORD \\ PIP_AUTO_COMPLETE=1 $1 ) ) } complete -o default -F _pip_completion pip""" result = run_pip('completion', '--bash') assert bash_completion in result.stdout, 'bash completion is wrong'
def test_uninstall_from_reqs_file(): """ Test uninstall from a requirements file. """ env = reset_env() write_file( 'test-req.txt', textwrap.dedent("""\ -e %s#egg=initools-dev # and something else to test out: PyLogo<0.4 """ % local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'))) result = run_pip('install', '-r', 'test-req.txt') write_file( 'test-req.txt', textwrap.dedent("""\ # -f, -i, and --extra-index-url should all be ignored by uninstall -f http://www.example.com -i http://www.example.com --extra-index-url http://www.example.com -e %s#egg=initools-dev # and something else to test out: PyLogo<0.4 """ % local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'))) result2 = run_pip('uninstall', '-r', 'test-req.txt', '-y') assert_all_changes( result, result2, [env.venv / 'build', env.venv / 'src', env.scratch / 'test-req.txt'])
def test_no_install_followed_by_no_download(): """ Test installing in two steps (first with --no-install, then with --no-download). """ env = reset_env() egg_info_folder = env.site_packages / 'INITools-0.2-py%s.egg-info' % pyversion initools_folder = env.site_packages / 'initools' build_dir = env.venv / 'build' / 'INITools' result1 = run_pip('install', 'INITools==0.2', '--no-install', expect_error=True) assert egg_info_folder not in result1.files_created, str(result1) assert initools_folder not in result1.files_created, sorted( result1.files_created) assert build_dir in result1.files_created, result1.files_created assert build_dir / 'INITools.egg-info' in result1.files_created result2 = run_pip('install', 'INITools==0.2', '--no-download', expect_error=True) assert egg_info_folder in result2.files_created, str(result2) assert initools_folder in result2.files_created, sorted( result2.files_created) assert build_dir not in result2.files_created assert build_dir / 'INITools.egg-info' not in result2.files_created
def test_upgrade_from_reqs_file(): """ Upgrade from a requirements file. """ env = reset_env() write_file( 'test-req.txt', textwrap.dedent("""\ PyLogo<0.4 # and something else to test out: INITools==0.3 """)) install_result = run_pip('install', '-r', env.scratch_path / 'test-req.txt') write_file( 'test-req.txt', textwrap.dedent("""\ PyLogo # and something else to test out: INITools """)) run_pip('install', '--upgrade', '-r', env.scratch_path / 'test-req.txt') uninstall_result = run_pip('uninstall', '-r', env.scratch_path / 'test-req.txt', '-y') assert_all_changes( install_result, uninstall_result, [env.venv / 'build', 'cache', env.scratch / 'test-req.txt'])
def test_create_bundle(): """ Test making a bundle. We'll grab one package from the filesystem (the FSPkg dummy package), one from vcs (initools) and one from an index (pip itself). """ env = reset_env() fspkg = path_to_url2(Path(here) / 'packages' / 'FSPkg') run_pip('install', '-e', fspkg) pkg_lines = textwrap.dedent( '''\ -e %s -e %s#egg=initools-dev pip''' % (fspkg, local_checkout('svn+http://svn.colorstudy.com/INITools/trunk'))) write_file('bundle-req.txt', pkg_lines) # Create a bundle in env.scratch_path/ test.pybundle result = run_pip('bundle', '-r', env.scratch_path / 'bundle-req.txt', env.scratch_path / 'test.pybundle') bundle = result.files_after.get(join('scratch', 'test.pybundle'), None) assert bundle is not None files = zipfile.ZipFile(bundle.full).namelist() assert 'src/FSPkg/' in files assert 'src/initools/' in files assert 'build/pip/' in files