How to use _discover method in avocado

Best Python code snippet using avocado_python

vm_discover_test.py

Source:vm_discover_test.py Github

copy

Full Screen

1#!/usr/bin/env python2import unittest3from bardolph.controller import light_set4from bardolph.fakes import fake_lifx5from bardolph.vm.call_stack import CallStack6from bardolph.vm.machine import Registers7from bardolph.vm.vm_codes import Operand8from bardolph.vm.vm_discover import VmDiscover9from tests import test_module10class VmDiscoverTest(unittest.TestCase):11 def setUp(self):12 test_module.configure()13 self._make_light_set()14 self._reg = Registers()15 self._discover = VmDiscover(CallStack(), self._reg)16 def test_all_lights(self):17 self._reg.operand = Operand.LIGHT18 self._discover.disc()19 for name in ('light_02', 'light_01', 'light_00'):20 self._assert_and_next(name)21 self.assertEqual(self._reg.result, Operand.NULL)22 def test_all_lights_fwd(self):23 self._reg.operand = Operand.LIGHT24 self._reg.disc_forward = True25 self._discover.disc()26 for name in ('light_00', 'light_01', 'light_02'):27 self._assert_and_next(name)28 self.assertEqual(self._reg.result, Operand.NULL)29 def test_all_groups(self):30 self._reg.operand = Operand.GROUP31 self._discover.disc()32 self._assert_and_next('x')33 self._assert_and_next('group')34 self.assertEqual(self._reg.result, Operand.NULL)35 def test_all_groups_fwd(self):36 self._reg.operand = Operand.GROUP37 self._reg.disc_forward = True38 self._discover.disc()39 self._assert_and_next('group')40 self._assert_and_next('x')41 self.assertEqual(self._reg.result, Operand.NULL)42 def test_all_locations(self):43 self._reg.operand = Operand.LOCATION44 self._discover.disc()45 self._assert_and_next('y')46 self._assert_and_next('loc')47 self.assertEqual(self._reg.result, Operand.NULL)48 def test_all_locations_fwd(self):49 self._reg.operand = Operand.LOCATION50 self._reg.disc_forward = True51 self._discover.disc()52 self._assert_and_next('loc')53 self._assert_and_next('y')54 self.assertEqual(self._reg.result, Operand.NULL)55 def test_group_membership(self):56 self._reg.operand = Operand.GROUP57 self._discover.discm('group')58 self._assert_and_nextm('group', 'light_02')59 self._assert_and_nextm('group', 'light_00')60 self.assertEqual(self._reg.result, Operand.NULL)61 def test_group_membership_fwd(self):62 self._reg.operand = Operand.GROUP63 self._reg.disc_forward = True64 self._discover.discm('group')65 self._assert_and_nextm('group', 'light_00')66 self._assert_and_nextm('group', 'light_02')67 self.assertEqual(self._reg.result, Operand.NULL)68 def test_location_membership(self):69 self._reg.operand = Operand.LOCATION70 self._discover.discm('loc')71 self._assert_and_nextm('loc', 'light_02')72 self._assert_and_nextm('loc', 'light_00')73 self.assertEqual(self._reg.result, Operand.NULL)74 def test_location_membership_fwd(self):75 self._reg.operand = Operand.LOCATION76 self._reg.disc_forward = True77 self._discover.discm('loc')78 self._assert_and_nextm('loc', 'light_00')79 self._assert_and_nextm('loc', 'light_02')80 self.assertEqual(self._reg.result, Operand.NULL)81 @staticmethod82 def _make_light_set():83 color = [1, 2, 3, 4]84 fake_lifx.using([85 ('light_01', 'x', 'y', color, False),86 ('light_02', 'group', 'loc', color, False),87 ('light_00', 'group', 'loc', color, False)88 ]).configure()89 light_set.configure()90 def _assert_and_next(self, name):91 self.assertEqual(self._reg.result, name)92 self._discover.dnext(name)93 def _assert_and_nextm(self, lights, name):94 self.assertEqual(self._reg.result, name)95 self._discover.dnextm(lights, name)96if __name__ == '__main__':...

Full Screen

Full Screen

discovery.py

Source:discovery.py Github

copy

Full Screen

...9 .. seealso::10 The asynchronous equivalent11 :py:func:`pupil_labs.realtime_api.discovery.discover_devices`12 """13 async def _discover():14 async with AsyncNetwork() as network:15 await asyncio.sleep(search_duration_seconds)16 return network.devices17 return [Device.from_discovered_device(dev) for dev in asyncio.run(_discover())]18def discover_one_device(19 max_search_duration_seconds: T.Optional[float] = 10.0,20) -> T.Optional[Device]:21 """Return the first device that could be found in the given search duration.22 .. seealso::23 The asynchronous equivalent24 :py:func:`pupil_labs.realtime_api.discovery.Network.wait_for_new_device`25 """26 async def _discover():27 async with AsyncNetwork() as network:28 return await network.wait_for_new_device(max_search_duration_seconds)29 device = asyncio.run(_discover())...

Full Screen

Full Screen

__init__.py

Source:__init__.py Github

copy

Full Screen

...15 # Parse command line arguments16 args = utils.parse_args(REQUIRED_CONFIG_KEYS)17 # If discover flag was passed, run discovery mode and dump output to stdout18 if args.discover:19 catalog = _discover(args.config)20 catalog.dump()21 # Otherwise run in sync mode22 else:23 if args.catalog:24 catalog = args.catalog25 else:26 catalog = _discover(args.config)27 sync(args.config, args.state, catalog)28if __name__ == "__main__":...

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

Helpful

NotHelpful