How to use find_tests method in avocado

Best Python code snippet using avocado_python Github


Full Screen

...5 print_function)6import unittest7from setup import Command8TEST_MODULES = frozenset('srv db polish opf css docx cfi matcher icu smartypants build misc dbcli'.split())9def find_tests(which_tests=None):10 ans = []11 a = ans.append12 def ok(x):13 return not which_tests or x in which_tests14 if ok('build'):15 from calibre.test_build import find_tests16 a(find_tests())17 if ok('srv'):18 from calibre.srv.tests.main import find_tests19 a(find_tests())20 if ok('db'):21 from calibre.db.tests.main import find_tests22 a(find_tests())23 if ok('polish'):24 from calibre.ebooks.oeb.polish.tests.main import find_tests25 a(find_tests())26 if ok('opf'):27 from calibre.ebooks.metadata.opf2 import suite28 a(suite())29 from calibre.ebooks.metadata.opf3_test import suite30 a(suite())31 if ok('css'):32 from tinycss.tests.main import find_tests33 a(find_tests())34 from calibre.ebooks.oeb.normalize_css import test_normalization35 a(test_normalization(return_tests=True))36 from calibre.ebooks.css_transform_rules import test37 a(test(return_tests=True))38 from css_selectors.tests import find_tests39 a(find_tests())40 if ok('docx'):41 from calibre.ebooks.docx.fields import test_parse_fields42 a(test_parse_fields(return_tests=True))43 from calibre.ebooks.docx.writer.utils import test_convert_color44 a(test_convert_color(return_tests=True))45 if ok('cfi'):46 from calibre.ebooks.epub.cfi.tests import find_tests47 a(find_tests())48 if ok('matcher'):49 from calibre.utils.matcher import test50 a(test(return_tests=True))51 if ok('icu'):52 from calibre.utils.icu_test import find_tests53 a(find_tests())54 if ok('smartypants'):55 from calibre.utils.smartypants import run_tests56 a(run_tests(return_tests=True))57 if ok('misc'):58 from calibre.ebooks.metadata.tag_mapper import find_tests59 a(find_tests())60 from calibre.utils.shared_file import find_tests61 a(find_tests())62 from calibre.utils.test_lock import find_tests63 a(find_tests())64 from calibre.utils.search_query_parser_test import find_tests65 a(find_tests())66 if ok('dbcli'):67 from calibre.db.cli.tests import find_tests68 a(find_tests())69 tests = unittest.TestSuite(ans)70 return tests71class Test(Command):72 description = 'Run the calibre test suite'73 def add_options(self, parser):74 parser.add_option('--test-module', '--test-group', default=[], action='append', type='choice', choices=sorted(map(str, TEST_MODULES)),75 help='The test module to run (can be specified more than once for multiple modules). Choices: %s' % ', '.join(sorted(TEST_MODULES)))76 parser.add_option('--test-verbosity', type=int, default=4, help='Test verbosity (0-4)')77 parser.add_option('--test-name', default=[], action='append',78 help='The name of an individual test to run. Can be specified more than once for multiple tests. The name of the'79 ' test is the name of the test function without the leading test_. For example, the function test_something()'80 ' can be run by specifying the name "something".')81 def run(self, opts):82 from calibre.utils.run_tests import run_cli, filter_tests_by_name83 tests = find_tests(which_tests=frozenset(opts.test_module))84 if opts.test_name:85 tests = filter_tests_by_name(tests, *opts.test_name)...

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:


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?