How to use dump_variant method in avocado

Best Python code snippet using avocado_python

test_fingerprinting.py

Source:test_fingerprinting.py Github

copy

Full Screen

...58 data = mgr.get_data()59 data.setdefault("fingerprint", ["{{ default }}"])60 apply_server_fingerprinting(data, config)61 evt = eventstore.create_event(data=data)62 def dump_variant(v):63 rv = v.as_dict()64 for key in "component", "description", "hash", "config":65 rv.pop(key, None)66 return rv67 insta_snapshot(68 {69 "config": config.to_json(),70 "fingerprint": data["fingerprint"],71 "variants": {k: dump_variant(v) for (k, v) in evt.get_grouping_variants().items()},72 }...

Full Screen

Full Screen

test_variants.py

Source:test_variants.py Github

copy

Full Screen

...6from sentry.models import Event7from sentry.event_manager import EventManager8from sentry.grouping.component import GroupingComponent9from sentry.grouping.strategies.configurations import CONFIGURATIONS10def dump_variant(variant, lines=None, indent=0):11 if lines is None:12 lines = []13 def _dump_component(component, indent):14 if not component.hint and not component.values:15 return16 lines.append('%s%s%s%s' % (17 ' ' * indent,18 component.id,19 component.contributes and '*' or '',20 component.hint and ' (%s)' % component.hint or '',21 ))22 for value in component.values:23 if isinstance(value, GroupingComponent):24 _dump_component(value, indent + 1)25 else:26 lines.append(' ' * (indent + 1) + repr(value))27 lines.append('%shash: %r' % (' ' * indent, variant.get_hash()))28 for (key, value) in sorted(variant.__dict__.items()):29 if isinstance(value, GroupingComponent):30 lines.append('%s%s:' % (' ' * indent, key))31 _dump_component(value, indent + 1)32 elif key == 'config':33 # We do not want to dump the config34 continue35 else:36 lines.append('%s%s: %r' % (' ' * indent, key, value))37 return lines38_fixture_path = os.path.join(os.path.dirname(__file__), 'inputs')39def load_configs():40 configs = CONFIGURATIONS.keys()41 rv = []42 for filename in os.listdir(_fixture_path):43 if filename.endswith('.json'):44 for config in configs:45 rv.append((config, filename[:-5]))46 rv.sort()47 return rv48@pytest.mark.parametrize(49 'config_name,test_name',50 load_configs(),51 ids=lambda x: x.replace("-", "_") # Nicer folder structure for insta_snapshot52)53def test_event_hash_variant(insta_snapshot, config_name, test_name, log):54 with open(os.path.join(_fixture_path, test_name + '.json')) as f:55 input = json.load(f)56 grouping_config = {57 'id': config_name,58 }59 mgr = EventManager(data=input, grouping_config=grouping_config)60 mgr.normalize()61 data = mgr.get_data()62 evt = Event(data=data, platform=data['platform'])63 rv = []64 for (key, value) in sorted(evt.get_grouping_variants().items()):65 if rv:66 rv.append('-' * 74)67 rv.append('%s:' % key)68 dump_variant(value, rv, 1)69 output = '\n'.join(rv)70 log(repr(evt.get_hashes()))71 assert evt.get_grouping_config() == grouping_config...

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