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_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_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_completion_for_default_parameters(): """ Test getting completion for ``--`` should contain --help """ environ = os.environ.copy() reset_env(environ) environ['PIP_AUTO_COMPLETE'] = '1' environ['COMP_WORDS'] = 'pip --' environ['COMP_CWORD'] = '1' env = get_env() # expect_error is True because autocomplete exists with 1 status code result = env.run('python', '-c', 'import pip;pip.autocomplete()', expect_error=True) assert '--help' in result.stdout,\ "autocomplete function could not complete ``--``"
def test_completion_for_un_snippet(): """ Test getting completion for ``un`` should return uninstall and unzip """ environ = os.environ.copy() reset_env(environ) environ['PIP_AUTO_COMPLETE'] = '1' environ['COMP_WORDS'] = 'pip un' environ['COMP_CWORD'] = '1' env = get_env() # expect_error is True because autocomplete exists with 1 status code result = env.run('python', '-c', 'import pip;pip.autocomplete()', expect_error=True) assert result.stdout.strip().split() == ['unzip', 'uninstall'],\ "autocomplete function could not complete ``un`` snippet"
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_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-dev ...""" % { 'repo': local_checkout('hg+http://bitbucket.org/jezdez/django-dbtemplates') }) _check_output(result, expected)
def test_freeze_bazaar_clone(): """ Test freezing a Bazaar clone. """ reset_env() env = get_env() result = env.run( "bzr", "checkout", "-r", "174", "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 bzr+http://bazaar.launchpad.net/...django-wikiapp/django-wikiapp/release-0.1/@...#egg=django_wikiapp-... ...""" ) _check_output(result, expected) result = run_pip( "freeze", "-f", "bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1/#egg=django-wikiapp", expect_stderr=True, ) expected = textwrap.dedent( """\ Script result: ...pip freeze -f bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1/#egg=django-wikiapp -- stdout: -------------------- -f bzr+http://bazaar.launchpad.net/...django-wikiapp/django-wikiapp/release-0.1/#egg=django-wikiapp -e bzr+http://bazaar.launchpad.net/...django-wikiapp/django-wikiapp/release-0.1/@...#egg=django_wikiapp-... ...""" ) _check_output(result, expected)