Best Python code snippet using slash
main.py
Source:main.py
...69 core = Core(clear_db=bool(args.clear), log_level=loglevel, debug=args.debug, logger=logger)70 # import builtin plugins here !71 logger.info('search for builtin plugins...')72 from .plugins import install_builtin_plugins73 install_builtin_plugins(core, webserver={'port': args.server_port})74 # import plugins75 logger.info('search for installed plugins...')76 from .core.plugin import find_plugins77 for module_name in find_plugins():78 try:79 core.use(module_name)80 except:81 logger.exception('unable to import %s' % module_name)82 exit_code = 083 def stop(signum, frame):84 logger.warning('signal received %d' % signum)85 core.stop()86 signal.signal(signal.SIGINT, stop)87 signal.signal(signal.SIGTERM, stop)...
test_plugin_config.py
Source:test_plugin_config.py
1import pytest2import slash3from slash.plugins import PluginInterface4@pytest.fixture(autouse=True)5def restore_plugins(request):6 request.addfinalizer(slash.plugins.manager.install_builtin_plugins)7 request.addfinalizer(slash.plugins.manager.uninstall_all)8def test_plugin_config():9 assert 'sample' not in slash.config['plugin_config']10 value = object()11 class Plugin(PluginInterface):12 def get_name(self):13 return 'sample'14 def get_default_config(self):15 return {16 'values': {17 'value_1': value,18 }}19 plugin = Plugin()20 slash.plugins.manager.install(plugin)21 assert slash.config.root.plugin_config.sample.values.value_1 is value22 assert plugin.current_config.values.value_1 is value23 slash.plugins.manager.uninstall('sample')...
__init__.py
Source:__init__.py
...8 builtin_plugins_path = [os.path.dirname(__file__)]9 for loader, module_name, is_pkg in pkgutil.iter_modules(builtin_plugins_path):10 plugins.append(module_name)11 return plugins12def install_builtin_plugins(core, **options):13 for module_name in find_builtin_plugins():14 try:15 mod = importlib.import_module('.%s' % module_name, __name__)16 except:17 core.log.exception('unable to import %s' % module_name)18 else:...
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!!