Commit 2e499199 authored by Julien Muchembled's avatar Julien Muchembled Committed by Xavier Thompson

tests: use _ instead of - in environment variables

Contrary to bash, dash filters out environment variables containing
'-' characters. And for example, /bin/sh is dash on Debian.

<rebased>
parent 9033b31d
...@@ -139,7 +139,7 @@ cmd = [sys.executable, '-c', ...@@ -139,7 +139,7 @@ cmd = [sys.executable, '-c',
'-mZqNxd', tmpeggs] '-mZqNxd', tmpeggs]
find_links = os.environ.get( find_links = os.environ.get(
'bootstrap-testing-find-links', 'bootstrap_testing_find_links',
options.find_links or options.find_links or
('http://downloads.buildout.org/' ('http://downloads.buildout.org/'
if options.accept_buildout_test_releases else None) if options.accept_buildout_test_releases else None)
......
...@@ -46,7 +46,7 @@ def realpath(path): ...@@ -46,7 +46,7 @@ def realpath(path):
return os.path.normcase(os.path.abspath(_oprp(path))) return os.path.normcase(os.path.abspath(_oprp(path)))
default_index_url = os.environ.get( default_index_url = os.environ.get(
'buildout-testing-index-url', 'BUILDOUT_TESTING_INDEX_URL',
'https://pypi.org/simple', 'https://pypi.org/simple',
) )
......
...@@ -230,7 +230,7 @@ def buildoutSetUp(test): ...@@ -230,7 +230,7 @@ def buildoutSetUp(test):
register_teardown(lambda: rmtree(tmp)) register_teardown(lambda: rmtree(tmp))
zc.buildout.easy_install.default_index_url = 'file://'+tmp zc.buildout.easy_install.default_index_url = 'file://'+tmp
os.environ['buildout-testing-index-url'] = ( os.environ['BUILDOUT_TESTING_INDEX_URL'] = (
zc.buildout.easy_install.default_index_url) zc.buildout.easy_install.default_index_url)
def tmpdir(name): def tmpdir(name):
......
...@@ -3390,8 +3390,8 @@ extdemo_setup_py = r""" ...@@ -3390,8 +3390,8 @@ extdemo_setup_py = r"""
import os, sys import os, sys
from distutils.core import setup, Extension from distutils.core import setup, Extension
if os.environ.get('test-variable'): if os.environ.get('test_variable'):
print("Have environment test-variable: %%s" %% os.environ['test-variable']) print("Have environment test_variable: %%s" %% os.environ['test_variable'])
setup(name = "extdemo", version = "%s", url="http://www.zope.org", setup(name = "extdemo", version = "%s", url="http://www.zope.org",
author="Demo", author_email="demo@demo.com", author="Demo", author_email="demo@demo.com",
...@@ -3429,7 +3429,7 @@ def easy_install_SetUp(test): ...@@ -3429,7 +3429,7 @@ def easy_install_SetUp(test):
def buildout_txt_setup(test): def buildout_txt_setup(test):
zc.buildout.testing.buildoutSetUp(test) zc.buildout.testing.buildoutSetUp(test)
mkdir = test.globs['mkdir'] mkdir = test.globs['mkdir']
eggs = os.environ['buildout-testing-index-url'][7:] eggs = os.environ['BUILDOUT_TESTING_INDEX_URL'][7:]
test.globs['sample_eggs'] = eggs test.globs['sample_eggs'] = eggs
create_sample_eggs(test) create_sample_eggs(test)
...@@ -3531,7 +3531,7 @@ def bootstrapSetup(test): ...@@ -3531,7 +3531,7 @@ def bootstrapSetup(test):
ws = getWorkingSetWithBuildoutEgg(test) ws = getWorkingSetWithBuildoutEgg(test)
makeNewRelease('zc.buildout', ws, sample_eggs, '2.0.0') makeNewRelease('zc.buildout', ws, sample_eggs, '2.0.0')
makeNewRelease('zc.buildout', ws, sample_eggs, '22.0.0') makeNewRelease('zc.buildout', ws, sample_eggs, '22.0.0')
os.environ['bootstrap-testing-find-links'] = test.globs['link_server'] os.environ['bootstrap_testing_find_links'] = test.globs['link_server']
test.globs['bootstrap_py'] = bootstrap_py test.globs['bootstrap_py'] = bootstrap_py
normalize_bang = ( normalize_bang = (
......
...@@ -246,7 +246,7 @@ We won't get an update. ...@@ -246,7 +246,7 @@ We won't get an update.
- zc.recipe.egg.egg-link - zc.recipe.egg.egg-link
But if we run the buildout in the default on-line and newest modes, we But if we run the buildout in the default on-line and newest modes, we
will. This time we also get the test-variable message again, because the new will. This time we also get the test_variable message again, because the new
version is imported: version is imported:
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS >>> print_(system(buildout), end='') # doctest: +ELLIPSIS
...@@ -318,8 +318,8 @@ recipe was run. ...@@ -318,8 +318,8 @@ recipe was run.
... ...
... def install(self): ... def install(self):
... logging.getLogger(self.name).info( ... logging.getLogger(self.name).info(
... 'test-variable left over: %s' % ( ... 'test_variable left over: %s' % (
... 'test-variable' in os.environ)) ... 'test_variable' in os.environ))
... return [] ... return []
... ...
... def update(self): ... def update(self):
...@@ -345,7 +345,7 @@ Create our buildout: ...@@ -345,7 +345,7 @@ Create our buildout:
... parts = extdemo checkenv ... parts = extdemo checkenv
... ...
... [extdemo-env] ... [extdemo-env]
... test-variable = foo ... test_variable = foo
... ...
... [extdemo] ... [extdemo]
... recipe = zc.recipe.egg:custom ... recipe = zc.recipe.egg:custom
...@@ -363,13 +363,13 @@ Create our buildout: ...@@ -363,13 +363,13 @@ Create our buildout:
Uninstalling demo. Uninstalling demo.
Uninstalling extdemo. Uninstalling extdemo.
Installing extdemo. Installing extdemo.
Have environment test-variable: foo Have environment test_variable: foo
zip_safe flag not set; analyzing archive contents... zip_safe flag not set; analyzing archive contents...
Installing checkenv. Installing checkenv.
... ...
The setup.py also printed out that we have set the environment `test-variable` The setup.py also printed out that we have set the environment `test_variable`
to foo. After the buildout the variable is reset to its original value (i.e. to foo. After the buildout the variable is reset to its original value (i.e.
removed). removed).
...@@ -377,14 +377,14 @@ When an environment variable has a value before zc.recipe.egg:custom is run, ...@@ -377,14 +377,14 @@ When an environment variable has a value before zc.recipe.egg:custom is run,
the original value will be restored: the original value will be restored:
>>> import os >>> import os
>>> os.environ['test-variable'] = 'bar' >>> os.environ['test_variable'] = 'bar'
>>> print_(system(buildout), end='') >>> print_(system(buildout), end='')
Develop: '/sample-buildout/recipes' Develop: '/sample-buildout/recipes'
Updating extdemo. Updating extdemo.
Updating checkenv. Updating checkenv.
checkenv: test-variable left over: True checkenv: test_variable left over: True
>>> os.environ['test-variable'] >>> os.environ['test_variable']
'bar' 'bar'
...@@ -399,7 +399,7 @@ are interpolated with os.environ before the're set: ...@@ -399,7 +399,7 @@ are interpolated with os.environ before the're set:
... parts = extdemo checkenv ... parts = extdemo checkenv
... ...
... [extdemo-env] ... [extdemo-env]
... test-variable = foo:%%(test-variable)s ... test_variable = foo:%%(test_variable)s
... ...
... [extdemo] ... [extdemo]
... recipe = zc.recipe.egg:custom ... recipe = zc.recipe.egg:custom
...@@ -416,14 +416,14 @@ are interpolated with os.environ before the're set: ...@@ -416,14 +416,14 @@ are interpolated with os.environ before the're set:
Develop: '/sample-buildout/recipes' Develop: '/sample-buildout/recipes'
Uninstalling extdemo. Uninstalling extdemo.
Installing extdemo. Installing extdemo.
Have environment test-variable: foo:bar Have environment test_variable: foo:bar
zip_safe flag not set; analyzing archive contents... zip_safe flag not set; analyzing archive contents...
Updating checkenv. Updating checkenv.
... ...
>>> os.environ['test-variable'] >>> os.environ['test_variable']
'bar' 'bar'
>>> del os.environ['test-variable'] >>> del os.environ['test_variable']
Create a clean buildout.cfg w/o the checkenv recipe, and delete the recipe: Create a clean buildout.cfg w/o the checkenv recipe, and delete the recipe:
......
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