# Buggy code
def setupenv(self, venv):
    if not venv.matching_platform():
        venv.status = "platform mismatch"
        return  # we simply omit non-matching platforms
    action = self.newaction(venv, "getenv", venv.envconfig.envdir)
    with action:
        venv.status = 0
        envlog = self.resultlog.get_envlog(venv.name)
        try:
            status = venv.update(action=action)
        except IOError as e:
            if e.args[0] != 2:
                raise
            status = (
                "Error creating virtualenv. Note that spaces in paths are "
                "not supported by virtualenv. Error details: %r" % e
            )
        except tox.exception.InvocationError as e:
            status = (
                "Error creating virtualenv. Note that some special "
                "characters (e.g. ':' and unicode symbols) in paths are "
                "not supported by virtualenv. Error details: %r" % e
            )
        if status:
            commandlog = envlog.get_commandlog("setup")
            commandlog.add_command(["setup virtualenv"], str(status), 1)
            venv.status = status
            self.report.error(str(status))
            return False
        commandpath = venv.getcommandpath("python")
        envlog.set_python_info(commandpath)
        return True


# 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 setupenv(self, venv):
    if venv.envconfig.missing_subs:
        venv.status = (
            "unresolvable substitution(s): %s. "
            "Environment variables are missing or defined recursively."
            % (",".join(["'%s'" % m for m in venv.envconfig.missing_subs]))
        )
        return
    if not venv.matching_platform():
        venv.status = "platform mismatch"
        return  # we simply omit non-matching platforms
    action = self.newaction(venv, "getenv", venv.envconfig.envdir)
    with action:
        venv.status = 0
        envlog = self.resultlog.get_envlog(venv.name)
        try:
            status = venv.update(action=action)
        except IOError as e:
            if e.args[0] != 2:
                raise
            status = (
                "Error creating virtualenv. Note that spaces in paths are "
                "not supported by virtualenv. Error details: %r" % e
            )
        except tox.exception.InvocationError as e:
            status = (
                "Error creating virtualenv. Note that some special "
                "characters (e.g. ':' and unicode symbols) in paths are "
                "not supported by virtualenv. Error details: %r" % e
            )
        if status:
            commandlog = envlog.get_commandlog("setup")
            commandlog.add_command(["setup virtualenv"], str(status), 1)
            venv.status = status
            self.report.error(str(status))
            return False
        commandpath = venv.getcommandpath("python")
        envlog.set_python_info(commandpath)
        return True