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_bazaar_clone(): """ Test freezing a Bazaar clone. """ checkout_path = local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1') #bzr internally stores windows drives as uppercase; we'll match that. checkout_pathC = checkout_path.replace('c:', 'C:') 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-... ...""" % checkout_pathC) _check_output(result, expected) result = run_pip('freeze', '-f', '%s/#egg=django-wikiapp' % checkout_path, expect_stderr=True) expected = textwrap.dedent("""\ Script result: ...pip freeze -f %(repo)s/#egg=django-wikiapp -- stdout: -------------------- -f %(repo)s/#egg=django-wikiapp ...-e %(repoC)s@...#egg=django_wikiapp-... ...""" % {'repoC': checkout_pathC, 'repo': checkout_path}) _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', '7bc186caa7dc', local_repo('hg+http://bitbucket.org/jezdez/django-authority'), 'django-authority') result = env.run('python', 'setup.py', 'develop', cwd=env.scratch_path/'django-authority', expect_stderr=True) result = run_pip('freeze', expect_stderr=True) expected = textwrap.dedent("""\ Script result: ...pip freeze -- stdout: -------------------- -e %s@...#egg=django_authority-... ...""" % local_checkout('hg+http://bitbucket.org/jezdez/django-authority')) _check_output(result, expected) result = run_pip('freeze', '-f', '%s#egg=django_authority' % local_checkout('hg+http://bitbucket.org/jezdez/django-authority'), expect_stderr=True) expected = textwrap.dedent("""\ Script result: ...pip freeze -f %(repo)s#egg=django_authority -- stdout: -------------------- -f %(repo)s#egg=django_authority -e %(repo)s@...#egg=django_authority-dev ...""" % {'repo': local_checkout('hg+http://bitbucket.org/jezdez/django-authority')}) _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', '7bc186caa7dc', local_repo('hg+http://bitbucket.org/jezdez/django-authority'), 'django-authority') result = env.run('python', 'setup.py', 'develop', cwd=env.scratch_path/'django-authority', expect_stderr=True) result = run_pip('freeze', expect_stderr=True) expected = textwrap.dedent("""\ Script result: ...pip freeze -- stdout: -------------------- ...-e %s@...#egg=django_authority-... ...""" % local_checkout('hg+http://bitbucket.org/jezdez/django-authority')) _check_output(result, expected) result = run_pip('freeze', '-f', '%s#egg=django_authority' % local_checkout('hg+http://bitbucket.org/jezdez/django-authority'), expect_stderr=True) expected = textwrap.dedent("""\ Script result: ...pip freeze -f %(repo)s#egg=django_authority -- stdout: -------------------- -f %(repo)s#egg=django_authority ...-e %(repo)s@...#egg=django_authority-dev ...""" % {'repo': local_checkout('hg+http://bitbucket.org/jezdez/django-authority')}) _check_output(result, expected)
def setup_completion(words, cword): environ = os.environ.copy() reset_env(environ) environ['PIP_AUTO_COMPLETE'] = '1' environ['COMP_WORDS'] = words environ['COMP_CWORD'] = cword 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) return result, env
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)