How to use parse_build_isolation method in tox

Best Python code snippet using tox_python

__init__.py

Source:__init__.py Github

copy

Full Screen

...915 if override:916 for name in config.indexserver:917 config.indexserver[name] = IndexServerConfig(name, override)918 self.handle_provision(config, reader)919 self.parse_build_isolation(config, reader)920 res = self._getenvdata(reader, config)921 config.envlist, all_envs, config.envlist_default, config.envlist_explicit = res922 # factors used in config or predefined923 known_factors = self._list_section_factors("testenv")924 known_factors.update({"py", "python"})925 # factors stated in config envlist926 stated_envlist = reader.getstring("envlist", replace=False)927 if stated_envlist:928 for env in _split_env(stated_envlist):929 known_factors.update(env.split("-"))930 # configure testenvs931 to_do = []932 failures = OrderedDict()933 results = {}934 cur_self = self935 def run(name, section, subs, config):936 try:937 results[name] = cur_self.make_envconfig(name, section, subs, config)938 except Exception as exception:939 failures[name] = (exception, traceback.format_exc())940 order = []941 for name in all_envs:942 section = "{}{}".format(testenvprefix, name)943 factors = set(name.split("-"))944 if (945 section in self._cfg946 or factors <= known_factors947 or all(948 tox.PYTHON.PY_FACTORS_RE.match(factor) for factor in factors - known_factors949 )950 ):951 order.append(name)952 thread = Thread(target=run, args=(name, section, reader._subs, config))953 thread.daemon = True954 thread.start()955 to_do.append(thread)956 for thread in to_do:957 while thread.is_alive():958 thread.join(timeout=20)959 if failures:960 raise tox.exception.ConfigError(961 "\n".join(962 "{} failed with {} at {}".format(key, exc, trace)963 for key, (exc, trace) in failures.items()964 )965 )966 for name in order:967 config.envconfigs[name] = results[name]968 all_develop = all(969 name in config.envconfigs and config.envconfigs[name].usedevelop970 for name in config.envlist971 )972 config.skipsdist = reader.getbool("skipsdist", all_develop)973 def handle_provision(self, config, reader):974 requires_list = reader.getlist("requires")975 config.minversion = reader.getstring("minversion", None)976 config.provision_tox_env = name = reader.getstring("provision_tox_env", ".tox")977 min_version = "tox >= {}".format(config.minversion or tox.__version__)978 deps = self.ensure_requires_satisfied(config, requires_list, min_version)979 if config.run_provision:980 section_name = "testenv:{}".format(name)981 if section_name not in self._cfg.sections:982 self._cfg.sections[section_name] = {}983 self._cfg.sections[section_name]["description"] = "meta tox"984 env_config = self.make_envconfig(985 name, "{}{}".format(testenvprefix, name), reader._subs, config986 )987 env_config.deps = deps988 config.envconfigs[config.provision_tox_env] = env_config989 raise tox.exception.MissingRequirement(config)990 # if provisioning is not on, now we need do a strict argument evaluation991 # raise on unknown args992 self.config._parser.parse_cli(args=self.config.args, strict=True)993 @staticmethod994 def ensure_requires_satisfied(config, requires, min_version):995 missing_requirements = []996 failed_to_parse = False997 deps = []998 exists = set()999 for require in requires + [min_version]:1000 # noinspection PyBroadException1001 try:1002 package = pkg_resources.Requirement.parse(require)1003 if package.project_name not in exists:1004 deps.append(DepConfig(require, None))1005 exists.add(package.project_name)1006 pkg_resources.get_distribution(package)1007 except pkg_resources.RequirementParseError as exception:1008 failed_to_parse = True1009 error("failed to parse {!r}".format(exception))1010 except Exception as exception:1011 verbosity1("could not satisfy requires {!r}".format(exception))1012 missing_requirements.append(str(pkg_resources.Requirement(require)))1013 if failed_to_parse:1014 raise tox.exception.BadRequirement()1015 config.run_provision = bool(len(missing_requirements))1016 return deps1017 def parse_build_isolation(self, config, reader):1018 config.isolated_build = reader.getbool("isolated_build", False)1019 config.isolated_build_env = reader.getstring("isolated_build_env", ".package")1020 if config.isolated_build is True:1021 name = config.isolated_build_env1022 section_name = "testenv:{}".format(name)1023 if section_name not in self._cfg.sections:1024 self._cfg.sections[section_name] = {}1025 self._cfg.sections[section_name]["deps"] = ""1026 self._cfg.sections[section_name]["sitepackages"] = "False"1027 self._cfg.sections[section_name]["description"] = "isolated packaging environment"1028 config.envconfigs[name] = self.make_envconfig(1029 name, "{}{}".format(testenvprefix, name), reader._subs, config1030 )1031 def _list_section_factors(self, section):...

Full Screen

Full Screen

config.py

Source:config.py Github

copy

Full Screen

...876 reader.addsubstitutions(distshare=config.distshare)877 config.sdistsrc = reader.getpath("sdistsrc", None)878 config.setupdir = reader.getpath("setupdir", "{toxinidir}")879 config.logdir = config.toxworkdir.join("log")880 self.parse_build_isolation(config, reader)881 config.envlist, all_envs = self._getenvdata(reader, config)882 # factors used in config or predefined883 known_factors = self._list_section_factors("testenv")884 known_factors.update({"py", "python"})885 # factors stated in config envlist886 stated_envlist = reader.getstring("envlist", replace=False)887 if stated_envlist:888 for env in _split_env(stated_envlist):889 known_factors.update(env.split("-"))890 # configure testenvs891 for name in all_envs:892 section = "{}{}".format(testenvprefix, name)893 factors = set(name.split("-"))894 if (895 section in self._cfg896 or factors <= known_factors897 or all(898 tox.PYTHON.PY_FACTORS_RE.match(factor) for factor in factors - known_factors899 )900 ):901 config.envconfigs[name] = self.make_envconfig(name, section, reader._subs, config)902 all_develop = all(903 name in config.envconfigs and config.envconfigs[name].usedevelop904 for name in config.envlist905 )906 config.skipsdist = reader.getbool("skipsdist", all_develop)907 def parse_build_isolation(self, config, reader):908 config.isolated_build = reader.getbool("isolated_build", False)909 config.isolated_build_env = reader.getstring("isolated_build_env", ".package")910 if config.isolated_build is True:911 name = config.isolated_build_env912 if name not in config.envconfigs:913 config.envconfigs[name] = self.make_envconfig(914 name, "{}{}".format(testenvprefix, name), reader._subs, config915 )916 @staticmethod917 def ensure_requires_satisfied(specified):918 missing_requirements = []919 for s in specified:920 try:921 pkg_resources.get_distribution(s)...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tox automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful