Commit 32facc78 authored by Jérome Perrin's avatar Jérome Perrin Committed by Julien Muchembled

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.

Rebase instructions:
- squash with 93369b04
  and keep the above commit message

fixup! Fix testing index when /bin/sh is dash (like on Debian)
parent 121b182f
......@@ -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)
......
......@@ -3394,8 +3394,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",
......@@ -3539,7 +3539,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