How to use get_excluded_tests method in Slash

Best Python code snippet using slash

SLListener.py

Source:SLListener.py Github

copy

Full Screen

...30 if not self.test_session_id:31 """initialize the test session so that all the tests can be identified by SeaLights as being part of the same session"""32 self.create_test_session()33 """request the list of tests to be executed from SeaLights"""34 self.excluded_tests = set(self.get_excluded_tests())35 print(f'{SEALIGHTS_LOG_TAG} {len(self.excluded_tests)} Skipped tests: {list(self.excluded_tests)}')36 """Narrow the test suite to only the recommended tests by Sealights"""37 all_tests = set()38 for test in suite.tests:39 all_tests.add(test.name)40 if test.name in self.excluded_tests:41 test.body.create_keyword(name="SKIP")42 tests_for_execution = list(all_tests - self.excluded_tests)43 print(f'{SEALIGHTS_LOG_TAG} {len(tests_for_execution)} Tests for execution: {tests_for_execution}')44 def end_suite(self, date, result):45 if not self.test_session_id:46 return47 """Collect and report test results to SeaLights including start and end time"""48 test_results = self.build_test_results(result)49 if test_results:50 print(f'{SEALIGHTS_LOG_TAG} {len(test_results)} Results to send: {test_results}')51 response = requests.post(self.get_session_url(), json=test_results, headers=self.get_header())52 if not response.ok:53 print(f'{SEALIGHTS_LOG_TAG} Failed to upload results (Error {response.status_code})')54 """Close the test session"""55 print(f'{SEALIGHTS_LOG_TAG} Deleting test session {self.test_session_id}')56 requests.delete(self.get_session_url(), headers=self.get_header())57 self.test_session_id = ''58 #--- Sealights API helpers ---59 60 def create_test_session(self):61 initialize_session_request = {'labId': self.labid, 'testStage': self.stage_name, 'bsid': self.bsid}62 response = requests.post(f'{self.base_url}/test-sessions', json=initialize_session_request, headers=self.get_header())63 if not response.ok:64 print(65 f'{SEALIGHTS_LOG_TAG} Failed to open Test Session (Error {response.status_code}),'66 f' disabling Sealights Listener')67 else:68 res = response.json()69 self.test_session_id = res["data"]["testSessionId"]70 print(f'{SEALIGHTS_LOG_TAG} Test session opened, testSessionId: {self.test_session_id}')71 def get_excluded_tests(self):72 recommendations = requests.get(f'{self.get_session_url()}/exclude-tests', headers=self.get_header())73 print(f'{SEALIGHTS_LOG_TAG} Retrieving Recommendations: {"OK" if recommendations.ok else "Error {recommendations.status_code}"}')74 if recommendations.status_code == 200:75 return recommendations.json()["data"]76 return []77 78 def build_test_results(self, result):79 tests = []80 for test in result.tests:81 test_status = TEST_STATUS_MAP.get(test.status, "passed")82 start_ms = self.get_epoch_timestamp(result.starttime)83 end_ms = self.get_epoch_timestamp(result.endtime)84 tests.append({"name": test.name, "status": test_status, "start": start_ms, "end": end_ms})85 return tests...

Full Screen

Full Screen

conftest.py

Source:conftest.py Github

copy

Full Screen

...28import dpnp29import numpy30import pytest31skip_mark = pytest.mark.skip(reason='Skipping test.')32def get_excluded_tests(test_exclude_file):33 excluded_tests = []34 if os.path.exists(test_exclude_file):35 with open(test_exclude_file) as skip_names_file:36 excluded_tests = skip_names_file.readlines()37 return excluded_tests38def pytest_collection_modifyitems(config, items):39 test_path = os.path.split(__file__)[0]40 excluded_tests = []41 # global skip file42 test_exclude_file = os.path.join(test_path, 'skipped_tests.tbl')43 # global skip file, where gpu device is not supported44 test_exclude_file_gpu = os.path.join(test_path, 'skipped_tests_gpu.tbl')45 current_queue_is_cpu = dpnp.dpnp_queue_is_cpu()46 print("")47 print(f"DPNP current queue is CPU: {current_queue_is_cpu}")48 print(f"DPNP version: {dpnp.__version__}, location: {dpnp}")49 print(f"NumPy version: {numpy.__version__}, location: {numpy}")50 print(f"Python version: {sys.version}")51 print("")52 if not current_queue_is_cpu or os.getenv('DPNP_QUEUE_GPU') == '1':53 excluded_tests.extend(get_excluded_tests(test_exclude_file_gpu))54 else:55 excluded_tests.extend(get_excluded_tests(test_exclude_file))56 for item in items:57 # some test name contains '\n' in the parameters58 test_name = item.nodeid.replace('\n', '').strip()59 for item_tbl in excluded_tests:60 # remove end-of-line character61 item_tbl_str = item_tbl.strip()62 # exact match of the test name with items from excluded_list63 if test_name == item_tbl_str:...

Full Screen

Full Screen

server.py

Source:server.py Github

copy

Full Screen

1from os import environ2from aiohttp import web3from modules.base import ModuleConfig4from modules.main import MainModule5from modules.receiver import ReceiverModule6host, port = environ['DB_URL'].split(':')7db_name = environ.get('DB_NAME', 'postgres')8db_user = environ.get('DB_USER', 'postgres')9files_url = environ.get('FILES_URL')10setup_file = environ.get('SETUP_FILE')11config = ModuleConfig(12 db_host=host,13 db_port=port,14 db_username=db_user,15 db_name=db_name,16 files_url=files_url,17 setup_file_path=setup_file18)19main_module = MainModule(config)20receiver_module = ReceiverModule(config)21app = web.Application()22app.add_routes([23 web.post('/back/start_test', receiver_module.start_test),24 web.post('/back/end_test', receiver_module.end_test),25 web.post('/back/start_step', receiver_module.start_step),26 web.post('/back/end_step', receiver_module.end_step),27 web.post('/back/add_metric', receiver_module.add_metric),28 web.post('/back/add_attachment', receiver_module.add_attachment),29 web.post('/back/add_test_results', main_module.add_test_results),30 web.post('/back/add_test_known_issue', main_module.add_test_known_issue),31 web.post('/back/remove_test_known_issue', main_module.remove_test_known_issue),32 web.post('/back/get_test_results', main_module.get_test_results),33 web.post('/back/get_tests', main_module.get_tests),34 web.post('/back/get_test_info', main_module.get_test_info),35 web.post('/back/get_steps', main_module.get_steps),36 web.post('/back/get_metrics', main_module.get_metrics),37 web.post('/back/get_metric', main_module.get_metric),38 web.post('/back/get_attachments', main_module.get_attachments),39 web.post('/back/get_reports', main_module.get_reports),40 web.post('/back/get_report_tests', main_module.get_report_tests),41 web.post('/back/get_report_pages', main_module.get_report_pages),42 web.post('/back/add_test_properties', main_module.add_test_properties),43 web.post('/back/remove_test_properties', main_module.remove_test_properties),44 web.post('/back/update_report', main_module.update_report),45 web.post('/back/add_report', main_module.add_report),46 web.post('/back/add_exclude_tests', main_module.add_exclude_tests),47 web.post('/back/get_excluded_tests', main_module.get_excluded_tests),48 web.post('/back/delete_test', main_module.delete_test),49 web.post('/back/delete_report', main_module.delete_report),50 web.post('/back/add_universe_config', main_module.add_universe_config),51 web.post('/back/get_universe_configs', main_module.get_universe_configs),52 web.post('/back/delete_universe_config', main_module.delete_universe_config),53 web.post('/back/delete_attachments', main_module.delete_attachments),54 web.post('/back/edit_test_info', main_module.edit_test_info),55]),...

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