** Description changed:

  [Environment]
  
  Trusty 14.04.2
  python-tox | 1.6.0-1 | trusty/universe                   | all
  
- [Reproduction]
+ [Impact]
  
- Setting an environment variable with:
+ If a user tries to set an environment variable using setenv
+ with a substitution + default value, tox will fail with the exception:
+ 
+ tox.ConfigError: ConfigError: substitution env:'JUJU_TEST_ENV:"test"':
+ unkown environment variable 'JUJU_TEST_ENV:"test"'
+ 
+ [Test Case]
+ 
+ - Write the following example configuration, on a file called tox.ini
+ 
+ [tox]
+ minversion = 1.6
+ envlist = py27,py33,py34,pep8
  
  [testenv]
  usedevelop=True
  deps = -r{toxinidir}/test-requirements.txt
  setenv =
-         JUJU_TEST_ENV = {env:JUJU_TEST_ENV:"test"}
+       JUJU_TEST_ENV = {env:JUJU_TEST_ENV:"test"}
+ commands=
+   nosetests -s -v
  
- Running the specifics steps:
+ 
+ - Run the following command
  
  $JUJU_TEST_ENV="amazon" tox -e py27
+ 
+ The previous command will generate the following traceback:
+ 
  Traceback (most recent call last):
-   File "/usr/bin/tox", line 9, in <module>
-     load_entry_point('tox==1.6.0', 'console_scripts', 'tox')()
-   File "/usr/lib/python2.7/dist-packages/tox/_cmdline.py", line 25, in main
-     config = parseconfig(args, 'tox')
-   File "/usr/lib/python2.7/dist-packages/tox/_config.py", line 44, in 
parseconfig
-     parseini(config, inipath)
-   File "/usr/lib/python2.7/dist-packages/tox/_config.py", line 236, in 
__init__
-     config)
-   File "/usr/lib/python2.7/dist-packages/tox/_config.py", line 292, in 
_makeenvconfig
-     vc.setenv = reader.getdict(section, 'setenv')
-   File "/usr/lib/python2.7/dist-packages/tox/_config.py", line 419, in getdict
-     s = self.getdefault(section, name, None)
-   File "/usr/lib/python2.7/dist-packages/tox/_config.py", line 511, in 
getdefault
-     x = self._replace(x)
-   File "/usr/lib/python2.7/dist-packages/tox/_config.py", line 618, in 
_replace
-     return rexpattern.sub(replace_func, x)
-   File "/usr/lib/python2.7/dist-packages/tox/_config.py", line 609, in 
_replace_match_no_quote
-     return self._replace_match(match, quote=False)
-   File "/usr/lib/python2.7/dist-packages/tox/_config.py", line 604, in 
_replace_match
-     return handler(match, quote)
-   File "/usr/lib/python2.7/dist-packages/tox/_config.py", line 541, in 
_replace_env
-     (envkey, envkey))
+   File "/usr/bin/tox", line 9, in <module>
+     load_entry_point('tox==1.6.0', 'console_scripts', 'tox')()
+   File "/usr/lib/python2.7/dist-packages/tox/_cmdline.py", line 25, in main
+     config = parseconfig(args, 'tox')
+   File "/usr/lib/python2.7/dist-packages/tox/_config.py", line 44, in 
parseconfig
+     parseini(config, inipath)
+   File "/usr/lib/python2.7/dist-packages/tox/_config.py", line 236, in 
__init__
+     config)
+   File "/usr/lib/python2.7/dist-packages/tox/_config.py", line 292, in 
_makeenvconfig
+     vc.setenv = reader.getdict(section, 'setenv')
+   File "/usr/lib/python2.7/dist-packages/tox/_config.py", line 419, in getdict
+     s = self.getdefault(section, name, None)
+   File "/usr/lib/python2.7/dist-packages/tox/_config.py", line 511, in 
getdefault
+     x = self._replace(x)
+   File "/usr/lib/python2.7/dist-packages/tox/_config.py", line 618, in 
_replace
+     return rexpattern.sub(replace_func, x)
+   File "/usr/lib/python2.7/dist-packages/tox/_config.py", line 609, in 
_replace_match_no_quote
+     return self._replace_match(match, quote=False)
+   File "/usr/lib/python2.7/dist-packages/tox/_config.py", line 604, in 
_replace_match
+     return handler(match, quote)
+   File "/usr/lib/python2.7/dist-packages/tox/_config.py", line 541, in 
_replace_env
+     (envkey, envkey))
  tox.ConfigError: ConfigError: substitution env:'JUJU_TEST_ENV:"test"': unkown 
environment variable 'JUJU_TEST_ENV:"test"'
+ 
+ [Expected Results]
+ 
+ - No traceback is generated and the target variable is correctly
+ replaced.
+ 
+ [Regression Potential]
+ 
+ - None that i am aware of.
+ 
+ [Other information]
  
  On the vivid version this seems to works out of the box thanks to this
  patch: https://bitbucket.org/hpk42/tox/pull-request/86/support-optional-
  env-variable-substitution/diff

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1456695

Title:
  tox.ConfigError: ConfigError: substitution env error. Support optional
  ENV variable substitution in tox.ini

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/tox/+bug/1456695/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to