How to use python_resolver method in avocado

Best Python code snippet using avocado_python

test_dependency_resolver.py

Source:test_dependency_resolver.py Github

copy

Full Screen

...7@pytest.fixture8def ruby_resolver():9 return DependencyResolver(RubyPackageRegistry(http_compression=False))10@pytest.fixture11def python_resolver():12 return DependencyResolver(PythonPackageRegistry(http_compression=False))13def check_leaf_status(node, should_be_leaf):14 assert (node.is_leaf == should_be_leaf), (15 f'Node {str(node.version)} has leaf status {node.is_leaf}, but expetation is {should_be_leaf}')16def check_hidden_status(node, should_be_hidden):17 assert (node.hidden == should_be_hidden), (18 f'Node {str(node.version)} has hidden status {node.hidden}, but expetation is {should_be_hidden}')19def check_number(node, expected_number):20 assert node.number == expected_number, (21 f'Node {str(node.version)} does not match version number {expected_number}')22def check_kind(node, expected_kind):23 assert node.kind == expected_kind, (24 f'Node {str(node.version)} with kind {node.kind} does not expected kind {expected_kind}')25def assert_leaf(root, expected_path, expected_number, expected_kind=DependencyKind.RUNTIME):...

Full Screen

Full Screen

resolvers.py

Source:resolvers.py Github

copy

Full Screen

...37 return ReferenceResolution(reference,38 ReferenceResolutionResult.SUCCESS,39 [Runnable('exec-test', reference,40 config=settings.as_dict(r'^runner\.'))])41def python_resolver(name, reference, find_tests):42 module_path, tests_filter = reference_split(reference)43 if tests_filter is not None:44 tests_filter = re.compile(tests_filter)45 criteria_check = check_file(module_path, reference)46 if criteria_check is not True:47 return criteria_check48 # disabled tests not needed here49 class_methods_info, _ = find_tests(module_path)50 runnables = []51 for klass, methods_tags_reqs in class_methods_info.items():52 for (method, tags, reqs) in methods_tags_reqs:53 klass_method = "%s.%s" % (klass, method)54 if tests_filter is not None and not tests_filter.search(klass_method):55 continue56 uri = "%s:%s" % (module_path, klass_method)57 runnables.append(Runnable(name,58 uri=uri,59 tags=tags,60 requirements=reqs,61 config=settings.as_dict(r'^runner\.')))62 if runnables:63 return ReferenceResolution(reference,64 ReferenceResolutionResult.SUCCESS,65 runnables)66 return ReferenceResolution(reference,67 ReferenceResolutionResult.NOTFOUND)68class PythonUnittestResolver(Resolver):69 name = 'python-unittest'70 description = 'Test resolver for Python Unittests'71 @staticmethod72 def _find_compat(module_path):73 """Used as compatibility for the :func:`python_resolver()` interface."""74 return find_python_unittests(module_path), None75 @staticmethod76 def resolve(reference):77 return python_resolver(PythonUnittestResolver.name,78 reference,79 PythonUnittestResolver._find_compat)80class AvocadoInstrumentedResolver(Resolver):81 name = 'avocado-instrumented'82 description = 'Test resolver for Avocado Instrumented tests'83 @staticmethod84 def resolve(reference):85 return python_resolver(AvocadoInstrumentedResolver.name,86 reference,87 find_avocado_tests)88class TapResolver(Resolver):89 name = 'tap'90 description = 'Test resolver for executable files to be handled as tests'91 @staticmethod92 def resolve(reference):93 criteria_check = check_file(reference, reference, suffix=None,94 type_name='executable file',95 access_check=os.R_OK | os.X_OK,96 access_name='executable')97 if criteria_check is not True:98 return criteria_check99 return ReferenceResolution(reference,...

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