How to use test_plugin_list method in avocado

Best Python code snippet using avocado_python

settings.py

Source:settings.py Github

copy

Full Screen

1"""2The settings in this file will normally be overwritten by the CLI tool, from either3a .env file, or arguments passed on the CLI.4"""5import logging6import sys7from os import getenv as env, getcwd8from os.path import dirname, abspath, join, isabs, exists, expanduser, basename9from typing import Optional, List10from privex.helpers import env_bool, env_int, env_csv, env_cast, empty_if, empty11import dotenv12BASE_DIR = dirname(dirname(abspath(__file__)))13dotenv.load_dotenv()14dotenv.load_dotenv(join(BASE_DIR, '.env'))15dotenv.load_dotenv(join(getcwd(), '.env'))16SEARCH_PATHS = env_csv('SEARCH_PATHS', [getcwd(), BASE_DIR, '~', '/'])17def scan_paths(filename: str, search_dirs: List[str] = None) -> Optional[str]:18 search_dirs = empty_if(search_dirs, SEARCH_PATHS)19 for b in search_dirs:20 f = abspath(expanduser(join(b, filename)))21 if exists(f): return f22 return None23def find_parent(filename: str, rise=1, throw=True) -> Optional[str]:24 parent = dirname(filename)25 26 if isabs(parent):27 if exists(parent):28 return parent29 if rise > 1: return find_parent(dirname(parent), rise=rise-1, throw=throw)30 if throw: raise FileNotFoundError(f"File/folder '{filename}' parent '{parent}' was not found (abs path parent)")31 return None32 33 parent = scan_paths(parent)34 if not empty(parent):35 return parent36 37 if rise > 1: return find_parent(dirname(parent), rise=rise - 1, throw=throw)38 if throw: raise FileNotFoundError(f"File/folder '{filename}' parent '{parent}' was not found (rel path parent search)")39 return None40 41def find_file(filename: str, throw=True) -> Optional[str]:42 """43 Locate the file ``filename``. If ``filename`` is absolute, simply checks if the path exists and returns it intact - otherwise44 raises :class:`.FileNotFoundError`.45 If ``filename`` is relative, searches for the file within the following paths in order:46 * Current working directory47 * :attr:`.BASE_DIR` (root folder of project)48 * ``~/`` (current user's home folder)49 * ``/`` (root folder of system)50 :param str filename: A relative or absolute path to a file to locate.51 :param bool throw: (default: ``True``) If ``True``, will raise :class:`.FileNotFoundError` if ``filename`` cannot be located.52 If set to ``False``, will simply return ``None`` instead of raising an exception.53 :raises FileNotFoundError: Raised when ``throw`` is ``True`` and ``filename`` cannot be located.54 :return Optional[str] full_path: The full, absolute path to the file if it was found. If ``throw`` is ``False`` - ``None`` may be55 returned if ``filename`` isn't found.56 """57 if isabs(filename):58 if not exists(filename):59 if throw: raise FileNotFoundError(f"File/folder '{filename}' was not found (abs path)")60 return None61 return filename62 63 for b in SEARCH_PATHS:64 f = abspath(expanduser(join(b, filename)))65 if exists(f): return f66 67 if throw: raise FileNotFoundError(f"File/folder '{filename}' was not found (rel path search)")68 return None69DEBUG = env_bool('DEBUG', False)70verbose: bool = env_bool('VERBOSE', DEBUG)71quiet: bool = env_bool('QUIET', False)72_LOG_DIR = env('LOG_DIR', join(BASE_DIR, 'logs'))73try:74 LOG_DIR = abspath(join(find_parent(_LOG_DIR), basename(_LOG_DIR)))75except FileNotFoundError as e:76 print(77 f" [!!!] WARNING: Failed to validate LOG_DIR '{_LOG_DIR}' - could not verify parent folder exists."78 f"Exception was: {type(e)} {str(e)}", file=sys.stderr79 )80 print(f" [!!!] Setting LOG_DIR to original value - may be fixed when log folder + containing folders are auto-created.",81 file=sys.stderr)82 LOG_DIR = _LOG_DIR83# Valid environment log levels (from least to most severe) are:84# DEBUG, INFO, WARNING, ERROR, FATAL, CRITICAL85LOG_LEVEL = env('LOG_LEVEL', None)86LOG_LEVEL = logging.getLevelName(str(LOG_LEVEL).upper()) if LOG_LEVEL is not None else None87if LOG_LEVEL is None:88 LOG_LEVEL = logging.DEBUG if DEBUG or verbose else logging.INFO89 LOG_LEVEL = logging.CRITICAL if quiet else LOG_LEVEL90RPC_TIMEOUT = env_int('RPC_TIMEOUT', 3)91MAX_TRIES = env_int('MAX_TRIES', 3)92RETRY_DELAY = env_cast('RETRY_DELAY', cast=float, env_default=2.0)93PUB_PREFIX = env('PUB_PREFIX', 'STM') # Used as part of the thorough plugin tests for checking correct keys are returned94TEST_PLUGINS_LIST = env_csv('TEST_PLUGIN_LIST', [])95"""96Controls which plugins are tested by :class:`.RPCScanner` when :attr:`rpcscanner.settings.plugins` is97set to ``True``.98If the TEST_PLUGINS_LIST is empty, it will be populated automatically when the module container :class:`.MethodTests`99is loaded, which will replace it with a tuple containing :attr:`rpcscanner.MethodTests.METHOD_MAP`.100"""101EXTRA_PLUGINS_LIST = env_csv('EXTRA_PLUGINS_LIST', [])102"""103Additional RPC methods to test - add to your ``.env`` as comma separated RPC method names.104Will be appended to ``TEST_PLUGIN_LIST``105Example ``.env`` entry::106 107 EXTRA_PLUGINS_LIST=condenser_api.some_method,block_api.another_method108"""109TEST_PLUGINS_LIST = tuple(TEST_PLUGINS_LIST + EXTRA_PLUGINS_LIST)110SKIP_API_LIST = env_csv('SKIP_API_LIST', env_csv('SKIP_APIS', []))111GOOD_RETURN_CODE = env_int('GOOD_RETURN_CODE', 0)112BAD_RETURN_CODE = env_int('BAD_RETURN_CODE', 8)113plugins: bool = env_bool('PLUGINS', False)114node_file: str = env('NODE_FILE', 'nodes.conf')115test_account: str = env('TEST_ACCOUNT', 'someguy123')116test_post: str = env('TEST_POST', 'announcement-soft-fork-0-22-2-released-steem-in-a-box-update')...

Full Screen

Full Screen

test_qltk_pluginwin.py

Source:test_qltk_pluginwin.py Github

copy

Full Screen

...29 win.destroy()30 def test_plugin_error_window(self):31 win = PluginErrorWindow(None, {"foo": ["bar", "quux"]})32 win.destroy()33 def test_plugin_list(self):34 model = ObjectStore()35 model.append([PLUGIN])36 plist = PluginListView()37 plist.set_model(model)38 with realized(plist):39 plist.select_by_plugin_id("foobar")40 plist.destroy()41 def test_filter_combo(self):42 combo = PluginFilterCombo()43 combo.refill(["a", "b", "c"], True)44 self.assertEqual(combo.get_active_tag()[1], ComboType.ALL)45 combo.destroy()46 def test_plugin_prefs(self):47 cont = PluginPreferencesContainer()...

Full Screen

Full Screen

test_plugin.py

Source:test_plugin.py Github

copy

Full Screen

2from asciidoc.plugin import Plugin3from .utils import Struct, TEST_DIR4PLUGIN_DIR = TEST_DIR / 'plugin'5CONFIG = Struct(get_load_dirs=lambda: [str(PLUGIN_DIR)], verbose=True)6def test_plugin_list(capsys) -> None:7 plugin = Plugin('backend', Message(None, None, CONFIG, None), CONFIG)8 plugin.list([])9 captured = capsys.readouterr()10 backend_dir = PLUGIN_DIR / 'backends'11 assert captured.out == "{}\n{}\n".format(backend_dir / 'bar', backend_dir / 'foo')...

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 avocado 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