Best Python code snippet using tox_python
__init__.py
Source:__init__.py
...203 """204 pm = get_plugin_manager(plugins)205 config, option = parse_cli(args, pm)206 update_default_reporter(config.option.quiet_level, config.option.verbose_level)207 for config_file in propose_configs(option.configfile):208 config_type = config_file.basename209 content = None210 if config_type == "pyproject.toml":211 toml_content = get_py_project_toml(config_file)212 try:213 content = toml_content["tool"]["tox"]["legacy_tox_ini"]214 except KeyError:215 continue216 ParseIni(config, config_file, content)217 pm.hook.tox_configure(config=config) # post process config object218 break219 else:220 msg = "tox config file (either {}) not found"221 candidates = ", ".join(INFO.CONFIG_CANDIDATES)222 feedback(msg.format(candidates), sysexit=not (option.help or option.helpini))223 return config224def get_py_project_toml(path):225 with open(str(path)) as file_handler:226 config_data = toml.load(file_handler)227 return config_data228def propose_configs(cli_config_file):229 from_folder = py.path.local()230 if cli_config_file is not None:231 if os.path.isfile(cli_config_file):232 yield py.path.local(cli_config_file)233 return234 if os.path.isdir(cli_config_file):235 from_folder = py.path.local(cli_config_file)236 else:237 print(238 "ERROR: {} is neither file or directory".format(cli_config_file), file=sys.stderr239 )240 return241 for basename in INFO.CONFIG_CANDIDATES:242 if from_folder.join(basename).isfile():...
config.py
Source:config.py
...176 :raise SystemExit: toxinit file is not found177 """178 pm = get_plugin_manager(plugins)179 config, option = parse_cli(args, pm)180 for config_file in propose_configs(option.configfile):181 config_type = config_file.basename182 content = None183 if config_type == "pyproject.toml":184 toml_content = get_py_project_toml(config_file)185 try:186 content = toml_content["tool"]["tox"]["legacy_tox_ini"]187 except KeyError:188 continue189 ParseIni(config, config_file, content)190 pm.hook.tox_configure(config=config) # post process config object191 break192 else:193 msg = "tox config file (either {}) not found"194 candidates = ", ".join(INFO.CONFIG_CANDIDATES)195 feedback(msg.format(candidates), sysexit=not (option.help or option.helpini))196 return config197def get_py_project_toml(path):198 with open(str(path)) as file_handler:199 config_data = toml.load(file_handler)200 return config_data201def propose_configs(cli_config_file):202 from_folder = py.path.local()203 if cli_config_file is not None:204 if os.path.isfile(cli_config_file):205 yield py.path.local(cli_config_file)206 return207 if os.path.isdir(cli_config_file):208 from_folder = py.path.local(cli_config_file)209 else:210 print(211 "ERROR: {} is neither file or directory".format(cli_config_file), file=sys.stderr212 )213 return214 for basename in INFO.CONFIG_CANDIDATES:215 if from_folder.join(basename).isfile():...
plugin.py
Source:plugin.py
...6def get_tox_conffile():7 parser = tox.config.Parser()8 tox.config.tox_addoption(parser)9 option, _ = parser.argparser.parse_known_args(sys.argv)10 for f in tox.config.propose_configs(option.configfile):11 conf_file = f12 return conf_file13def get_hooks_file():14 return os.path.abspath(get_tox_conffile().dirname) + '/toxhooks.py'15def load_hooks_file():16 hooks_file = get_hooks_file()17 if not os.path.isfile(hooks_file):18 return19 try:20 spec = importlib.util.spec_from_file_location("toxhooks", hooks_file)21 hook = importlib.util.module_from_spec(spec)22 spec.loader.exec_module(hook)23 for attr in dir(hook):24 if attr.startswith('tox_'):...
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!!