Best Python code snippet using tox_python
config.py
Source: config.py
...875 g = match.groupdict()876 sub_value = g['substitution_value']877 if self.crossonly:878 if sub_value.startswith("["):879 return self._substitute_from_other_section(sub_value)880 # in crossonly we return all other hits verbatim881 start, end = match.span()882 return match.string[start:end]883 # special case: all empty values means ":" which is os.pathsep884 if not any(g.values()):885 return os.pathsep886 # special case: opts and packages. Leave {opts} and887 # {packages} intact, they are replaced manually in888 # _venv.VirtualEnv.run_install_command.889 if sub_value in ('opts', 'packages'):890 return '{%s}' % sub_value891 try:892 sub_type = g['sub_type']893 except KeyError:894 raise tox.exception.ConfigError(895 "Malformed substitution; no substitution type provided")896 if sub_type == "env":897 return self._replace_env(match)898 if sub_type is not None:899 raise tox.exception.ConfigError(900 "No support for the %s substitution type" % sub_type)901 return self._replace_substitution(match)902 def _replace_env(self, match):903 envkey = match.group('substitution_value')904 if not envkey:905 raise tox.exception.ConfigError(906 'env: requires an environment variable name')907 default = match.group('default_value')908 envvalue = self.reader.get_environ_value(envkey)909 if envvalue is None:910 if default is None:911 raise tox.exception.ConfigError(912 "substitution env:%r: unknown environment variable %r "913 " or recursive definition." %914 (envkey, envkey))915 return default916 return envvalue917 def _substitute_from_other_section(self, key):918 if key.startswith("[") and "]" in key:919 i = key.find("]")920 section, item = key[1:i], key[i + 1:]921 cfg = self.reader._cfg922 if section in cfg and item in cfg[section]:923 if (section, item) in self.reader._subststack:924 raise ValueError('%s already in %s' % (925 (section, item), self.reader._subststack))926 x = str(cfg[section][item])927 return self.reader._replace(x, name=item, section_name=section,928 crossonly=self.crossonly)929 raise tox.exception.ConfigError(930 "substitution key %r not found" % key)931 def _replace_substitution(self, match):932 sub_key = match.group('substitution_value')933 val = self.reader._subs.get(sub_key, None)934 if val is None:935 val = self._substitute_from_other_section(sub_key)936 if py.builtin.callable(val):937 val = val()938 return str(val)939class _ArgvlistReader:940 @classmethod941 def getargvlist(cls, reader, value):942 """Parse ``commands`` argvlist multiline string.943 :param str name: Key name in a section.944 :param str value: Content stored by key.945 :rtype: list[list[str]]946 :raise :class:`tox.exception.ConfigError`:947 line-continuation ends nowhere while resolving for specified section948 """949 commands = []...
_config.py
Source: _config.py
...545 raise tox.exception.ConfigError(546 "substitution env:%r: unkown environment variable %r" %547 (envkey, envkey))548 return os.environ[envkey]549 def _substitute_from_other_section(self, key):550 if key.startswith("[") and "]" in key:551 i = key.find("]")552 section, item = key[1:i], key[i+1:]553 if section in self._cfg and item in self._cfg[section]:554 if (section, item) in self._subststack:555 raise ValueError('%s already in %s' %(556 (section, item), self._subststack))557 x = str(self._cfg[section][item])558 self._subststack.append((section, item))559 try:560 return self._replace(x)561 finally:562 self._subststack.pop()563 raise tox.exception.ConfigError(564 "substitution key %r not found" % key)565 def _replace_substitution(self, match):566 sub_key = match.group('substitution_value')567 val = self._subs.get(sub_key, None)568 if val is None:569 val = self._substitute_from_other_section(sub_key)570 if py.builtin.callable(val):571 val = val()572 return str(val)573 def _replace_match(self, match):574 g = match.groupdict()575 # special case: opts and packages. Leave {opts} and576 # {packages} intact, they are replaced manually in577 # _venv.VirtualEnv.run_install_command.578 sub_value = g['substitution_value']579 if sub_value in ('opts', 'packages'):580 return '{%s}' % sub_value581 handlers = {582 'env' : self._replace_env,583 None : self._replace_substitution,...
Check out the latest blogs from LambdaTest on this topic:
I was once asked at a testing summit, “How do you manage a QA team using scrum?” After some consideration, I realized it would make a good article, so here I am. Understand that the idea behind developing software in a scrum environment is for development teams to self-organize.
The web paradigm has changed considerably over the last few years. Web 2.0, a term coined way back in 1999, was one of the pivotal moments in the history of the Internet. UGC (User Generated Content), ease of use, and interoperability for the end-users were the key pillars of Web 2.0. Consumers who were only consuming content up till now started creating different forms of content (e.g., text, audio, video, etc.).
Mobile devices and mobile applications – both are booming in the world today. The idea of having the power of a computer in your pocket is revolutionary. As per Statista, mobile accounts for more than half of the web traffic worldwide. Mobile devices (excluding tablets) contributed to 54.4 percent of global website traffic in the fourth quarter of 2021, increasing consistently over the past couple of years.
Even though several frameworks are available in the market for automation testing, Selenium is one of the most renowned open-source frameworks used by experts due to its numerous features and benefits.
JUnit is one of the most popular unit testing frameworks in the Java ecosystem. The JUnit 5 version (also known as Jupiter) contains many exciting innovations, including support for new features in Java 8 and above. However, many developers still prefer to use the JUnit 4 framework since certain features like parallel execution with JUnit 5 are still in the experimental phase.
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!!