Best Python code snippet using localstack_python
r_tut_island.py
Source:r_tut_island.py  
1from random import gauss2from time import sleep3from utils import rr4from colors import Colors5from items import Items6from map import Map7from py_key import PyKey8from search import Search9from spaces import Spaces10'''  The client has a pos_x and pos_y indicating the top left corner  11    client.dims = [pos_x, pos_y, width, height]12'''13CHAT_PAUSE = 1.114def click_gilinor_guide(client, space=Spaces.PLAYER_CENTER_LG, chat_head_left=True):15    ''' Starting from somewhere in 1st house, lookfor 'FFFF0000' and click him 16    NPC Indicators17    '''18    if Search.chat_head_showing(client):19        return20    pt = Search.search_space_color(21        client, space, Colors.NPC_PURPLE)22    Search.click(pt)23    sleep(3)24    while not Search.chat_head_showing(client, left=chat_head_left):25        pt = Search.search_space_color(26            client, space, Colors.NPC_PURPLE)27        Search.click(pt)28        sleep(gauss(3, 0.5))29def talk_up_to_setting_icon(client):30    # First press31    PyKey.press(PyKey.SPACE)32    sleep(gauss(CHAT_PAUSE, .12))33    # Second press34    PyKey.press(PyKey.SPACE)35    sleep(gauss(CHAT_PAUSE, .12))36    # 3 press37    PyKey.press(PyKey.SPACE)38    sleep(gauss(CHAT_PAUSE, .12))39    # 4 press40    PyKey.press(PyKey.SPACE)41    sleep(gauss(CHAT_PAUSE, .12))42    # 5 press43    PyKey.press(PyKey.SPACE)44    sleep(gauss(CHAT_PAUSE, .12))45    # CHoose option46    PyKey.press(PyKey.TWO)47    sleep(gauss(CHAT_PAUSE, .12))48    # 1 press49    PyKey.press(PyKey.SPACE)50    sleep(gauss(CHAT_PAUSE, .12))51    # 2 press52    PyKey.press(PyKey.SPACE)53    sleep(gauss(CHAT_PAUSE, .12))54    # 5 press55    PyKey.press(PyKey.SPACE)56    sleep(gauss(CHAT_PAUSE, .12))57def click_settings_icon(client):58    Search.click(Search.click_interface(client, Spaces.PANEL_SETTINGS))59def talk_up_to_door(client):60    PyKey.press(PyKey.SPACE)61    sleep(gauss(CHAT_PAUSE, .12))62    PyKey.press(PyKey.SPACE)63    sleep(gauss(CHAT_PAUSE, .12))64def click_on_door(client):65    Search.click(Search.search_space_color(client, Spaces.E_B, Colors.Red))66    sleep(1.2)67def walk_to_fish(client):68    '''69        692, 12170        711, 14571        Fish spot on minimap72    '''73    Search.click(Search.click_interface(74        client, Spaces.TUT_ISLAND_MINI_MAP_FISH_SPOT))75    sleep(10)76def talk_survival_expert_1(client):77    PyKey.press(PyKey.SPACE)78    sleep(gauss(CHAT_PAUSE, .12))79    PyKey.press(PyKey.SPACE)80    sleep(gauss(CHAT_PAUSE, .12))81    PyKey.press(PyKey.SPACE)82    sleep(gauss(CHAT_PAUSE, .12))83def click_INV(client):84    Search.click(Search.click_interface(client, Spaces.PANEL_INV))85    sleep(1)86def click_shrimp(client):87    Search.click(Search.search_space_color(88        client, Spaces.PLAYER_CENTER_LG, Colors.Cyan))89    sleep(3)90    # while Search.search_space_item(client, Spaces.INV, Items.RAW_SHRIMP) is None:91    #     Search.click(Search.search_space_color(client, Spaces.PLAYER_CENTER_LG, Colors.Cyan))92    #     sleep(5)93def click_skills_panel(client):94    Search.click(Search.click_interface(client, Spaces.PANEL_SKILLS))95    sleep(1)96def talk_until_wc(client):97    PyKey.press(PyKey.SPACE)98    sleep(gauss(CHAT_PAUSE, .12))99    PyKey.press(PyKey.SPACE)100    sleep(gauss(CHAT_PAUSE, .12))101    PyKey.press(PyKey.SPACE)102    sleep(gauss(CHAT_PAUSE, .12))103def click_tree(client):104    Search.click(Search.search_space_color(105        client, Spaces.PLAYER_CENTER_MED, Colors.Green))106def make_fire(client):107    Search.click(Search.search_space_item(108        client, Spaces.INV, Items.TINDERBOX))109    sleep(.6)110    Search.click(Search.search_space_item(client, Spaces.INV, Items.LOGS))111def cook_shrimp(client):112    # Click Shrimp113    Search.click(Search.search_space_item(114        client, Spaces.INV, Items.RAW_SHRIMP))115    # Click Fire116    Search.click(Search.search_space_color(117        client, Spaces.PLAYER_CENTER_MED, Colors.LOGS_ON_FIRE))118def walk_east_to_yellow(client):119    Search.click(Search.search_space_color(client, Spaces.WEST, Colors.Yellow))120def walk_east_to_red_gate(client):121    Search.click(Search.search_space_color(client, Spaces.WEST, Colors.Red))122def turn_and_click_door(client):123    Map.move_map_deg(client, -90)124    Search.click(Search.search_space_color(client, Spaces.WEST, Colors.Red))125def talk_cook_until_water_and_dough(client):126    for _ in range(5):127        PyKey.press(PyKey.SPACE)128        sleep(gauss(CHAT_PAUSE, .12))129def make_dough(client):130    Search.click(Search.search_space_item(131        client, Spaces.INV, Items.POT_OF_FLOUR))132    sleep(.6)133    Search.click(Search.search_space_item(134        client, Spaces.INV, Items.BUCKET_OF_WATER))135def make_bread(client):136    Search.click(Search.search_space_item(137        client, Spaces.INV, Items.BREAD_DOUGH))138    sleep(.6)139    Map.move_map_deg(client, -90)140    Search.click(Search.search_space_color(141        client, Spaces.NORTH, Colors.Cyan))142def leave_kitchen_walk_north(client):143    Search.click(Search.click_interface(client, Spaces.RESET_MAP))144    # Click mini map,145    Search.click(Search.click_interface_from_raw_coords(146        client, [606, 26, 691, 45]))147def leave_kitchen_open_door(client):148    # Click door149    Search.click(Search.search_space_color(client, Spaces.WEST, Colors.Red))150def double_click_run(client):151    Search.click(Search.click_interface(client, Spaces.INTF_RUN))152    sleep(max(.230, gauss(.250, .2)))153    Search.click(Search.click_interface(client, Spaces.INTF_RUN))154def walk_west_to_tile1(client):155    # Click door156    Search.click(Search.search_space_color(157        client, Spaces.WEST, Colors.Yellow))158def walk_north_to_tile2(client):159    # Click door160    Search.click(Search.search_space_color(161        client, Spaces.NORTH, Colors.Yellow))162def walk_east_to_tile3(client):163    # Click door164    Search.click(Search.search_space_color(165        client, Spaces.EAST, Colors.Yellow))166def walk_north_to_tile4(client):167    # Click door168    Search.click(Search.search_space_color(169        client, Spaces.NORTH, Colors.Yellow))170def open_door_to_quest_guy(client):171    Search.click(Search.search_space_color(172        client, Spaces.EAST, Colors.Red))173def click_panel_quest_icon(client):174    Search.click(Search.click_interface(client, Spaces.PANEL_QUESTS))175def talk_quest_guide_until_trapdoor(client):176    for _ in range(6):177        PyKey.press(PyKey.SPACE)178        sleep(gauss(CHAT_PAUSE, .12))179def click_trapdoor(client):180    Map.move_map_deg(client, 180)181    Search.click(Search.search_space_color(182        client, Spaces.NORTH, Colors.Cyan))183def walk_to_smith_click_mini_map(client):184    Search.click(Search.click_interface(client, Spaces.RESET_MAP))185    Search.click(Search.click_interface_from_raw_coords(186        client, [627, 144, 653, 155]))187def talk_smith_until_mining(client):188    for _ in range(5):189        PyKey.press(PyKey.SPACE)190        sleep(gauss(CHAT_PAUSE, .12))191def click_tin_rock(client):192    Search.click(Search.search_space_color(193        client, Spaces.PLAYER_CENTER_LG, Colors.Cyan))194def click_copper_rock(client):195    Search.click(Search.search_space_color(196        client, Spaces.EAST, Colors.Blue))197def click_furnace(client):198    Search.click(Search.search_space_color(199        client, Spaces.WEST, Colors.Yellow))200def talk_smith_until_make_weapon(client):201    for _ in range(3):202        PyKey.press(PyKey.SPACE)203        sleep(gauss(CHAT_PAUSE, .12))204def click_anvil(client):205    Search.click(Search.search_space_color(206        client, Spaces.PLAYER_CENTER_LG, Colors.Green))207def click_dagger(client):208    Search.click(Search.click_interface_from_raw_coords(209        client, [21, 47, 63, 97]))210def click_combat_gate(client):211    Search.click(Search.search_space_color(212        client, Spaces.EAST, Colors.Red))213def click_combat_instructor(client):214    click_gilinor_guide(client, Spaces.EAST)215def talk_smith_until_click_gear(client):216    for _ in range(3):217        PyKey.press(PyKey.SPACE)218        sleep(gauss(CHAT_PAUSE, .12))219def click_panel_gear(client):220    Search.click(Search.click_interface(client, Spaces.PANEL_GEAR))221def click_panel_gear_equipment(client):222    Search.click(Search.click_interface(client, Spaces.GEAR_EQUIPMENT))223def close_equipment(client):224    Search.click(Search.click_interface(client, Spaces.GEAR_EQUIPMENT_CLOSE))225def equip_dagger(client):226    Search.click(Search.search_space_item(227        client, Spaces.INV, Items.BRONZE_DAGGER))228def talk_combatinstructor_until_fight(client):229    for _ in range(2):230        PyKey.press(PyKey.SPACE)231        sleep(gauss(CHAT_PAUSE, .12))232def equip_sword_and_shield(client):233    coin_toss = rr(0, 100)234    if coin_toss < 50:235        Search.click(Search.search_space_item(236            client, Spaces.INV, Items.BRONZE_SWORD))237        Search.click(Search.search_space_item(238            client, Spaces.INV, Items.WOODEN_SHIELD))239    else:240        Search.click(Search.search_space_item(241            client, Spaces.INV, Items.WOODEN_SHIELD))242        Search.click(Search.search_space_item(243            client, Spaces.INV, Items.BRONZE_SWORD))244def click_panel_combat(client):245    Search.click(Search.click_interface(client, Spaces.PANEL_COMBAT))246def walk_to_rat_tile(client):247    Search.click(Search.search_space_color(248        client, Spaces.NORTH, Colors.Yellow))249def click_rat_gate(client):250    Search.click(Search.search_space_color(251        client, Spaces.PLAYER_CENTER_LG, Colors.Red))252def attack_rat_melee(client):253    Search.click(Search.search_space_color(254        client, Spaces.PLAYER_CENTER_MED, Colors.Purple))255def leave_cage_mini_map(client):256    Search.click(Search.click_interface_from_raw_coords(257        client, [690, 38, 712, 75]))258def leave_cage_click_door(client):259    Search.click(Search.search_space_color(client, Spaces.EAST, Colors.Red))260def walk_tile_south_to_comabt_instructor(client):261    Search.click(Search.search_space_color(262        client, Spaces.SOUTH, Colors.Yellow))263def walk_south_to_blue(client):264    Search.click(Search.search_space_color(client, Spaces.SOUTH, Colors.Blue))265def click_combat_instructor_south(client):266    click_gilinor_guide(client, Spaces.SOUTH)267def talk_combatinstructor_until_fight_arrows(client):268    for _ in range(4):269        PyKey.press(PyKey.SPACE)270        sleep(gauss(CHAT_PAUSE, .12))271def click_shortbow_and_arrows(client):272    ct = rr(0, 100)273    if ct < 50:274        Search.click(Search.search_space_item(275            client, Spaces.INV, Items.SHORTBOW))276        Search.click(Search.search_space_item(277            client, Spaces.INV, Items.BRONZE_ARROWS))278    else:279        Search.click(Search.search_space_item(280            client, Spaces.INV, Items.BRONZE_ARROWS))281        Search.click(Search.search_space_item(282            client, Spaces.INV, Items.SHORTBOW))283def click_giant_rat_range(client):284    Search.click(Search.search_space_color(285        client, Spaces.NORTH, Colors.GIANT_RAT))286def click_ladder_mini_map_exit(client):287    Search.click(Search.click_interface_from_raw_coords(288        client, [631, 14, 679, 34]))289def click_ladder_exit(client):290    Search.click(Search.search_space_color(291        client, Spaces.PLAYER_CENTER_LG, Colors.Cyan))292def walk_to_bank(client):293    Search.click(Search.click_interface_from_raw_coords(294        client, [673, 93, 688, 107]))295def click_bank_booth(client):296    Search.click(Search.search_space_color(297        client, Spaces.PLAYER_CENTER_LG, Colors.Cyan))298def close_bank(client):299    ct = rr(0, 100)300    if ct < 50:301        Search.click(Search.click_interface(client, Spaces.CLOSE_BANK))302    else:303        Search.click(Search.click_interface_from_raw_coords(304            client, [638, 80, 653, 94]))305def click_poll_booth(client):306    Search.click(Search.search_space_color(307        client, Spaces.PLAYER_CENTER_LG, Colors.Blue))308def space_through_poll_chat(client):309    for _ in range(3):310        PyKey.press(PyKey.SPACE)311        sleep(gauss(CHAT_PAUSE, .12))312def click_bank_door(client):313    Map.move_map_deg(client, 90)314    Search.click(Search.search_space_color(315        client, Spaces.NORTH, Colors.Red))316def click_account_guide(client):317    Search.click(Search.click_interface(318        client, Spaces.RESET_MAP))319    click_gilinor_guide(client, chat_head_left=False)320def talk_to_account_guide_until_panel(client):321    for _ in range(5):322        PyKey.press(PyKey.SPACE)323        sleep(gauss(CHAT_PAUSE, .12))324def click_panel_account_management(client):325    Search.click(Search.click_interface(client, Spaces.PANEL_ACCOUNT))326def click_account_guide_again(client):327    click_gilinor_guide(client)328def talk_to_account_guide_until_exit(client):329    for _ in range(18):330        PyKey.press(PyKey.SPACE)331        sleep(gauss(CHAT_PAUSE + 0.250, .12))332def click_door_exit_bank_second(client):333    Search.click(Search.search_space_color(334        client, Spaces.EAST, Colors.Red))335def walk_south_to_altar(client):336    ct = rr(0, 100)337    if ct < 50:338        Search.click(Search.search_space_color(339            client, Spaces.EAST, Colors.Yellow))340    else:341        Search.click(Search.click_interface_from_raw_coords(342            client, [663, 110, 690, 119]))343def walk_south_to_altar2(client):344    Search.click(Search.click_interface_from_raw_coords(345        client, [611, 120, 625, 136]))346def walk_south_to_altar3(client):347    Search.click(Search.search_space_color(348        client, Spaces.WEST, Colors.Yellow))349def click_brother_brace(client):350    click_gilinor_guide(client, chat_head_left=False)351def click_brother_brace_left(client):352    click_gilinor_guide(client)353def talk_brother_until_panel_prayer(client):354    for _ in range(2):355        PyKey.press(PyKey.SPACE)356        sleep(gauss(CHAT_PAUSE + 0.250, .12))357def click_panel_prayer(client):358    Search.click(Search.click_interface(359        client, Spaces.PANEL_PRAYER))360def talk_brother_until_panel_friends(client):361    for _ in range(4):362        PyKey.press(PyKey.SPACE)363        sleep(gauss(CHAT_PAUSE + 0.250, .12))364def click_panel_friends(client):365    Search.click(Search.click_interface(366        client, Spaces.PANEL_FRIENDS))367def talk_brother_until_exit(client):368    for _ in range(4):369        PyKey.press(PyKey.SPACE)370        sleep(gauss(CHAT_PAUSE + 0.250, .12))371def click_prayer_exit_door(client):372    Search.click(Search.search_space_color(373        client, Spaces.SOUTH, Colors.Red))374def walk_to_magic_guy(client):375    Search.click(Search.click_interface_from_raw_coords(376        client, [632, 136, 653, 153]))377def walk_to_magic_guy2(client):378    Search.click(Search.search_space_color(379        client, Spaces.EAST, Colors.Yellow))380def click_magic_instructor(client):381    click_gilinor_guide(client, Spaces.EAST, chat_head_left=False)382def talk_to_magic_instructor_until_panel_magic(client):383    for _ in range(2):384        PyKey.press(PyKey.SPACE)385        sleep(gauss(CHAT_PAUSE + 0.250, .12))386def click_panel_magic(client):387    Search.click(Search.click_interface(388        client, Spaces.PANEL_MAGIC))389def click_magic_instructor2(client):390    click_gilinor_guide(client)391def talk_to_magic_instructor_until_air_strike(client):392    for _ in range(2):393        PyKey.press(PyKey.SPACE)394        sleep(gauss(CHAT_PAUSE + 0.250, .12))395def walk_north_to_chickens(client):396    Search.click(Search.search_space_color(client, Spaces.NORTH, Colors.Blue))397    sleep(max(.25, gauss(.5, .3)))398    Map.zoom_map(client, 15)399def cast_air_strike(client):400    Search.click(Search.click_interface_from_raw_coords(401        client, [608, 220, 627, 239]))402    Search.click(Search.search_space_color(403        client, Spaces.NORTH, Colors.CHICKEN_TUT_ISLAND))404def click_to_magic_guy_exit(client):405    Map.zoom_map(client, -20)406    sleep(max(.25, gauss(.5, .3)))407    click_gilinor_guide(client)408def talk_to_magic_instructor_until_exit(client):409    PyKey.press(PyKey.SPACE)410    sleep(gauss(CHAT_PAUSE + 0.250, .12))411    PyKey.press(PyKey.ONE)412    sleep(gauss(CHAT_PAUSE + 0.250, .12))413    PyKey.press(PyKey.SPACE)414    sleep(gauss(CHAT_PAUSE + 0.250, .12))415    # TODO this is random on each account, 1-3. Recognize random chat options... Pain in the ass. Runelite plugin to see which option is which...416    PyKey.press(PyKey.THREE)417    sleep(gauss(CHAT_PAUSE + 0.250, .12))418    PyKey.press(PyKey.SPACE)419    sleep(gauss(CHAT_PAUSE + 0.250, .12))420    PyKey.press(PyKey.SPACE)421    sleep(gauss(CHAT_PAUSE + 0.250, .12))422    PyKey.press(PyKey.SPACE)423    sleep(gauss(CHAT_PAUSE + 0.250, .12))424    PyKey.press(PyKey.SPACE)425    sleep(gauss(CHAT_PAUSE + 0.250, .12))426    PyKey.press(PyKey.SPACE)427    sleep(gauss(CHAT_PAUSE + 0.250, .12))428    PyKey.press(PyKey.SPACE)429    sleep(gauss(CHAT_PAUSE + 0.250, .12))430'''431----------432---------433'''434#  ###############   Sleeps    ##############################435def click_gilinor_guide_sleep(is_running):436    return max(1, gauss(1.6, .5))437def talk_up_to_setting_icon_sleep(is_running):438    return max(1, gauss(1.6, .5))439def click_settings_icon_sleep(is_running):440    return max(1, gauss(1.6, .5))441def talk_up_to_door_sleep(is_running):442    return max(1, gauss(1.6, .5))443def click_on_door_sleep(is_running):444    return max(1, gauss(1.6, .5))445def walk_to_fish_sleep(is_running):446    return max(1, gauss(1.6, .5))447def talk_survival_expert_1_sleep(is_running):448    return max(1, gauss(1.6, .5))449def click_INV_sleep(is_running):450    return max(1, gauss(1.6, .5))451def click_shrimp_sleep(is_running):452    return max(1, gauss(1.6, .5))453def click_skills_panel_sleep(is_running):454    return max(1, gauss(1.6, .5))455def talk_until_wc_sleep(is_running):456    return max(1, gauss(1.6, .5))457def click_tree_sleep(is_running):458    return max(1, gauss(1.6, .5))459def make_fire_sleep(is_running):460    return max(1, gauss(1.6, .5))461def cook_shrimp_sleep(is_running):462    return max(1, gauss(1.6, .5))463def walk_to_gate_sleep(is_running):464    return max(1, gauss(1.6, .5))465def walk_east_to_yellow_sleep(is_running):466    return max(4, gauss(4.6, .5))467def walk_east_to_red_gate_sleep(is_running):468    return max(4, gauss(4.6, .5))469def turn_and_click_door_sleep(is_running):470    return max(4, gauss(4.6, .5))471def talk_cook_until_water_and_dough_sleep(is_running):472    return max(4, gauss(4.6, .5))473def make_dough_sleep(is_running):474    return max(4, gauss(4.6, .5))475def make_bread_sleep(is_running):476    return max(4, gauss(4.6, .5))477def leave_kitchen_walk_north_sleep(is_running):478    return max(3.3, gauss(3.6, .5))479def leave_kitchen_open_door_sleep(is_running):480    return max(4, gauss(4.6, .5))481def double_click_run_sleep(is_running):482    return max(1, gauss(1.6, .5))483def walk_west_to_tile1_sleep(is_running):484    return max(3, gauss(3.6, .5))485def walk_north_to_tile2_sleep(is_running):486    return max(3, gauss(3.6, .5))487def walk_east_to_tile3_sleep(is_running):488    return max(3.5, gauss(3.9, .5))489def walk_north_to_tile4_sleep(is_running):490    return max(3.3, gauss(3.7, .5))491def open_door_to_quest_guy_sleep(is_running):492    return max(3.7, gauss(4.3, .5))493def click_panel_quest_icon_sleep(is_running):494    return max(.6, gauss(1, .5))495def talk_quest_guide_until_trapdoor_sleep(is_running):496    return max(.6, gauss(1, .5))497def click_trapdoor_sleep(is_running):498    return max(.6, gauss(1, .5))499def walk_to_smith_click_mini_map_sleep(is_running):500    return max(.6, gauss(1, .5))501def talk_smith_until_mining_sleep(is_running):502    return max(.6, gauss(1, .5))503def click_tin_rock_sleep(is_running):504    return max(7, gauss(7.5, .5))505def click_copper_rock_sleep(is_running):506    return max(7, gauss(7.5, .5))507def click_furnace_sleep(is_running):508    return max(6, gauss(6.5, .5))509def talk_smith_until_make_weapon_sleep(is_running):510    return max(1, gauss(1.5, .5))511def click_anvil_sleep(is_running):512    return max(3.2, gauss(3.7, .5))513def click_dagger_sleep(is_running):514    return max(3.2, gauss(3.7, .5))515def click_combat_gate_sleep(is_running):516    return max(5.2, gauss(5.7, .5))517def click_combat_instructor_sleep(is_running):518    return max(6.2, gauss(6.7, .5))519def click_panel_gear_sleep(is_running):520    return max(1.2, gauss(1.7, .5))521def click_panel_gear_equipment_sleep(is_running):522    return max(5.2, gauss(5.7, .5))523def close_equipment_sleep(is_running):524    return max(1.2, gauss(1.7, .5))525def equip_dagger_sleep(is_running):526    return max(2.2, gauss(2.7, .5))527def talk_combatinstructor_until_fight_sleep(is_running):528    return max(2.2, gauss(2.7, .5))529def equip_sword_and_shield_sleep(is_running):530    return max(2.2, gauss(2.7, .5))531def click_panel_combat_sleep(is_running):532    return max(1.2, gauss(2.7, .5))533def walk_to_rat_tile_sleep(is_running):534    return max(3.2, gauss(3.7, .5))535def click_rat_gate_sleep(is_running):536    return max(1.2, gauss(2.7, .5))537def attack_rat_melee_sleep(is_running):538    return max(20.2, gauss(20.7, 1.5))539def leave_cage_mini_map_sleep(is_running):540    return max(3.2, gauss(3.7, 1.5))541def leave_cage_click_door_sleep(is_running):542    return max(3.2, gauss(3.7, 1.5))543def walk_tile_south_to_comabt_instructor_sleep(is_running):544    return max(3.2, gauss(3.7, 1.5))545def walk_south_to_blue_sleep(is_running):546    return max(1.2, gauss(1.7, 1.5))547def click_combat_instructor_south_sleep(is_running):548    return max(3.2, gauss(3.7, 1.5))549def talk_combatinstructor_until_fight_arrows_sleep(is_running):550    return max(3.2, gauss(3.7, 1.5))551def click_shortbow_and_arrows_sleep(is_running):552    return max(1.2, gauss(1.7, 1.5))553def click_giant_rat_range_sleep(is_running):554    return max(20.2, gauss(20.7, 1.5))555def click_ladder_mini_map_exit_sleep(is_running):556    return max(7.2, gauss(7.7, 1.5))557def click_ladder_exit_sleep(is_running):558    return max(5.2, gauss(5.7, 1.5))559def walk_to_bank_sleep(is_running):560    return max(9.2, gauss(5.7, 1.5))561def click_bank_booth_sleep(is_running):562    return max(3.2, gauss(3.7, 1.5))563def close_bank_sleep(is_running):564    return max(1.2, gauss(1.7, 1.5))565def click_poll_booth_sleep(is_running):566    return max(2.2, gauss(2.7, 1.5))567def space_through_poll_chat_sleep(is_running):568    return max(2.2, gauss(2.7, 1.5))569def click_bank_door_sleep(is_running):570    return max(2.2, gauss(2.7, 1.5))571def click_account_guide_sleep(is_running):572    return max(2.2, gauss(2.7, 1.5))573def talk_to_account_guide_until_panel_sleep(is_running):574    return max(2.2, gauss(2.7, 1.5))575def click_panel_account_management_sleep(is_running):576    return max(2.2, gauss(2.7, 1.5))577def click_account_guide_again_sleep(is_running):578    return max(2.2, gauss(2.7, 1.5))579def talk_to_account_guide_until_exit_sleep(is_running):580    return max(2.2, gauss(2.7, 1.5))581def click_door_exit_bank_second_sleep(is_running):582    return max(2.2, gauss(2.7, 1.5))583def walk_south_to_altar_sleep(is_running):584    return max(6.2, gauss(6.7, 1.5))585def walk_south_to_altar2_sleep(is_running):586    return max(9.2, gauss(9.7, 1.5))587def walk_south_to_altar3_sleep(is_running):588    return max(5.2, gauss(5.7, 1.5))589def click_brother_brace_sleep(is_running):590    return max(6.2, gauss(6.7, 1.5))591def talk_brother_until_panel_prayer_sleep(is_running):592    return max(2.2, gauss(2.7, 1.5))593def click_panel_prayer_sleep(is_running):594    return max(2.2, gauss(2.7, 1.5))595def talk_brother_until_panel_friends_sleep(is_running):596    return max(2.2, gauss(2.7, 1.5))597def click_panel_friends_sleep(is_running):598    return max(2.2, gauss(2.7, 1.5))599def talk_brother_until_exit_sleep(is_running):600    return max(2.2, gauss(2.7, 1.5))601def click_prayer_exit_door_sleep(is_running):602    return max(5.2, gauss(5.7, 1.5))603def walk_to_magic_guy_sleep(is_running):604    return max(8.2, gauss(8.7, 1.5))605def walk_to_magic_guy2_sleep(is_running):606    return max(6.2, gauss(6.7, 1.5))607def click_magic_instructor_sleep(is_running):608    return max(5.2, gauss(5.7, 1.5))609def talk_to_magic_instructor_until_panel_magic_sleep(is_running):610    return max(5.2, gauss(5.7, 1.5))611def click_panel_magic_sleep(is_running):612    return max(2.2, gauss(2.7, 1.5))613def click_magic_instructor2_sleep(is_running):614    return max(2.2, gauss(2.7, 1.5))615def walk_north_to_chickens_sleep(is_running):616    return max(3.2, gauss(3.7, 1.5))617def cast_air_strike_sleep(is_running):618    return max(4.2, gauss(4.7, 1.5))619def click_to_magic_guy_exit_sleep(is_running):620    return max(4.2, gauss(4.7, 1.5))621def talk_to_magic_instructor_until_exit_sleep(is_running):622    return max(2.2, gauss(2.7, 1.5))623RECIPIE = {624    'fns': [625        # click_gilinor_guide,626        # talk_up_to_setting_icon,627        # click_settings_icon,628        # click_gilinor_guide,629        # talk_up_to_door,630        # click_on_door,631        # walk_to_fish,632        # click_gilinor_guide,  # Survival Expert.633        # talk_survival_expert_1,634        # click_INV,635        # click_shrimp,636        # click_skills_panel,637        # click_gilinor_guide,  # Survival Expert.638        # talk_until_wc,639        # click_tree,640        # make_fire,641        # cook_shrimp,642        # walk_east_to_yellow,643        # walk_east_to_red_gate,644        # walk_east_to_yellow,645        # turn_and_click_door,646        # click_gilinor_guide,  # Master Chef.647        # talk_cook_until_water_and_dough,648        # make_dough,649        # make_bread,650        # leave_kitchen_walk_north,651        # leave_kitchen_open_door,652        # double_click_run,653        # walk_west_to_tile1,654        # walk_north_to_tile2,655        # walk_east_to_tile3,656        # walk_north_to_tile4,657        # open_door_to_quest_guy,658        # click_gilinor_guide,  # Quest Guide659        # click_panel_quest_icon,660        # click_gilinor_guide,  # Quest Guide661        # click_trapdoor,662        # walk_to_smith_click_mini_map,663        # click_gilinor_guide,  # Smith instructor664        # talk_smith_until_mining,665        # click_tin_rock,666        # click_copper_rock,667        # click_furnace,668        # click_gilinor_guide,  # Smith instructor669        # talk_smith_until_make_weapon,670        # click_anvil,671        # click_dagger,672        # click_combat_gate,673        # click_combat_instructor,  # Combat instructor674        # click_panel_gear,675        # click_panel_gear_equipment,676        # close_equipment,677        # equip_dagger,678        # click_combat_instructor,  # Combat instructor679        # talk_combatinstructor_until_fight,680        # equip_sword_and_shield,681        # click_panel_combat,682        # walk_to_rat_tile,683        # click_rat_gate,684        # attack_rat_melee,685        # leave_cage_mini_map,686        # leave_cage_click_door,687        # walk_tile_south_to_comabt_instructor,688        # walk_south_to_blue,689        # click_combat_instructor_south,690        # talk_combatinstructor_until_fight_arrows,691        # click_shortbow_and_arrows,692        # click_giant_rat_range,693        # click_ladder_mini_map_exit,694        # click_ladder_exit,695        # walk_to_bank,696        # click_bank_booth,697        # close_bank,698        # click_poll_booth,699        # space_through_poll_chat,700        # close_bank,701        # click_bank_door,702        # click_account_guide,703        # talk_to_account_guide_until_panel,704        # click_panel_account_management,705        # click_account_guide_again,706        # talk_to_account_guide_until_exit,707        # click_door_exit_bank_second,708        # walk_south_to_altar,709        # walk_south_to_altar2,710        # walk_south_to_altar3,711        # click_brother_brace,712        # talk_brother_until_panel_prayer,713        # click_panel_prayer,714        # click_brother_brace_left,715        # talk_brother_until_panel_friends,716        # click_panel_friends,717        # click_brother_brace_left,718        # talk_brother_until_exit,719        # click_prayer_exit_door,720        # walk_to_magic_guy,721        # walk_to_magic_guy2,722        # click_magic_instructor,723        # talk_to_magic_instructor_until_panel_magic,724        # click_panel_magic,725        # click_magic_instructor2,726        walk_north_to_chickens,727        cast_air_strike,728        click_to_magic_guy_exit,729        talk_to_magic_instructor_until_exit,730    ],731    # ----------------------------------------------------------------------------------------732    'sleeps': [733        # click_gilinor_guide_sleep,734        # talk_up_to_setting_icon_sleep,735        # click_settings_icon_sleep,736        # click_gilinor_guide_sleep,737        # talk_up_to_door_sleep,738        # click_on_door_sleep,739        # walk_to_fish_sleep,740        # click_gilinor_guide_sleep,741        # talk_survival_expert_1_sleep,742        # click_INV_sleep,743        # click_shrimp_sleep,744        # click_skills_panel_sleep,745        # click_gilinor_guide_sleep,746        # talk_until_wc_sleep,747        # click_tree_sleep,748        # make_fire_sleep,749        # cook_shrimp_sleep,750        # walk_to_gate_sleep,751        # walk_east_to_yellow_sleep,752        # walk_east_to_red_gate_sleep,753        # walk_east_to_yellow_sleep,754        # turn_and_click_door_sleep,755        # click_gilinor_guide_sleep,756        # talk_cook_until_water_and_dough_sleep,757        # make_dough_sleep,758        # make_bread_sleep,759        # leave_kitchen_walk_north_sleep,760        # leave_kitchen_open_door_sleep,761        # double_click_run_sleep,762        # walk_west_to_tile1_sleep,763        # walk_north_to_tile2_sleep,764        # walk_east_to_tile3_sleep,765        # walk_north_to_tile4_sleep,766        # open_door_to_quest_guy_sleep,767        # click_gilinor_guide_sleep,768        # click_panel_quest_icon_sleep,769        # click_gilinor_guide_sleep,770        # click_trapdoor_sleep,771        # walk_to_smith_click_mini_map_sleep,772        # click_gilinor_guide_sleep,773        # talk_smith_until_mining_sleep,774        # click_tin_rock_sleep,775        # click_copper_rock_sleep,776        # click_furnace_sleep,777        # click_gilinor_guide_sleep,778        # talk_smith_until_make_weapon_sleep,779        # click_anvil_sleep,780        # click_dagger_sleep,781        # click_combat_gate_sleep,782        # click_combat_instructor_sleep,783        # click_panel_gear_sleep,784        # click_panel_gear_equipment_sleep,785        # close_equipment_sleep,786        # equip_dagger_sleep,787        # click_combat_instructor_sleep,788        # talk_combatinstructor_until_fight_sleep,789        # equip_sword_and_shield_sleep,790        # click_panel_combat_sleep,791        # walk_to_rat_tile_sleep,792        # click_rat_gate_sleep,793        # attack_rat_melee_sleep,794        # leave_cage_mini_map_sleep,795        # leave_cage_click_door_sleep,796        # walk_tile_south_to_comabt_instructor_sleep,797        # walk_south_to_blue_sleep,798        # click_combat_instructor_south_sleep,799        # talk_combatinstructor_until_fight_arrows_sleep,800        # click_shortbow_and_arrows_sleep,801        # click_giant_rat_range_sleep,802        # click_ladder_mini_map_exit_sleep,803        # click_ladder_exit_sleep,804        # walk_to_bank_sleep,805        # click_bank_booth_sleep,806        # close_bank_sleep,807        # click_poll_booth_sleep,808        # space_through_poll_chat_sleep,809        # close_bank_sleep,810        # click_bank_door_sleep,811        # click_account_guide_sleep,812        # talk_to_account_guide_until_panel_sleep,813        # click_panel_account_management_sleep,814        # click_account_guide_again,815        # talk_to_account_guide_until_exit_sleep,816        # click_door_exit_bank_second_sleep,817        # walk_south_to_altar_sleep,818        # walk_south_to_altar2_sleep,819        # walk_south_to_altar3_sleep,820        # click_brother_brace_sleep,821        # talk_brother_until_panel_prayer_sleep,822        # click_panel_prayer_sleep,823        # click_brother_brace_sleep,824        # talk_brother_until_panel_friends_sleep,825        # click_panel_friends_sleep,826        # click_brother_brace_sleep,827        # talk_brother_until_exit_sleep,828        # click_prayer_exit_door_sleep,829        # walk_to_magic_guy_sleep,830        # walk_to_magic_guy2_sleep,831        # click_magic_instructor_sleep,832        # talk_to_magic_instructor_until_panel_magic,833        # click_panel_magic_sleep,834        # click_magic_instructor2_sleep,835        walk_north_to_chickens_sleep,836        cast_air_strike_sleep,837        click_to_magic_guy_exit_sleep,838        talk_to_magic_instructor_until_exit_sleep,839    ]...test_AsyncServer.py
Source:test_AsyncServer.py  
1import asyncio2import logging3import pytest4from supriya import exceptions5from supriya.realtime import AsyncServer6@pytest.fixture(autouse=True)7def setup_logging(caplog):8    caplog.set_level(logging.INFO, logger="supriya")9@pytest.mark.asyncio10async def test_boot_only():11    server = AsyncServer()12    assert not server.is_running13    assert not server.is_owner14    await server.boot()15    assert server.is_running16    assert server.is_owner17@pytest.mark.asyncio18async def test_boot_and_quit():19    server = AsyncServer()20    assert not server.is_running21    assert not server.is_owner22    await server.boot()23    assert server.is_running24    assert server.is_owner25    await server.quit()26    assert not server.is_running27    assert not server.is_owner28@pytest.mark.asyncio29async def test_boot_and_boot():30    server = AsyncServer()31    assert not server.is_running32    assert not server.is_owner33    await server.boot()34    assert server.is_running35    assert server.is_owner36    with pytest.raises(exceptions.ServerOnline):37        await server.boot()38    assert server.is_running39    assert server.is_owner40@pytest.mark.asyncio41async def test_boot_and_quit_and_quit():42    server = AsyncServer()43    assert not server.is_running44    assert not server.is_owner45    await server.boot()46    assert server.is_running47    assert server.is_owner48    await server.quit()49    assert not server.is_running50    assert not server.is_owner51    await server.quit()52    assert not server.is_running53    assert not server.is_owner54@pytest.mark.asyncio55async def test_boot_and_connect():56    server = AsyncServer()57    assert not server.is_running58    assert not server.is_owner59    await server.boot()60    assert server.is_running61    assert server.is_owner62    with pytest.raises(exceptions.ServerOnline):63        await server.connect()64    assert server.is_running65    assert server.is_owner66@pytest.mark.asyncio67async def test_boot_a_and_boot_b_cannot_boot():68    server_a, server_b = AsyncServer(), AsyncServer()69    assert not server_a.is_running and not server_a.is_owner70    assert not server_b.is_running and not server_b.is_owner71    await server_a.boot(maximum_logins=4)72    assert server_a.is_running and server_a.is_owner73    assert not server_b.is_running and not server_b.is_owner74    with pytest.raises(exceptions.ServerCannotBoot):75        await server_b.boot(maximum_logins=4)76    assert server_a.is_running and server_a.is_owner77    assert not server_b.is_running and not server_b.is_owner78@pytest.mark.asyncio79async def test_boot_a_and_connect_b_too_many_clients():80    server_a, server_b = AsyncServer(), AsyncServer()81    assert not server_a.is_running and not server_a.is_owner82    assert not server_b.is_running and not server_b.is_owner83    await server_a.boot(maximum_logins=1)84    assert server_a.is_running and server_a.is_owner85    assert not server_b.is_running and not server_b.is_owner86    with pytest.raises(exceptions.TooManyClients):87        await server_b.connect()88    assert server_a.is_running and server_a.is_owner89    assert not server_b.is_running and not server_b.is_owner90@pytest.mark.asyncio91async def test_boot_a_and_connect_b_and_quit_a():92    server_a, server_b = AsyncServer(), AsyncServer()93    assert not server_a.is_running and not server_a.is_owner94    assert not server_b.is_running and not server_b.is_owner95    await server_a.boot(maximum_logins=2)96    await server_b.connect()97    assert server_a.is_running and server_a.is_owner98    assert server_b.is_running and not server_b.is_owner99    await server_a.quit()100    assert not server_a.is_running and not server_a.is_owner101    for _ in range(100):102        await asyncio.sleep(0.1)103        if not server_b.is_running:104            break105    assert not server_b.is_running and not server_b.is_owner106@pytest.mark.asyncio107async def test_boot_a_and_connect_b_and_disconnect_b():108    server_a, server_b = AsyncServer(), AsyncServer()109    assert not server_a.is_running and not server_a.is_owner110    assert not server_b.is_running and not server_b.is_owner111    await server_a.boot(maximum_logins=2)112    await server_b.connect()113    assert server_a.is_running and server_a.is_owner114    assert server_b.is_running and not server_b.is_owner115    await server_b.disconnect()116    assert server_a.is_running and server_a.is_owner117    assert not server_b.is_running and not server_b.is_owner118@pytest.mark.asyncio119async def test_boot_a_and_connect_b_and_disconnect_a():120    server_a, server_b = AsyncServer(), AsyncServer()121    assert not server_a.is_running and not server_a.is_owner122    assert not server_b.is_running and not server_b.is_owner123    await server_a.boot(maximum_logins=2)124    await server_b.connect()125    assert server_a.is_running and server_a.is_owner126    assert server_b.is_running and not server_b.is_owner127    with pytest.raises(exceptions.OwnedServerShutdown):128        await server_a.disconnect()129    assert server_a.is_running and server_a.is_owner130    assert server_b.is_running and not server_b.is_owner131@pytest.mark.asyncio132async def test_boot_a_and_connect_b_and_quit_b():133    server_a, server_b = AsyncServer(), AsyncServer()134    assert not server_a.is_running and not server_a.is_owner135    assert not server_b.is_running and not server_b.is_owner136    await server_a.boot(maximum_logins=2)137    await server_b.connect()138    assert server_a.is_running and server_a.is_owner139    assert server_b.is_running and not server_b.is_owner140    with pytest.raises(exceptions.UnownedServerShutdown):141        await server_b.quit()142    assert server_a.is_running and server_a.is_owner143    assert server_b.is_running and not server_b.is_owner144@pytest.mark.asyncio145async def test_boot_a_and_connect_b_and_force_quit_b():146    server_a, server_b = AsyncServer(), AsyncServer()147    assert not server_a.is_running and not server_a.is_owner148    assert not server_b.is_running and not server_b.is_owner149    await server_a.boot(maximum_logins=2)150    await server_b.connect()151    assert server_a.is_running and server_a.is_owner152    assert server_b.is_running and not server_b.is_owner153    await server_b.quit(force=True)154    assert not server_b.is_running and not server_b.is_owner155    for _ in range(100):156        await asyncio.sleep(0.1)157        if not server_a.is_running:158            break...__init__.py
Source:__init__.py  
1import warnings2from threading import Thread, Timer, Condition3import numpy4import importlib5from enum import Enum6from .block import Block, BlockType7# alternative perf_counter8import sys9from time import perf_counter10class ControllerWarning(Warning):11    pass12class ControllerException(Exception):13    pass14# state15IDLE = 016RUNNING = 117EXITING = 218from .block.container import Container19            20class Controller(Container):21    """22    :py:class:`pyctrl.Controller` provides functionality for running23    signal flow tasks.24    A Controller can be in one of three states:25    1. IDLE26    2. RUNNING27    3. EXITING28    Upon initialization a Controller state is set to IDLE.29    :param kwargs: should be left empty30    :raises: :py:class:`pyctrl.ControllerException` if any parameters are passed to py:data`**kwargs`31    """32    def __init__(self, **kwargs):33        # noclock34        self.noclock = kwargs.pop('noclock', False)35        36        # call super37        super().__init__(**kwargs)38    def _reset(self):39        # call super40        super()._reset()41        42        # state43        self.state = IDLE44        45        # real-time loop46        self.is_running = False47        # duty48        self.duty = 049        # running thread50        self.thread = None51        # signals52        self.signals.update({ 'is_running': self.is_running, 53                              'duty': self.duty })54                            55        # no clock?56        if not self.noclock:57            # add signal clock58            self.add_signal('clock')59            # add device clock60            self.add_source('clock',61                            ('pyctrl.block.clock', 'Clock'),62                            ['clock'],63                            enable = True)64            # reset clock65            self.set_source('clock', reset=True)66        67    # __str__ and __repr__68    def __str__(self):69        return self.info()70    __repr__ = __str__71    72    # reset73    def reset(self):74        """75        Stop the controller, remove all devices, sources, sinks,76        filters, and all signals except `is_running` and `duty`.77        Objects that inherit from `Controller` can customize `reset()`78        by overloading the private method `_reset()`.79        """80        # call stop81        self.stop()82        # call _reset83        self._reset()84    # get_state85    def get_state(self):86        """87        Return the current state of the Controller.88        :return: the state of the Controller89        """90        return self.state91    # set_state92    def set_state(self, state):93        """94        Set the current state of the Controller.95        :param state: the state of the controller96        """97        self.state = state98    99    def __enter__(self):100        101        self.start()102        return self103    def __exit__(self, type, value, traceback):104        105        self.stop()106    def run(self):107        # Loop108        self.is_running = True109        self.signals['is_running'] = self.is_running110        self.duty = 0111        self.signals['duty'] = self.duty112        # enable devices113        # print('> controller:: ENABLE')114        self.set_enabled(True)115        while self.is_running and self.state != EXITING:116            # call super117            duty = super().run()118            119            # update is_running120            self.is_running = self.signals['is_running']121            # update duty122            self.signals['duty'] = duty123            self.duty = max(self.duty, duty)124        # disable devices125        # print('< controller:: DISABLE')126        self.set_enabled(False)127        return self.duty128            129    def start(self):130        """131        Start Controller loop.132        """133        # stop first if running134        if self.is_running:135            warnings.warn('Controller is already running...')136            return137        138        # Start thread139        self.thread = Thread(target = self.run)140        self.thread.start()141        # change state to running142        self.state = RUNNING143    def stop(self):144        """145        Stop Controller loop.146        """147        # Stop thread148        if self.is_running:149            self.is_running = False150            self.signals['is_running'] = self.is_running151        # Wait for thread to finish152        if self.thread:153            self.thread.join()154            self.thread = None155            156        # change state to idle157        self.state = IDLE158    def join(self):159        """160        Wait for Controller thread to terminate.161        """162        if self.thread:...test_celery_runner.py
Source:test_celery_runner.py  
1"""2Tests for datacube._celery_runner3"""4from time import sleep5import subprocess6import pytest7import sys8from datacube import _celery_runner as cr9PORT = 2937410PASS = 'dfhksdjh23iuervao'11WRONG_PASS = 'sdfghdfjsghjdfiueuiwei'12REDIS_WAIT = 0.513def check_redis_binary():14    try:15        return subprocess.check_call(['redis-server', '--version']) == 016    except Exception:17        return False18have_redis = check_redis_binary()19skip_if_no_redis = pytest.mark.skipif(not have_redis, reason="Needs redis-server to run")20@skip_if_no_redis21def test_launch_redis_no_password():22    is_running = cr.check_redis(port=PORT)23    assert is_running is False, "Redis should not be running at the start of the test"24    redis_stop = cr.launch_redis(PORT, password=None, loglevel='verbose')25    assert redis_stop is not None26    sleep(REDIS_WAIT)27    is_running = cr.check_redis(port=PORT)28    assert is_running is True29    redis_stop()30    sleep(REDIS_WAIT)31    is_running = cr.check_redis(port=PORT)32    assert is_running is False33@skip_if_no_redis34def test_launch_redis_with_config_password():35    is_running = cr.check_redis(port=PORT)36    assert is_running is False, "Redis should not be running at the start of the test"37    redis_stop = cr.launch_redis(PORT, password='', loglevel='verbose')38    assert redis_stop is not None39    sleep(REDIS_WAIT)40    is_running = cr.check_redis(port=PORT, password='')41    assert is_running is True42    redis_stop()43    sleep(REDIS_WAIT)44    is_running = cr.check_redis(port=PORT, password='')45    assert is_running is False46@skip_if_no_redis47def test_launch_redis_with_custom_password():48    is_running = cr.check_redis(port=PORT)49    assert is_running is False, "Redis should not be running at the start of the test"50    redis_stop = cr.launch_redis(PORT, password=PASS, loglevel='verbose')51    assert redis_stop is not None52    sleep(REDIS_WAIT)53    is_running = cr.check_redis(port=PORT, password=PASS)54    assert is_running is True55    is_running = cr.check_redis(port=PORT, password=WRONG_PASS)56    assert is_running is False57    redis_stop()58    sleep(REDIS_WAIT)59    is_running = cr.check_redis(port=PORT, password=PASS)60    assert is_running is False61@pytest.mark.timeout(30)62@pytest.mark.skipif(sys.platform == 'win32',63                    reason="does not run on Windows")64@skip_if_no_redis65def test_celery_with_worker():66    DATA = [1, 2, 3, 4]67    def _echo(x, please_fail=False):68        if please_fail:69            raise IOError('Fake I/O error, cause you asked')70        return x71    def launch_worker():72        args = ['bash', '-c',73                'nohup python -m datacube.execution.worker --executor celery localhost:{} --nprocs 1 &'.format(PORT)]74        try:75            subprocess.check_call(args)76        except subprocess.CalledProcessError:77            return False78        return True79    assert cr.check_redis(port=PORT, password='') is False, "Redis should not be running at the start of the test"80    runner = cr.CeleryExecutor(host='localhost', port=PORT, password='')81    sleep(REDIS_WAIT)82    assert cr.check_redis(port=PORT, password='')83    # no workers yet84    future = runner.submit(_echo, 0)85    assert future.ready() is False86    runner.release(future)87    futures = runner.map(_echo, DATA)88    assert len(futures) == len(DATA)89    completed, failed, pending = runner.get_ready(futures)90    assert len(completed) == 091    assert len(failed) == 092    assert len(pending) == len(DATA)93    # not worker test done94    worker_started_ok = launch_worker()95    assert worker_started_ok96    futures = runner.map(_echo, DATA)97    results = runner.results(futures)98    assert len(results) == len(DATA)99    assert set(results) == set(DATA)100    # Test failure pass-through101    future = runner.submit(_echo, "", please_fail=True)102    for ff in runner.as_completed([future]):103        assert ff.ready() is True104        with pytest.raises(IOError):105            runner.result(ff)106    del runner107    # Redis shouldn't be running now.108    is_running = cr.check_redis(port=PORT)...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!!
