Best Python code snippet using slash
client.py
Source:client.py
...32 def get_user_run_tokens(self, user_id):33 return self.api.call_function('get_user_run_tokens', {'user_id': user_id})34 def delete_comment(self, comment_id) -> None:35 self.api.call_function('delete_comment', {'comment_id': comment_id})36 def report_session_start(self, logical_id=NOTHING,37 parent_logical_id=NOTHING,38 is_parent_session=False,39 child_id=NOTHING,40 hostname=NOTHING,41 total_num_tests=NOTHING,42 user_email=NOTHING,43 metadata=NOTHING,44 keepalive_interval=NOTHING,45 subjects=NOTHING,46 infrastructure=NOTHING,47 ttl_seconds=NOTHING,48 ):49 """Reports a new session starting50 :rtype: A session object representing the reported session...
test_parallel.py
Source:test_parallel.py
...26 assert child_session.id not in session_ids27def test_child_in_sessions_when_query_parent_logical_id(client):28 parent_logical_id = str(uuid4())29 child_logical_id = str(uuid4())30 parent_session = client.report_session_start(logical_id=parent_logical_id)31 assert parent_session32 child_session = client.report_session_start(parent_logical_id=parent_logical_id, logical_id=child_logical_id)33 assert child_session34 sessions = get_sessions(client, {'parent_logical_id':parent_logical_id})35 assert len(sessions) == 136 assert child_session.id == sessions[0]['id']37def test_parent_logical_id_not_found(client):38 parent_logical_id = str(uuid4())39 wrong_parent_logical_id = str(uuid4())40 child_logical_id = str(uuid4())41 parent_session = client.report_session_start(logical_id=parent_logical_id)42 assert parent_session43 with pytest.raises(requests.HTTPError):44 child_session = client.report_session_start(parent_logical_id=wrong_parent_logical_id, logical_id=child_logical_id)45def test_duplicate_logic_id(client):46 parent_logical_id = str(uuid4())47 parent_session = client.report_session_start(logical_id=parent_logical_id)48 assert parent_session49 with pytest.raises(requests.HTTPError):50 child_session = client.report_session_start(logical_id=parent_logical_id)51def test_session_counts(started_parallel_session, test_info):52 (parent_session, child_session) = started_parallel_session53 counts = {54 'num_failed_tests': 3,55 'num_error_tests': 2,56 'num_skipped_tests': 4,57 'num_finished_tests': 16,58 }59 remaining = counts.copy()60 while remaining['num_finished_tests']:61 remaining['num_finished_tests'] -= 162 test = child_session.report_test_start(**test_info)63 if remaining['num_failed_tests']:64 test.add_failure('F')...
test_keepalives.py
Source:test_keepalives.py
1# pylint: disable=unused-argument2import flux3import pytest4def test_no_keepalive_session(client):5 session = client.report_session_start()6 flux.current_timeline.sleep(3600)7 assert session.refresh().status == 'RUNNING'8 assert not session.refresh().is_abandoned9def test_keepalive_expiration(client, interval):10 session = client.report_session_start(keepalive_interval=interval)11 flux.current_timeline.sleep(interval / 2)12 assert session.refresh().status == 'RUNNING'13 assert not session.is_abandoned14 flux.current_timeline.sleep(interval / 2 + 1)15 assert session.refresh().status == 'RUNNING'16 assert session.is_abandoned17def test_keepalive(client, interval):18 session = client.report_session_start(keepalive_interval=interval)19 for _ in range(10):20 flux.current_timeline.sleep(interval)21 session.send_keepalive()22 assert not session.is_abandoned23 assert session.refresh().status == 'RUNNING'24def test_keepalive_not_counted_after_finish(client, interval):25 session = client.report_session_start(keepalive_interval=interval)26 session.report_end()27 flux.current_timeline.sleep(interval * 2)28 assert session.refresh().status == 'SUCCESS'29 assert not session.is_abandoned30@pytest.fixture31def interval():...
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!!