Commits

ianb  committed 4dac79c

[svn r21836] Fix tests for running with Python 2.5

  • Participants
  • Parent commits ebdab23
  • Branches trunk

Comments (0)

Files changed (3)

File tests/test_basic.txt

 Next, a simple test::
 
     >>> result = run_pip('install', '-vvv', 'INITools==0.2', expect_error=True)
-    >>> assert (lib_py + 'site-packages/INITools-0.2-py%s.egg-info' % pyversion) in result.files_created
-    >>> assert (lib_py + 'site-packages/initools') in result.files_created
+    >>> assert (lib_py + 'site-packages/INITools-0.2-py%s.egg-info' % pyversion) in result.files_created, str(result) #sorted(result.files_created.keys())
+    >>> assert (lib_py + 'site-packages/initools') in result.files_created, sorted(result.files_created.keys())
 
 Let's try that again, editable::
 

File tests/test_freeze.txt

     >>> import os
     >>> from __main__ import base_path, reset_env, run_pip, pyversion, lib_py, write_file, get_env
 
-Some tests of freeze, first we have to install some stuff::
+Some tests of freeze, first we have to install some stuff.  Note that
+the test is a little crude at the end because Python 2.5+ adds egg
+info to the standard library, so stuff like wsgiref will show up in
+the freezing.  (Probably that should be accounted for in pip, but
+currently it is not).  ::
 
     >>> reset_env()
     >>> write_file('initools-req.txt', '''\
     >>> result = run_pip('install', '-r', 'initools-req.txt')
     >>> result = run_pip('freeze', expect_stderr=True)
     >>> print result
-    Script result: python ../../pip.py -E .../test-scratch freeze
+    Script result: ...python... ../../pip.py -E .../test-scratch freeze
     -- stdout: --------------------
     INITools==0.2
     simplejson==1.7.4
+    ...
     <BLANKLINE>
 
 Now lets try it with an svn checkout::
     ...                  cwd=os.path.join(env.base_path, 'initools-trunk'))
     >>> result = run_pip('freeze', expect_stderr=True)
     >>> print result
-    Script result: python ../../pip.py -E .../test-scratch freeze
+    Script result: ...python... ../../pip.py -E .../test-scratch freeze
     -- stdout: --------------------
-    -e svn+http://svn.colorstudy.com/INITools/trunk@3472#egg=INITools-0.2.1dev_r3472-py2.4-dev
+    -e svn+http://svn.colorstudy.com/INITools/trunk@3472#egg=INITools-0.2.1dev_r3472-py2...-dev
     simplejson==1.7.4
+    ...
     <BLANKLINE>
 
 Now, straight from trunk (but not editable/setup.py develop)::
     >>> result = env.run(os.path.join(env.base_path, 'bin/easy_install'), 'http://svn.colorstudy.com/INITools/trunk')
     >>> result = run_pip('freeze', expect_stderr=True)
     >>> print result
-    Script result: python ../../pip.py -E .../test-scratch freeze
+    Script result: ...python... ../../pip.py -E .../test-scratch freeze
     -- stderr: --------------------
     Warning: cannot find svn location for INITools==...dev-r...
     <BLANKLINE>
     ## FIXME: could not find svn URL in dependency_links for this package:
     INITools==...dev-r...
     simplejson==1.7.4
+    ...
     <BLANKLINE>
 
 Bah, that's no good!  Let's give it a hint::
 
     >>> result = run_pip('freeze', '-f', 'http://svn.colorstudy.com/INITools/trunk#egg=INITools-dev', expect_stderr=True)
     >>> print result
-    Script result: python ../../pip.py -E .../test-scratch freeze -f http://svn.colorstudy.com/INITools/trunk#egg=INITools-dev
+    Script result: ...python... ../../pip.py -E .../test-scratch freeze -f http://svn.colorstudy.com/INITools/trunk#egg=INITools-dev
     -- stdout: --------------------
     -f http://svn.colorstudy.com/INITools/trunk#egg=INITools-dev
     # Installing as editable to satisfy requirement INITools==...dev-r...:
     -e svn+http://svn.colorstudy.com/INITools/trunk@...#egg=INITools-...dev_r...
     simplejson==1.7.4
+    ...
     <BLANKLINE>

File tests/test_pip.py

 def reset_env():
     global env
     env = TestFileEnvironment(base_path, ignore_hidden=False)
-    env.run('virtualenv', '--no-site-packages', env.base_path)
+    env.run(sys.executable, '-m', 'virtualenv', '--no-site-packages', env.base_path)
     # To avoid the 0.9c8 svn 1.5 incompatibility:
     env.run('%s/bin/easy_install' % env.base_path, 'http://peak.telecommunity.com/snapshots/setuptools-0.7a1dev-r66388.tar.gz')
     env.run('mkdir', 'src')
 
 def run_pip(*args, **kw):
     import sys
-    args = ('python', '../../pip.py', '-E', env.base_path) + args
+    args = (sys.executable, '../../pip.py', '-E', env.base_path) + args
     #print >> sys.__stdout__, 'running', ' '.join(args)
     if options.show_error:
         kw['expect_error'] = True