Commit f0d0ef63 authored by jim's avatar jim

A number of tests depended on being able to put scripts in a shebang

line and thus failed on Mac OS X and other popular unix platforms.

Disabling these tests except on windows and new linux.


git-svn-id: http://svn.zope.org/repos/main/zc.buildout/trunk@121009 62d5b8a3-27da-0310-9561-8e5933582275
parent 5d5a2438
......@@ -40,6 +40,18 @@ from zc.buildout.rmtree import rmtree
fsync = getattr(os, 'fsync', lambda fileno: None)
is_win32 = sys.platform == 'win32'
# Only some unixes allow scripts in shebang lines:
script_in_shebang = is_win32
if sys.platform == 'linux2':
f = subprocess.Popen('uname -r', shell=True, stdout=subprocess.PIPE).stdout
r = f.read().strip()
f.close()
r = tuple(map(int, re.match(r'\d+(\.\d+)*', r).group(0).split('.')))
if r >= (2, 6, 27, 9):
# http://www.in-ulm.de/~mascheck/various/shebang/
script_in_shebang = True
setuptools_location = pkg_resources.working_set.find(
pkg_resources.Requirement.parse('setuptools')).location
......
......@@ -29,7 +29,6 @@ os_path_sep = os.path.sep
if os_path_sep == '\\':
os_path_sep *= 2
def develop_w_non_setuptools_setup_scripts():
"""
We should be able to deal with setup scripts that aren't setuptools based.
......@@ -1966,6 +1965,10 @@ results for the interpreter and for the script.
<BLANKLINE>
"""
if not zc.buildout.testing.script_in_shebang:
del handle_namespace_package_in_both_site_packages_and_buildout_eggs
def handle_sys_path_version_hack():
r"""
This is a test for a bugfix.
......@@ -2352,6 +2355,9 @@ site-packages are at the end. They were not before this bugfix.
<BLANKLINE>
"""
if not zc.buildout.testing.script_in_shebang:
del allowed_eggs_from_site_packages_bug_592524
def subprocesses_have_same_environment_by_default():
"""
The scripts generated by sitepackage_safe_scripts set the PYTHONPATH so that,
......@@ -2584,8 +2590,11 @@ Now we actually run the buildout.
"""
if sys.version_info > (2, 4):
def test_exit_codes():
if not zc.buildout.testing.script_in_shebang:
del bootstrap_makes_buildout_that_works_with_system_python
def test_exit_codes():
"""
>>> import subprocess
>>> def call(s):
......@@ -4093,7 +4102,6 @@ def test_suite():
(re.compile('\- demoneeded'), 'd demoneeded'),
]),
),
zc.buildout.testselectingpython.test_suite(),
zc.buildout.rmtree.test_suite(),
doctest.DocFileSuite(
'windows.txt',
......@@ -4138,6 +4146,10 @@ def test_suite():
),
]
if zc.buildout.testing.script_in_shebang:
test_suite.append(zc.buildout.testselectingpython.test_suite())
# adding bootstrap.txt doctest to the suite
# only if bootstrap.py is present
bootstrap_py = os.path.join(
......
......@@ -69,6 +69,9 @@ some initialization that we can look for.
foo bar baz shazam
"""
if not zc.buildout.testing.script_in_shebang:
del supports_python_option
def interpreter_recipe_supports_extra_paths_option():
"""
This shows that specifying extra-paths will affect sys.path.
......@@ -195,6 +198,10 @@ custom Python.
"""
if not zc.buildout.testing.script_in_shebang:
del interpreter_recipe_supports_initialization_option
def interpreter_recipe_supports_relative_paths_option():
"""
This shows that the relative-paths option affects the code for inserting
......@@ -418,6 +425,22 @@ def setUpSelecting(test):
def test_suite():
suite = unittest.TestSuite((
doctest.DocTestSuite(
setUp=setUp,
tearDown=zc.buildout.testing.buildoutTearDown,
checker=renormalizing.RENormalizing([
zc.buildout.testing.normalize_path,
zc.buildout.testing.normalize_endings,
zc.buildout.testing.normalize_egg_py,
zc.buildout.tests.hide_distribute_additions,
zc.buildout.tests.hide_first_index_page_message,
(re.compile(r'[a-zA-Z]:\\\\foo\\\\bar'), '/foo/bar'),
]),
),
))
if zc.buildout.testing.script_in_shebang:
suite.addTest(
doctest.DocFileSuite(
'README.txt',
setUp=setUp, tearDown=zc.buildout.testing.buildoutTearDown,
......@@ -431,8 +454,10 @@ def test_suite():
zc.buildout.tests.hide_first_index_page_message,
(re.compile(r'zc.buildout(-\S+)?[.]egg(-link)?'),
'zc.buildout.egg'),
(re.compile('[-d] (setuptools|distribute)-[^-]+-'), 'setuptools-X-'),
(re.compile(r'(setuptools|distribute)-[\w.]+-py'), 'setuptools-X-py'),
(re.compile('[-d] (setuptools|distribute)-[^-]+-'),
'setuptools-X-'),
(re.compile(r'(setuptools|distribute)-[\w.]+-py'),
'setuptools-X-py'),
(re.compile(r'eggs\\\\demo'), 'eggs/demo'),
(re.compile(r'[a-zA-Z]:\\\\foo\\\\bar'), '/foo/bar'),
(re.compile(r'\#!\S+\bpython\S*'), '#!/usr/bin/python'),
......@@ -442,20 +467,6 @@ def test_suite():
'os.execve(sys.executable, argv, environ)'),
(re.compile('distribute'), 'setuptools'),
])
),
doctest.DocTestSuite(
setUp=setUp,
tearDown=zc.buildout.testing.buildoutTearDown,
checker=renormalizing.RENormalizing([
zc.buildout.testing.normalize_path,
zc.buildout.testing.normalize_endings,
zc.buildout.testing.normalize_egg_py,
zc.buildout.tests.hide_distribute_additions,
zc.buildout.tests.hide_first_index_page_message,
(re.compile(r'[a-zA-Z]:\\\\foo\\\\bar'), '/foo/bar'),
]),
),
))
return suite
......
......@@ -138,9 +138,7 @@ def test_suite():
),
))
if sys.version_info[:2] != (2, 4):
# Only run selecting python tests if not 2.4, since
# 2.4 is the alternate python used in the tests.
if zc.buildout.testing.script_in_shebang:
suite.addTest(
doctest.DocFileSuite(
'selecting-python.txt',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment