source: TI12-security/trunk/NDGSecurity/python/buildout/ndgsecurity/eggs/zc.buildout-1.2.1-py2.5.egg/zc/buildout/testselectingpython.py @ 7081

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg-security/TI12-security/trunk/NDGSecurity/python/buildout/ndgsecurity/eggs/zc.buildout-1.2.1-py2.5.egg/zc/buildout/testselectingpython.py@7081
Revision 7081, 2.3 KB checked in by pjkersha, 11 years ago (diff)
  • Property svn:keywords set to Id
Line 
1##############################################################################
2#
3# Copyright (c) 2006 Zope Corporation and Contributors.
4# All Rights Reserved.
5#
6# This software is subject to the provisions of the Zope Public License,
7# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
8# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11# FOR A PARTICULAR PURPOSE.
12#
13##############################################################################
14import os, re, sys, unittest
15from zope.testing import doctest, renormalizing
16import zc.buildout.tests
17import zc.buildout.testing
18
19if sys.version_info[:2] == (2, 4):
20    other_version = "2.5"
21else:
22    other_version = "2.4"
23
24__test__ = dict(
25    test_selecting_python_via_easy_install=
26    """\
27   
28We can specify an specific Python executable.
29
30    >>> dest = tmpdir('sample-install')
31    >>> ws = zc.buildout.easy_install.install(
32    ...     ['demo'], dest, links=[link_server],
33    ...     index='http://www.python.org/pypi/',
34    ...     always_unzip=True, executable= other_executable)
35
36    >>> ls(dest)
37    d  demo-0.3-py%(other_version)s.egg
38    d  demoneeded-1.1-py%(other_version)s.egg
39    d  setuptools-0.6-py%(other_version)s.egg
40
41""" % dict(other_version=other_version)
42    )
43
44def multi_python(test):
45    other_executable = zc.buildout.testing.find_python(other_version)
46    sample_eggs = test.globs['tmpdir']('sample_eggs')
47    os.mkdir(os.path.join(sample_eggs, 'index'))
48    test.globs['sample_eggs'] = sample_eggs
49    zc.buildout.tests.create_sample_eggs(test, executable=other_executable)
50    test.globs['other_executable'] = other_executable
51
52
53def setup(test):
54    zc.buildout.testing.buildoutSetUp(test)
55    multi_python(test)
56    zc.buildout.tests.add_source_dist(test)
57    test.globs['link_server'] = test.globs['start_server'](
58        test.globs['sample_eggs'])
59
60
61def test_suite():
62    return doctest.DocTestSuite(
63        setUp=setup,
64        tearDown=zc.buildout.testing.buildoutTearDown,
65        checker=renormalizing.RENormalizing([
66            (re.compile('setuptools-\S+-py%s.egg' % other_version),
67             'setuptools-V-py%s.egg' % other_version),
68            ]),
69        )
Note: See TracBrowser for help on using the repository browser.