Commit a13e913c authored by Jérome Perrin's avatar Jérome Perrin

tests: use _ instead of - in environment variables

This is not really standard and not supported when /bin/sh is dash
parent 756f14bb
...@@ -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)
......
...@@ -3394,8 +3394,8 @@ extdemo_setup_py = r""" ...@@ -3394,8 +3394,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",
...@@ -3539,7 +3539,7 @@ def bootstrapSetup(test): ...@@ -3539,7 +3539,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:
......
  • 93369b04 would be squashed with this commit.

  • Ah yes, it's same. I'm changing this commit to be a fixup of 93369b04 so that git rebase --autosquash can understand this.

  • I was too brief. A fixup is not ideal because the subject of my commit does not apply here. I've just amended.

    Edited by Julien Muchembled
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