Best Python code snippet using Testify_python
run-jstests.py
Source: run-jstests.py
...33from os import linesep, path34from subprocess import run, TimeoutExpired, STDOUT, PIPE, DEVNULL35from time import perf_counter36from collections import OrderedDict37def get_tests_for_suite(suite, mongo_root, test_binary):38 cmd = test_binary + ['--suites={}'.format(suite), '-n']39 proc = run(cmd, stdout=PIPE, cwd=mongo_root)40 out = proc.stdout.decode('utf-8').splitlines()41 tests = [path.join(mongo_root, line) for line in out if line.startswith(42 'jstests') and line.endswith('.js')]43 return tests44def get_cmd_args():45 parser = ArgumentParser(46 description='Run jstests/core tests with resmoke.py')47 parser.add_argument('-m', '--mongo-root', required=True,48 help='Path to mongo source root directory.abs')49 parser.add_argument('-d', '--dbpath', required=True,50 help='Directory where database is created.')51 parser.add_argument('-s', '--suite', required=True, help='Suite to run.')52 parser.add_argument('--timeout', type=int, default=5 *53 60, help='Test case timeout in seconds.')54 parser.add_argument(55 '-t',56 '--tests',57 nargs='+',58 help='Tests from selected suite to run, default: run all.')59 return parser.parse_args()60def execute_tests(args):61 test_dir = path.join(args.mongo_root, 'jstests', args.suite)62 test_binary = [path.join(args.mongo_root, 'buildscripts', 'resmoke.py')]63 test_args = ['--continueOnFailure',64 '--storageEngine=pmse',65 '--suites={}'.format(args.suite),66 '--dbpath={}'.format(args.dbpath)]67 if args.tests:68 tests = args.tests69 else:70 tests = get_tests_for_suite(args.suite, args.mongo_root, test_binary)71 failed = []72 passed_warnings = OrderedDict()73 timeout = []74 out = ''75 margin = len(max(tests, key=len)) + 876 for test in sorted(tests):77 cmd = test_binary + test_args78 cmd.append(path.join(test_dir, test))79 print_output = False80 skipped = False81 print('{} ...'.format(test).ljust(margin), end='', flush=True)82 start = perf_counter()83 try:84 proc = run(cmd, stderr=STDOUT, stdout=PIPE,...
GetTests.py
Source: GetTests.py
...30 data = {GetSuiteInfo.SUITE_PATH: suite_path,31 GetSuiteInfo.SUITE_SHORT_PATH: GetSuiteInfo.get_short_path(suite_path)}32 else:33 variables = [{"VarName": v.name, "VarValue": v.value} for v in suite_data.variable_table.variables]34 tests, children = GetSuiteInfo.get_tests_for_suite(suite_path)35 data = {GetSuiteInfo.SUITE_NAME: suite_data.name,36 GetSuiteInfo.SUITE_ID: secrets.token_hex(8),37 GetSuiteInfo.SUITE_PATH: os.path.abspath(suite_data.source),38 GetSuiteInfo.SUITE_SHORT_PATH: GetSuiteInfo.get_short_path(suite_path),39 GetSuiteInfo.SUITE_VARIABLES: variables,40 GetSuiteInfo.SUITE_TESTS: tests,41 GetSuiteInfo.SUITE_TEST_NUMBERS: len(tests) if tests else 0}42 if data.get(GetSuiteInfo.SUITE_NAME) is not None:43 suites_data.append(data)44 return suites_data45 @staticmethod46 def get_tests_for_suite(path_to_suite: str = None, parent: TestData = None):47 """48 Args:49 path_to_suite: the string representation of path to x.robot file50 parent: suite type, used for children to recursively find all children51 Returns:52 list of all test cases in the suite and its children53 """54 try:55 tests_data = TestData(parent=parent, source=path_to_suite)56 except NoTestsFound:57 return [], []58 else:59 tests = []60 text_index = 0...
test_runner_test.py
Source: test_runner_test.py
...84 yield85 def test_get_tests_for_suite_in_suite(self):86 self.in_suite_mock.return_value = True87 instance = test_runner.TestRunner(mock.sentinel.test_class)88 ret = instance.get_tests_for_suite(mock.sentinel.selected_suite_name)89 assert_equal(list(ret), [self.mock_test_method])90 def test_get_tests_for_suite_not_in_suite(self):91 self.in_suite_mock.return_value = False92 instance = test_runner.TestRunner(mock.sentinel.test_class)93 ret = instance.get_tests_for_suite(mock.sentinel.selected_suite_name)...
Check out the latest blogs from LambdaTest on this topic:
Software Risk Management (SRM) combines a set of tools, processes, and methods for managing risks in the software development lifecycle. In SRM, we want to make informed decisions about what can go wrong at various levels within a company (e.g., business, project, and software related).
In today’s data-driven world, the ability to access and analyze large amounts of data can give researchers, businesses & organizations a competitive edge. One of the most important & free sources of this data is the Internet, which can be accessed and mined through web scraping.
Agile has unquestionable benefits. The mainstream method has assisted numerous businesses in increasing organizational flexibility as a result, developing better, more intuitive software. Distributed development is also an important strategy for software companies. It gives access to global talent, the use of offshore outsourcing to reduce operating costs, and round-the-clock development.
Automating testing is a crucial step in the development pipeline of a software product. In an agile development environment, where there is continuous development, deployment, and maintenance of software products, automation testing ensures that the end software products delivered are error-free.
Before we discuss the Joomla testing, let us understand the fundamentals of Joomla and how this content management system allows you to create and maintain web-based applications or websites without having to write and implement complex coding requirements.
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!!