def test_freeze_svn(script, tmpdir): """Test freezing a svn checkout""" checkout_path = local_checkout( 'svn+http://svn.colorstudy.com/INITools/trunk', tmpdir.join("cache"), ) # svn internally stores windows drives as uppercase; we'll match that. checkout_path = checkout_path.replace('c:', 'C:') # Checkout script.run( 'svn', 'co', '-r10', local_repo( 'svn+http://svn.colorstudy.com/INITools/trunk', tmpdir.join("cache"), ), 'initools-trunk', ) # Install with develop script.run( 'python', 'setup.py', 'develop', cwd=script.scratch_path / 'initools-trunk', expect_stderr=True, ) result = script.pip('freeze', expect_stderr=True) expected = textwrap.dedent("""\ Script result: pip freeze -- stdout: -------------------- ...-e %s@10#egg=INITools-0.3.1dev...-dev_r10 ...""" % checkout_path) _check_output(result, expected)
def _test_uninstall_editable_with_source_outside_venv(tmpdir): env = reset_env() result = env.run('git', 'clone', local_repo('git+git://github.com/pypa/virtualenv'), tmpdir) result2 = run_pip('install', '-e', tmpdir) assert (join(env.site_packages, 'virtualenv.egg-link') in result2.files_created), list(result2.files_created.keys()) result3 = run_pip('uninstall', '-y', 'virtualenv', expect_error=True) assert_all_changes(result, result3, [env.venv/'build'])
def test_freeze_git_clone(script, tmpdir): """ Test freezing a Git clone. """ result = script.run('git', 'clone', local_repo('git+http://github.com/pypa/pip-test-package.git', tmpdir.join("cache")), 'pip-test-package', expect_stderr=True) result = script.run('git', 'checkout', '7d654e66c8fa7149c165ddeffa5b56bc06619458', cwd=script.scratch_path / 'pip-test-package', expect_stderr=True) result = script.run('python', 'setup.py', 'develop', cwd=script.scratch_path / 'pip-test-package') result = script.pip('freeze', expect_stderr=True) expected = textwrap.dedent("""\ Script result: ...pip freeze -- stdout: -------------------- ...-e %s@...#egg=pip_test_package-... ...""" % local_checkout('git+http://github.com/pypa/pip-test-package.git', tmpdir.join("cache"))) _check_output(result, expected) result = script.pip('freeze', '-f', '%s#egg=pip_test_package' % local_checkout('git+http://github.com/pypa/pip-test-package.git', tmpdir.join("cache")), expect_stderr=True) expected = textwrap.dedent("""\ Script result: pip freeze -f %(repo)s#egg=pip_test_package -- stdout: -------------------- -f %(repo)s#egg=pip_test_package... -e %(repo)s@...#egg=pip_test_package-0.1.1 ...""" % {'repo': local_checkout('git+http://github.com/pypa/pip-test-package.git', tmpdir.join("cache"))}) _check_output(result, expected)
def test_freeze_mercurial_clone(script, tmpdir): """ Test freezing a Mercurial clone. """ result = script.run('hg', 'clone', '-r', 'c9963c111e7c', local_repo('hg+http://bitbucket.org/pypa/pip-test-package', tmpdir.join("cache")), 'pip-test-package') result = script.run('python', 'setup.py', 'develop', cwd=script.scratch_path/'pip-test-package', expect_stderr=True) result = script.pip('freeze', expect_stderr=True) expected = textwrap.dedent("""\ Script result: ...pip freeze -- stdout: -------------------- ...-e %s@...#egg=pip_test_package-... ...""" % local_checkout('hg+http://bitbucket.org/pypa/pip-test-package', tmpdir.join("cache"))) _check_output(result, expected) result = script.pip('freeze', '-f', '%s#egg=pip_test_package' % local_checkout('hg+http://bitbucket.org/pypa/pip-test-package', tmpdir.join("cache")), expect_stderr=True) expected = textwrap.dedent("""\ Script result: ...pip freeze -f %(repo)s#egg=pip_test_package -- stdout: -------------------- -f %(repo)s#egg=pip_test_package ...-e %(repo)s@...#egg=pip_test_package-dev ...""" % {'repo': local_checkout('hg+http://bitbucket.org/pypa/pip-test-package', tmpdir.join("cache"))}) _check_output(result, expected)
def test_freeze_mercurial_clone(script, tmpdir): """ Test freezing a Mercurial clone. """ result = script.run( 'hg', 'clone', '-r', 'c9963c111e7c', local_repo( 'hg+http://bitbucket.org/pypa/pip-test-package', tmpdir.join("cache"), ), 'pip-test-package', ) result = script.run( 'python', 'setup.py', 'develop', cwd=script.scratch_path / 'pip-test-package', expect_stderr=True, ) result = script.pip('freeze', expect_stderr=True) expected = textwrap.dedent( """ Script result: ...pip freeze -- stdout: -------------------- ...-e %s@...#egg=pip_test_package-... ... """ % local_checkout( 'hg+http://bitbucket.org/pypa/pip-test-package', tmpdir.join("cache"), ), ).strip() _check_output(result, expected) result = script.pip( 'freeze', '-f', '%s#egg=pip_test_package' % local_checkout( 'hg+http://bitbucket.org/pypa/pip-test-package', tmpdir.join("cache"), ), expect_stderr=True, ) expected = textwrap.dedent( """ Script result: ...pip freeze -f %(repo)s#egg=pip_test_package -- stdout: -------------------- -f %(repo)s#egg=pip_test_package ...-e %(repo)s@...#egg=pip_test_package-dev ... """ % { 'repo': local_checkout( 'hg+http://bitbucket.org/pypa/pip-test-package', tmpdir.join("cache"), ), }, ).strip() _check_output(result, expected)
def test_freeze_svn(): """Test freezing a svn checkout""" checkout_path = local_checkout( 'svn+http://svn.colorstudy.com/INITools/trunk') #svn internally stores windows drives as uppercase; we'll match that. checkout_path = checkout_path.replace('c:', 'C:') env = reset_env() result = env.run( 'svn', 'co', '-r10', local_repo('svn+http://svn.colorstudy.com/INITools/trunk'), 'initools-trunk') result = env.run('python', 'setup.py', 'develop', cwd=env.scratch_path / 'initools-trunk', expect_stderr=True) result = run_pip('freeze', expect_stderr=True) expected = textwrap.dedent("""\ Script result: ...pip freeze -- stdout: -------------------- -e %s@10#egg=INITools-0.3.1dev...-dev_r10 ...""" % checkout_path) _check_output(result, expected)
def _test_uninstall_editable_with_source_outside_venv(script, tmpdir, cache_dir): result = script.run( 'git', 'clone', local_repo( 'git+git://github.com/pypa/pip-test-package', cache_dir, ), tmpdir, expect_stderr=True, ) result2 = script.pip('install', '-e', tmpdir) assert join(script.site_packages, 'pip-test-package.egg-link') in result2.files_created, list( result2.files_created.keys()) result3 = script.pip('uninstall', '-y', 'pip-test-package', expect_error=True) assert_all_changes( result, result3, [script.venv / 'build', script.site_packages / 'easy-install.pth'], )
def test_freeze_bazaar_clone(script, tmpdir): """ Test freezing a Bazaar clone. """ checkout_path = local_checkout('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1', tmpdir.join("cache")) #bzr internally stores windows drives as uppercase; we'll match that. checkout_pathC = checkout_path.replace('c:', 'C:') result = script.run('bzr', 'checkout', '-r', '174', local_repo('bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/release-0.1', tmpdir.join("cache")), 'django-wikiapp') result = script.run('python', 'setup.py', 'develop', cwd=script.scratch_path/'django-wikiapp') result = script.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 = script.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_bazaar_clone(script, tmpdir): """ Test freezing a Bazaar clone. """ checkout_path = local_checkout( 'bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/' 'release-0.1', tmpdir.join("cache"), ) # bzr internally stores windows drives as uppercase; we'll match that. checkout_pathC = checkout_path.replace('c:', 'C:') result = script.run( 'bzr', 'checkout', '-r', '174', local_repo( 'bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp/' 'release-0.1', tmpdir.join("cache"), ), 'django-wikiapp', ) result = script.run( 'python', 'setup.py', 'develop', cwd=script.scratch_path / 'django-wikiapp', expect_stderr=True, ) result = script.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 = script.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_uninstall_editable_with_source_outside_venv(tmpdir): env = reset_env() result = env.run('git', 'clone', local_repo('git+git://github.com/pypa/virtualenv'), tmpdir) result2 = run_pip('install', '-e', tmpdir) assert (join(env.site_packages, 'virtualenv.egg-link') in result2.files_created), list(result2.files_created.keys()) result3 = run_pip('uninstall', '-y', 'virtualenv', expect_error=True) assert_all_changes(result, result3, [env.venv / 'build'])
def test_freeze_git_clone(script, tmpdir): """ Test freezing a Git clone. """ result = script.run('git', 'clone', local_repo( 'git+http://github.com/pypa/pip-test-package.git', tmpdir.join("cache")), 'pip-test-package', expect_stderr=True) result = script.run('git', 'checkout', '7d654e66c8fa7149c165ddeffa5b56bc06619458', cwd=script.scratch_path / 'pip-test-package', expect_stderr=True) result = script.run('python', 'setup.py', 'develop', cwd=script.scratch_path / 'pip-test-package') result = script.pip('freeze', expect_stderr=True) expected = textwrap.dedent( """\ Script result: ...pip freeze -- stdout: -------------------- ...-e %s@...#egg=pip_test_package-... ...""" % local_checkout('git+http://github.com/pypa/pip-test-package.git', tmpdir.join("cache"))) _check_output(result, expected) result = script.pip( 'freeze', '-f', '%s#egg=pip_test_package' % local_checkout('git+http://github.com/pypa/pip-test-package.git', tmpdir.join("cache")), expect_stderr=True) expected = textwrap.dedent( """\ Script result: pip freeze -f %(repo)s#egg=pip_test_package -- stdout: -------------------- -f %(repo)s#egg=pip_test_package... -e %(repo)s@...#egg=pip_test_package-0.1.1 ...""" % { 'repo': local_checkout('git+http://github.com/pypa/pip-test-package.git', tmpdir.join("cache")) }) _check_output(result, expected)
def _test_uninstall_editable_with_source_outside_venv( script, tmpdir, temp_pkg_dir, ): result = script.run( 'git', 'clone', local_repo('git+git://github.com/pypa/pip-test-package', tmpdir), temp_pkg_dir, expect_stderr=True, ) result2 = script.pip('install', '-e', temp_pkg_dir) result2.did_create(join( script.site_packages, 'pip-test-package.egg-link' )) result3 = script.pip('uninstall', '-y', 'pip-test-package') assert_all_changes( result, result3, [script.venv / 'build', script.site_packages / 'easy-install.pth'], )
def test_freeze_mercurial_clone(): """ Test freezing a Mercurial clone. """ reset_env() env = get_env() result = env.run( 'hg', 'clone', '-r', 'c9963c111e7c', local_repo('hg+http://bitbucket.org/pypa/pip-test-package'), 'pip-test-package') result = env.run('python', 'setup.py', 'develop', cwd=env.scratch_path / 'pip-test-package', expect_stderr=True) result = run_pip('freeze', expect_stderr=True) expected = textwrap.dedent( """\ Script result: ...pip freeze -- stdout: -------------------- ...-e %s@...#egg=pip_test_package-... ...""" % local_checkout('hg+http://bitbucket.org/pypa/pip-test-package')) _check_output(result, expected) result = run_pip( 'freeze', '-f', '%s#egg=pip_test_package' % local_checkout('hg+http://bitbucket.org/pypa/pip-test-package'), expect_stderr=True) expected = textwrap.dedent("""\ Script result: ...pip freeze -f %(repo)s#egg=pip_test_package -- stdout: -------------------- -f %(repo)s#egg=pip_test_package ...-e %(repo)s@...#egg=pip_test_package-dev ...""" % { 'repo': local_checkout('hg+http://bitbucket.org/pypa/pip-test-package') }) _check_output(result, expected)
def test_freeze_svn(): """Test freezing a svn checkout""" checkout_path = local_checkout('svn+http://svn.colorstudy.com/INITools/trunk') #svn internally stores windows drives as uppercase; we'll match that. checkout_path = checkout_path.replace('c:', 'C:') env = reset_env() result = env.run('svn', 'co', '-r10', local_repo('svn+http://svn.colorstudy.com/INITools/trunk'), 'initools-trunk') result = env.run('python', 'setup.py', 'develop', cwd=env.scratch_path/ 'initools-trunk', expect_stderr=True) result = run_pip('freeze', expect_stderr=True) expected = textwrap.dedent("""\ Script result: ...pip freeze -- stdout: -------------------- -e %s@10#egg=INITools-0.3.1dev...-dev_r10 ...""" % checkout_path) _check_output(result, expected)
def _test_uninstall_editable_with_source_outside_venv( script: PipTestEnvironment, tmpdir: Path, temp_pkg_dir: str, ) -> None: result = script.run( "git", "clone", local_repo("git+https://github.com/pypa/pip-test-package", tmpdir), temp_pkg_dir, expect_stderr=True, ) result2 = script.pip("install", "-e", temp_pkg_dir) result2.did_create(join(script.site_packages, "pip-test-package.egg-link")) result3 = script.pip("uninstall", "-y", "pip-test-package") assert_all_changes( result, result3, [script.venv / "build", script.site_packages / "easy-install.pth"], )
def _test_uninstall_editable_with_source_outside_venv( script, tmpdir, cache_dir): result = script.run( 'git', 'clone', local_repo( 'git+git://github.com/pypa/virtualenv', cache_dir, ), tmpdir, expect_stderr=True, ) result2 = script.pip('install', '-e', tmpdir) assert join( script.site_packages, 'virtualenv.egg-link' ) in result2.files_created, list(result2.files_created.keys()) result3 = script.pip('uninstall', '-y', 'virtualenv', expect_error=True) assert_all_changes( result, result3, [script.venv/'build', script.site_packages/'easy-install.pth'], )
def test_freeze_git_clone(script, tmpdir): """ Test freezing a Git clone. """ result = script.run( 'git', 'clone', local_repo( 'git+http://github.com/pypa/pip-test-package.git', tmpdir.join("cache"), ), 'pip-test-package', expect_stderr=True, ) repo_dir = script.scratch_path / 'pip-test-package' result = script.run( 'git', 'checkout', '7d654e66c8fa7149c165ddeffa5b56bc06619458', cwd=repo_dir, expect_stderr=True, ) result = script.run( 'python', 'setup.py', 'develop', cwd=repo_dir ) result = script.pip('freeze', expect_stderr=True) expected = textwrap.dedent( """ Script result: ...pip freeze -- stdout: -------------------- ...-e %s@...#egg=pip_test_package-... ... """ % local_checkout( 'git+http://github.com/pypa/pip-test-package.git', tmpdir.join("cache"), ) ).strip() _check_output(result, expected) result = script.pip( 'freeze', '-f', '%s#egg=pip_test_package' % local_checkout( 'git+http://github.com/pypa/pip-test-package.git', tmpdir.join("cache"), ), expect_stderr=True, ) expected = textwrap.dedent( """ Script result: pip freeze -f %(repo)s#egg=pip_test_package -- stdout: -------------------- -f %(repo)s#egg=pip_test_package... -e %(repo)s@...#egg=pip_test_package-0.1.1 ... """ % { 'repo': local_checkout( 'git+http://github.com/pypa/pip-test-package.git', tmpdir.join("cache"), ), }, ).strip() _check_output(result, expected) # Check that slashes in branch or tag names are translated. # See also issue #1083: https://github.com/pypa/pip/issues/1083 script.run( 'git', 'checkout', '-b', 'branch/name/with/slash', cwd=repo_dir, expect_stderr=True, ) # Create a new commit to ensure that the commit has only one branch # or tag name associated to it (to avoid the non-determinism reported # in issue #1867). script.run( 'git', 'revert', '--no-edit', 'HEAD', cwd=repo_dir, ) result = script.pip('freeze', expect_stderr=True) expected = textwrap.dedent( """ Script result: ...pip freeze -- stdout: -------------------- ...-e ...@...#egg=pip_test_package-branch_name_with_slash... ... """ ).strip() _check_output(result, expected)