[Pytest-commit] Issue #288: Recursive replacement when getdict('setenv') (hpk42/tox)

kozhukalov issues-reply at bitbucket.org
Fri Nov 20 02:57:37 EST 2015


New issue 288: Recursive replacement when getdict('setenv')
https://bitbucket.org/hpk42/tox/issues/288/recursive-replacement-when-getdict-setenv

kozhukalov:

The thing is that when config.py module replaces
macros in setenv dict, it calls getdict('setenv')
which recursively tries to replace macros.
So, python reports 'maximum recursion depth exceeded' error.

This patch fixes the issue

```
--- a/tox/config.py	Wed Nov 11 15:58:33 2015 +0100
+++ b/tox/config.py	Fri Nov 20 10:45:40 2015 +0300
@@ -835,8 +835,8 @@
             return []
         return [x.strip() for x in s.split(sep) if x.strip()]
 
-    def getdict(self, name, default=None, sep="\n"):
-        s = self.getstring(name, None)
+    def getdict(self, name, default=None, sep="\n", replace=True):
+        s = self.getstring(name, None, replace=replace)
         if s is None:
             return default or {}
 
@@ -910,7 +910,7 @@
         return '\n'.join(filter(None, map(factor_line, lines)))
 
     def _replace_env(self, match):
-        env_list = self.getdict('setenv')
+        env_list = self.getdict('setenv', replace=False)
         match_value = match.group('substitution_value')
         if not match_value:
             raise tox.exception.ConfigError(

```






More information about the pytest-commit mailing list