Skip to content

Commit

Permalink
Ensure isolated env package is not in envlist
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat committed Sep 10, 2018
1 parent db36531 commit ad91247
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/tox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,8 @@ def __init__(self, config, inipath): # noqa
config.logdir = config.toxworkdir.join("log")
self._make_thread_safe_path(config, "logdir", unique_id)

config.envlist, all_envs = self._getenvdata(reader)
self.parse_build_isolation(config, reader)
config.envlist, all_envs = self._getenvdata(reader, config)

# factors used in config or predefined
known_factors = self._list_section_factors("testenv")
Expand Down Expand Up @@ -1005,7 +1006,6 @@ def __init__(self, config, inipath): # noqa
)

config.skipsdist = reader.getbool("skipsdist", all_develop)
self.parse_build_isolation(config, reader)

def parse_build_isolation(self, config, reader):
config.isolated_build = reader.getbool("isolated_build", False)
Expand All @@ -1016,9 +1016,6 @@ def parse_build_isolation(self, config, reader):
config.envconfigs[name] = self.make_envconfig(
name, testenvprefix + name, reader._subs, config
)
if config.isolated_build_env in config.envlist:
msg = "isolated_build_env {} cannot be part of envlist".format(name)
raise tox.exception.ConfigError(msg)

def _make_thread_safe_path(self, config, attr, unique_id):
if config.option.parallel_safe_build:
Expand Down Expand Up @@ -1083,7 +1080,7 @@ def make_envconfig(self, name, section, subs, config, replace=True):
reader.addsubstitutions(**{env_attr.name: res})
return tc

def _getenvdata(self, reader):
def _getenvdata(self, reader, config):
candidates = (
self.config.option.env,
os.environ.get("TOXENV"),
Expand All @@ -1100,9 +1097,17 @@ def _getenvdata(self, reader):
if not all_envs:
all_envs.add("python")

package_env = config.isolated_build_env
if config.isolated_build is True:
all_envs.remove(package_env)

if not env_list or "ALL" in env_list:
env_list = sorted(all_envs)

if config.isolated_build is True and package_env in env_list:
msg = "isolated_build_env {} cannot be part of envlist".format(package_env)
raise tox.exception.ConfigError(msg)

return env_list, all_envs


Expand Down

0 comments on commit ad91247

Please sign in to comment.