Dave Abrahams  committed 9a8e0c5

Fix testing so it actually tests this source code in an installed
environment, rather than testing the version of pip that has already
been installed. All tests now pass!

  • Participants
  • Parent commits 936701f

Comments (0)

Files changed (3)

     kw = dict(scripts=['scripts/pip'])
+# Allows reset_env in to invoke from outside the
+# directory where it's located, which is needed to prepare a proper
+# virtual environment from without performing unnatural contortions.
       description="pip installs packages.  Python packages.  An easy_install replacement",

File tests/

+    # where this source distribution lives
     base = abspath(join(dirname(__file__), pardir))
+    # output will contain the directory of the invoked pip
     result = run_pip('--version')
-    assert base in result.stdout, result.stdout
+    # compare the directory tree of the invoked pip with that of this source distribution
+    import re,filecmp
+    dir = re.match(r'\s*pip\s\S+\sfrom\s+(.*)\s\([^(]+\)$', result.stdout).group(1)
+    diffs = filecmp.dircmp(join(base,'pip'), join(dir,'pip'))
+    # 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'% (join(base,'pip'), join(dir,'pip'))
 def test_distutils_configuration_setting():

File tests/, '-m', 'virtualenv', '--no-site-packages', env.base_path)
     # make sure we have current setuptools to avoid svn incompatibilities'%s/bin/easy_install' % env.base_path, 'setuptools==0.6c11')
-    # Uninstall (kind of) pip, so PYTHONPATH can take effect:
-'%s/bin/easy_install' % env.base_path, '-m', 'pip')
+    # Uninstall whatever version of pip might have been there
+'%s/bin/pip' % env.base_path, 'uninstall', '-y', 'pip')
+    # Install this version on top of it
+'python', os.path.join(here,os.pardir,''), 'install')
+'mkdir', 'src')
 def run_pip(*args, **kw):