Best Python code snippet using slash
local_config.py
Source:local_config.py
...13 def pop_path(self):14 self._configs.pop(-1)15 def get_dict(self):16 return self._configs[-1]17 def _iter_slashconf_paths(self, dir_path):18 slashconf_path = os.path.join(dir_path, 'slashconf.py')19 slashconf_dir = os.path.join(dir_path, 'slashconf')20 if os.path.isfile(slashconf_path):21 assert not os.path.isdir(slashconf_dir), \22 f"Cannot use both file and directory for configuration in the same path ({dir_path!r})"23 yield slashconf_path24 elif os.path.isdir(slashconf_dir):25 for root, _, files in os.walk(slashconf_dir):26 for file_name in files:27 if file_name.endswith(".py"):28 yield os.path.join(root, file_name)29 def _build_config(self, path):30 confstack = []31 for dir_path in self._traverse_upwards(path):32 slashconf_vars = self._slashconf_vars_cache.get(dir_path)33 if slashconf_vars is None:34 slashconf_vars = {}35 for slashconf_path in self._iter_slashconf_paths(dir_path):36 self.duplicate_funcs |= check_duplicate_functions(slashconf_path)37 with dessert.rewrite_assertions_context():38 slashconf_vars.update(vars(import_file(slashconf_path)))39 if slashconf_vars:40 confstack.append(slashconf_vars)41 self._slashconf_vars_cache[dir_path] = slashconf_vars42 returned = {}43 # start loading from the parent so that vars are properly overriden44 for slashconf_vars in reversed(confstack):45 returned.update(slashconf_vars)46 return returned47 def _traverse_upwards(self, path):48 path = os.path.abspath(path)49 if not os.path.exists(path):...
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!!