# Buggy code
def make_envconfig(self, name, section, subs, config, replace=True):
    factors = set(name.split("-"))
    reader = SectionReader(
        section, self._cfg, fallbacksections=["testenv"], factors=factors
    )
    vc = TestenvConfig(config=config, envname=name, factors=factors, reader=reader)
    reader.addsubstitutions(**subs)
    reader.addsubstitutions(envname=name)
    reader.addsubstitutions(
        envbindir=vc.get_envbindir,
        envsitepackagesdir=vc.get_envsitepackagesdir,
        envpython=vc.get_envpython,
    )

    for env_attr in config._testenv_attr:
        atype = env_attr.type
        if atype in (
            "bool",
            "path",
            "string",
            "dict",
            "dict_setenv",
            "argv",
            "argvlist",
        ):
            meth = getattr(reader, "get" + atype)
            res = meth(env_attr.name, env_attr.default, replace=replace)
        elif atype == "space-separated-list":
            res = reader.getlist(env_attr.name, sep=" ")
        elif atype == "line-list":
            res = reader.getlist(env_attr.name, sep="\n")
        else:
            raise ValueError("unknown type %r" % (atype,))

        if env_attr.postprocess:
            res = env_attr.postprocess(testenv_config=vc, value=res)
        setattr(vc, env_attr.name, res)

        if atype in ("path", "string"):
            reader.addsubstitutions(**{env_attr.name: res})

    return vc


# Traceback (ValueError)
2017-09-01 18:22:20.661 | ++ lib/tempest:install_tempest:612          :   pushd /opt/stack/new/tempest
2017-09-01 18:22:20.661 | ~/tempest ~/devstack
2017-09-01 18:22:20.662 | ++ lib/tempest:install_tempest:613          :   tox -r --notest -efull
2017-09-01 18:22:21.720 | Traceback (most recent call last):
2017-09-01 18:22:21.720 |   File "/usr/local/bin/tox", line 11, in <module>
2017-09-01 18:22:21.720 |     sys.exit(cmdline())
2017-09-01 18:22:21.720 |   File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 38, in main
2017-09-01 18:22:21.720 |     config = prepare(args)
2017-09-01 18:22:21.720 |   File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 26, in prepare
2017-09-01 18:22:21.720 |     config = parseconfig(args)
2017-09-01 18:22:21.720 |   File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 242, in parseconfig
2017-09-01 18:22:21.720 |     parseini(config, inipath)
2017-09-01 18:22:21.720 |   File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 796, in __init__
2017-09-01 18:22:21.721 |     replace=name in config.envlist)
2017-09-01 18:22:21.721 |   File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 827, in make_envconfig
2017-09-01 18:22:21.721 |     res = meth(env_attr.name, env_attr.default, replace=replace)
2017-09-01 18:22:21.721 |   File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 964, in getdict_setenv
2017-09-01 18:22:21.721 |     definitions = self._getdict(value, default=default, sep=sep)
2017-09-01 18:22:21.721 |   File "/usr/local/lib/python2.7/dist-packages/tox/config.py", line 975, in _getdict
2017-09-01 18:22:21.721 |     name, rest = line.split('=', 1)
2017-09-01 18:22:21.721 | ValueError: need more than 1 value to unpack
2017-09-01 18:22:21.733 | + lib/tempest:install_tempest:1            :   exit_trap

# Fixed code
def make_envconfig(self, name, section, subs, config, replace=True):
    factors = set(name.split("-"))
    reader = SectionReader(
        section, self._cfg, fallbacksections=["testenv"], factors=factors
    )
    tc = TestenvConfig(name, config, factors, reader)
    reader.addsubstitutions(
        envname=name,
        envbindir=tc.get_envbindir,
        envsitepackagesdir=tc.get_envsitepackagesdir,
        envpython=tc.get_envpython,
        **subs,
    )
    for env_attr in config._testenv_attr:
        atype = env_attr.type
        try:
            if atype in (
                "bool",
                "path",
                "string",
                "dict",
                "dict_setenv",
                "argv",
                "argvlist",
            ):
                meth = getattr(reader, "get" + atype)
                res = meth(env_attr.name, env_attr.default, replace=replace)
            elif atype == "space-separated-list":
                res = reader.getlist(env_attr.name, sep=" ")
            elif atype == "line-list":
                res = reader.getlist(env_attr.name, sep="\n")
            else:
                raise ValueError("unknown type %r" % (atype,))
            if env_attr.postprocess:
                res = env_attr.postprocess(testenv_config=tc, value=res)
        except tox.exception.MissingSubstitution as e:
            tc.missing_subs.append(e.name)
            res = e.FLAG
        setattr(tc, env_attr.name, res)
        if atype in ("path", "string"):
            reader.addsubstitutions(**{env_attr.name: res})
    return tc