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',
'-mZqNxd', tmpeggs]
find_links = os.environ.get(
'bootstrap-testing-find-links',
'bootstrap_testing_find_links',
options.find_links or
('http://downloads.buildout.org/'
if options.accept_buildout_test_releases else None)
......
......@@ -46,7 +46,7 @@ def realpath(path):
return os.path.normcase(os.path.abspath(_oprp(path)))
default_index_url = os.environ.get(
'buildout-testing-index-url',
'BUILDOUT_TESTING_INDEX_URL',
'https://pypi.org/simple',
)
......
......@@ -230,7 +230,7 @@ def buildoutSetUp(test):
register_teardown(lambda: rmtree(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)
def tmpdir(name):
......
......@@ -3390,8 +3390,8 @@ extdemo_setup_py = r"""
import os, sys
from distutils.core import setup, Extension
if os.environ.get('test-variable'):
print("Have environment test-variable: %%s" %% os.environ['test-variable'])
if os.environ.get('test_variable'):
print("Have environment test_variable: %%s" %% os.environ['test_variable'])
setup(name = "extdemo", version = "%s", url="http://www.zope.org",
author="Demo", author_email="demo@demo.com",
......@@ -3429,7 +3429,7 @@ def easy_install_SetUp(test):
def buildout_txt_setup(test):
zc.buildout.testing.buildoutSetUp(test)
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
create_sample_eggs(test)
......@@ -3531,7 +3531,7 @@ def bootstrapSetup(test):
ws = getWorkingSetWithBuildoutEgg(test)
makeNewRelease('zc.buildout', ws, sample_eggs, '2.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
normalize_bang = (
......
......@@ -246,7 +246,7 @@ We won't get an update.
- zc.recipe.egg.egg-link
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:
>>> print_(system(buildout), end='') # doctest: +ELLIPSIS
......@@ -318,8 +318,8 @@ recipe was run.
...
... def install(self):
... logging.getLogger(self.name).info(
... 'test-variable left over: %s' % (
... 'test-variable' in os.environ))
... 'test_variable left over: %s' % (
... 'test_variable' in os.environ))
... return []
...
... def update(self):
......@@ -345,7 +345,7 @@ Create our buildout:
... parts = extdemo checkenv
...
... [extdemo-env]
... test-variable = foo
... test_variable = foo
...
... [extdemo]
... recipe = zc.recipe.egg:custom
......@@ -363,13 +363,13 @@ Create our buildout:
Uninstalling demo.
Uninstalling extdemo.
Installing extdemo.
Have environment test-variable: foo
Have environment test_variable: foo
zip_safe flag not set; analyzing archive contents...
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.
removed).
......@@ -377,14 +377,14 @@ When an environment variable has a value before zc.recipe.egg:custom is run,
the original value will be restored:
>>> import os
>>> os.environ['test-variable'] = 'bar'
>>> os.environ['test_variable'] = 'bar'
>>> print_(system(buildout), end='')
Develop: '/sample-buildout/recipes'
Updating extdemo.
Updating checkenv.
checkenv: test-variable left over: True
checkenv: test_variable left over: True
>>> os.environ['test-variable']
>>> os.environ['test_variable']
'bar'
......@@ -399,7 +399,7 @@ are interpolated with os.environ before the're set:
... parts = extdemo checkenv
...
... [extdemo-env]
... test-variable = foo:%%(test-variable)s
... test_variable = foo:%%(test_variable)s
...
... [extdemo]
... recipe = zc.recipe.egg:custom
......@@ -416,14 +416,14 @@ are interpolated with os.environ before the're set:
Develop: '/sample-buildout/recipes'
Uninstalling extdemo.
Installing extdemo.
Have environment test-variable: foo:bar
Have environment test_variable: foo:bar
zip_safe flag not set; analyzing archive contents...
Updating checkenv.
...
>>> os.environ['test-variable']
>>> os.environ['test_variable']
'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:
......
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