Best Python code snippet using tox_python
__init__.py
Source:__init__.py
...1074 setattr(tc, env_attr.name, res)1075 if atype in ("path", "string", "basepython"):1076 reader.addsubstitutions(**{env_attr.name: res})1077 return tc1078 def _getallenvs(self, reader, extra_env_list=None):1079 extra_env_list = extra_env_list or []1080 env_str = reader.getstring("envlist", replace=False)1081 env_list = _split_env(env_str)1082 for env in extra_env_list:1083 if env not in env_list:1084 env_list.append(env)1085 all_envs = OrderedDict((i, None) for i in env_list)1086 for section in self._cfg:1087 if section.name.startswith(testenvprefix):1088 all_envs[section.name[len(testenvprefix) :]] = None1089 if not all_envs:1090 all_envs["python"] = None1091 return list(all_envs.keys())1092 def _getenvdata(self, reader, config):1093 from_option = self.config.option.env1094 from_environ = os.environ.get("TOXENV")1095 from_config = reader.getstring("envlist", replace=False)1096 env_list = []1097 envlist_explicit = False1098 if (from_option and "ALL" in from_option) or (1099 not from_option and from_environ and "ALL" in from_environ.split(",")1100 ):1101 all_envs = self._getallenvs(reader)1102 else:1103 candidates = (1104 (os.environ.get(PARALLEL_ENV_VAR_KEY), True),1105 (from_option, True),1106 (from_environ, True),1107 (from_config, False),1108 )1109 env_str, envlist_explicit = next(((i, e) for i, e in candidates if i), ([], False))1110 env_list = _split_env(env_str)1111 all_envs = self._getallenvs(reader, env_list)1112 if not env_list:1113 env_list = all_envs1114 package_env = config.isolated_build_env1115 if config.isolated_build is True and package_env in all_envs:1116 all_envs.remove(package_env)1117 if config.isolated_build is True and package_env in env_list:1118 msg = "isolated_build_env {} cannot be part of envlist".format(package_env)1119 raise tox.exception.ConfigError(msg)1120 return env_list, all_envs, _split_env(from_config), envlist_explicit1121def _split_env(env):1122 """if handed a list, action="append" was used for -e """1123 if env is None:1124 return []1125 if not isinstance(env, list):...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!