[Checkins] SVN: zc.buildout/trunk/ Rearranged the selecting-python
tests to make it possible to run some
Jim Fulton
jim at zope.com
Sun Jan 13 19:46:41 EST 2008
Log message for revision 82856:
Rearranged the selecting-python tests to make it possible to run some
selecting Python tests without Python 2.3 available, since I've lost
Python 2.3 in my upgrade to Mac OS X 2.5. :(
Changed:
U zc.buildout/trunk/src/zc/buildout/tests.py
U zc.buildout/trunk/src/zc/buildout/testselectingpython.py
U zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt
U zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/tests.py
-=-
Modified: zc.buildout/trunk/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/tests.py 2008-01-13 22:31:40 UTC (rev 82855)
+++ zc.buildout/trunk/src/zc/buildout/tests.py 2008-01-14 00:46:41 UTC (rev 82856)
@@ -21,6 +21,8 @@
import pkg_resources
import zc.buildout.testing, zc.buildout.easy_install
+import zc.buildout.testselectingpython
+
os_path_sep = os.path.sep
if os_path_sep == '\\':
os_path_sep *= 2
@@ -2586,8 +2588,7 @@
)
def test_suite():
- import zc.buildout.testselectingpython
- suite = unittest.TestSuite((
+ return unittest.TestSuite((
doctest.DocFileSuite(
'buildout.txt', 'runsetup.txt', 'repeatable.txt', 'setup.txt',
setUp=zc.buildout.testing.buildoutSetUp,
@@ -2687,11 +2688,7 @@
),
]),
),
+ zc.buildout.testselectingpython.test_suite(),
))
- if sys.version_info[:2] != (2, 3):
- # Only run selecting python tests if not 2.3, since
- # 2.3 is the alternate python used in the tests.
- suite.addTest(zc.buildout.testselectingpython.test_suite())
-
return suite
Modified: zc.buildout/trunk/src/zc/buildout/testselectingpython.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/testselectingpython.py 2008-01-13 22:31:40 UTC (rev 82855)
+++ zc.buildout/trunk/src/zc/buildout/testselectingpython.py 2008-01-14 00:46:41 UTC (rev 82856)
@@ -11,36 +11,43 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-import os, re, unittest
+import os, re, sys, unittest
from zope.testing import doctest, renormalizing
import zc.buildout.tests
import zc.buildout.testing
-def test_selecting_python_via_easy_install():
+if sys.version_info[:2] == (2, 4):
+ other_version = "2.5"
+else:
+ other_version = "2.4"
+
+__test__ = dict(
+ test_selecting_python_via_easy_install=
"""\
-
+
We can specify an specific Python executable.
>>> dest = tmpdir('sample-install')
>>> ws = zc.buildout.easy_install.install(
... ['demo'], dest, links=[link_server],
... index='http://www.python.org/pypi/',
- ... always_unzip=True, executable= python2_3_executable)
+ ... always_unzip=True, executable= other_executable)
>>> ls(dest)
- d demo-0.3-py2.3.egg
- d demoneeded-1.1-py2.3.egg
- d setuptools-0.6-py2.3.egg
+ d demo-0.3-py%(other_version)s.egg
+ d demoneeded-1.1-py%(other_version)s.egg
+ d setuptools-0.6-py%(other_version)s.egg
-"""
+""" % dict(other_version=other_version)
+ )
def multi_python(test):
- p23 = zc.buildout.testing.find_python('2.3')
+ other_executable = zc.buildout.testing.find_python(other_version)
sample_eggs = test.globs['tmpdir']('sample_eggs')
os.mkdir(os.path.join(sample_eggs, 'index'))
test.globs['sample_eggs'] = sample_eggs
- zc.buildout.tests.create_sample_eggs(test, executable=p23)
- test.globs['python2_3_executable'] = p23
+ zc.buildout.tests.create_sample_eggs(test, executable=other_executable)
+ test.globs['other_executable'] = other_executable
def setup(test):
@@ -56,6 +63,7 @@
setUp=setup,
tearDown=zc.buildout.testing.buildoutTearDown,
checker=renormalizing.RENormalizing([
- (re.compile('setuptools-\S+-py2.3.egg'), 'setuptools-V-py2.3.egg'),
+ (re.compile('setuptools-\S+-py%s.egg' % other_version),
+ 'setuptools-V-py%s.egg' % other_version),
]),
)
Modified: zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt 2008-01-13 22:31:40 UTC (rev 82855)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/selecting-python.txt 2008-01-14 00:46:41 UTC (rev 82856)
@@ -1,7 +1,7 @@
Controlling which Python to use
-------------------------------
-The following assumes that you have Python 2.3 installed.
+The following assumes that you have Python 2.4 installed.
We can specify the python to use by specifying the name of a section
to read the Python executable from. The default is the section
@@ -11,20 +11,20 @@
>>> print get(link_server),
<html><body>
- <a href="demo-0.1-py2.3.egg">demo-0.1-py2.3.egg</a><br>
- <a href="demo-0.2-py2.3.egg">demo-0.2-py2.3.egg</a><br>
- <a href="demo-0.3-py2.3.egg">demo-0.3-py2.3.egg</a><br>
- <a href="demo-0.4c1-py2.3.egg">demo-0.4c1-py2.3.egg</a><br>
+ <a href="demo-0.1-py2.4.egg">demo-0.1-py2.4.egg</a><br>
+ <a href="demo-0.2-py2.4.egg">demo-0.2-py2.4.egg</a><br>
+ <a href="demo-0.3-py2.4.egg">demo-0.3-py2.4.egg</a><br>
+ <a href="demo-0.4c1-py2.4.egg">demo-0.4c1-py2.4.egg</a><br>
<a href="demoneeded-1.0.zip">demoneeded-1.0.zip</a><br>
<a href="demoneeded-1.1.zip">demoneeded-1.1.zip</a><br>
<a href="demoneeded-1.2c1.zip">demoneeded-1.2c1.zip</a><br>
<a href="extdemo-1.4.zip">extdemo-1.4.zip</a><br>
<a href="index/">index/</a><br>
- <a href="other-1.0-py2.3.egg">other-1.0-py2.3.egg</a><br>
+ <a href="other-1.0-py2.4.egg">other-1.0-py2.4.egg</a><br>
</body></html>
We have a sample buildout. Let's update it's configuration file to
-install the demo package using Python 2.3.
+install the demo package using Python 2.4.
>>> write(sample_buildout, 'buildout.cfg',
... """
@@ -33,16 +33,16 @@
... eggs-directory = eggs
... index = http://www.python.org/pypi/
...
- ... [python2.3]
+ ... [python2.4]
... executable = %(python23)s
...
... [demo]
... recipe = zc.recipe.egg
... eggs = demo <0.3
... find-links = %(server)s
- ... python = python2.3
+ ... python = python2.4
... interpreter = py-demo
- ... """ % dict(server=link_server, python23=python2_3_executable))
+ ... """ % dict(server=link_server, python23=other_executable))
Now, if we run the buildout:
@@ -60,16 +60,16 @@
Generated script '/sample-buildout/bin/demo'.
Generated interpreter '/sample-buildout/bin/py-demo'.
-we'll get the Python 2.3 eggs for demo and demoneeded:
+we'll get the Python 2.4 eggs for demo and demoneeded:
>>> ls(sample_buildout, 'eggs')
- - demo-0.2-py2.3.egg
- - demoneeded-1.2c1-py2.3.egg
- d setuptools-0.6-py2.3.egg
+ - demo-0.2-py2.4.egg
+ - demoneeded-1.2c1-py2.4.egg
d setuptools-0.6-py2.4.egg
- - zc.buildout-1.0-py2.4.egg
+ d setuptools-0.6-py2.5.egg
+ - zc.buildout-1.0-py2.5.egg
-And the generated scripts invoke Python 2.3:
+And the generated scripts invoke Python 2.4:
>>> import sys
>>> if sys.platform == 'win32':
@@ -77,14 +77,14 @@
... else:
... script_name = 'demo'
>>> f = open(os.path.join(sample_buildout, 'bin', script_name))
- >>> f.readline().strip() == '#!' + python2_3_executable
+ >>> f.readline().strip() == '#!' + other_executable
True
>>> print f.read(), # doctest: +NORMALIZE_WHITESPACE
<BLANKLINE>
import sys
sys.path[0:0] = [
- '/sample-buildout/eggs/demo-0.2-py2.3.egg',
- '/sample-buildout/eggs/demoneeded-1.2c1-py2.3.egg',
+ '/sample-buildout/eggs/demo-0.2-py2.4.egg',
+ '/sample-buildout/eggs/demoneeded-1.2c1-py2.4.egg',
]
<BLANKLINE>
import eggrecipedemo
@@ -96,14 +96,14 @@
... f = open(os.path.join(sample_buildout, 'bin', 'py-demo-script.py'))
... else:
... f = open(os.path.join(sample_buildout, 'bin', 'py-demo'))
- >>> f.readline().strip() == '#!' + python2_3_executable
+ >>> f.readline().strip() == '#!' + other_executable
True
>>> print f.read(), # doctest: +NORMALIZE_WHITESPACE
import sys
<BLANKLINE>
sys.path[0:0] = [
- '/sample-buildout/eggs/demo-0.2-py2.3.egg',
- '/sample-buildout/eggs/demoneeded-1.2c1-py2.3.egg',
+ '/sample-buildout/eggs/demo-0.2-py2.4.egg',
+ '/sample-buildout/eggs/demoneeded-1.2c1-py2.4.egg',
]
<BLANKLINE>
_interactive = True
Modified: zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/tests.py
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/tests.py 2008-01-13 22:31:40 UTC (rev 82855)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/tests.py 2008-01-14 00:46:41 UTC (rev 82856)
@@ -89,9 +89,9 @@
))
- if sys.version_info[:2] != (2, 3):
- # Only run selecting python tests if not 2.3, since
- # 2.3 is the alternate python used in the tests.
+ if sys.version_info[:2] == (2, 5):
+ # Only run selecting python tests if not 2.4, since
+ # 2.4 is the alternate python used in the tests.
suite.addTest(
doctest.DocFileSuite(
'selecting-python.txt',
@@ -102,7 +102,7 @@
zc.buildout.testing.normalize_script,
(re.compile('Got setuptools \S+'), 'Got setuptools V'),
(re.compile('([d-] )?setuptools-\S+-py'), 'setuptools-V-py'),
- (re.compile('-py2[.][0-24-9][.]'), 'py2.4.'),
+ (re.compile('-py2[.][0-35-9][.]'), 'py2.5.'),
(re.compile('zc.buildout-\S+[.]egg'),
'zc.buildout.egg'),
(re.compile('zc.buildout[.]egg-link'),
More information about the Checkins
mailing list