How to use get_tools method in prospector

Best Python code snippet using prospector_python

test_suites.py

Source:test_suites.py Github

copy

Full Screen

...26 name = uuid.uuid4().hex27 path = os.path.join(self.root, name)28 suite.save(path)29 suite2 = Suite.load(path)30 self.assertEqual(suite.get_tools(), suite2.get_tools())31 self.assertEqual(set(suite.context_names), set(suite2.context_names))32 def test_1(self):33 """Test empty suite."""34 path = os.path.join(self.root, "suite1")35 s = Suite()36 tools = s.get_tools()37 self.assertEqual(tools, {})38 self._test_serialization(s)39 def test_2(self):40 """Test basic suite."""41 c_foo = ResolvedContext(["foo"])42 c_bah = ResolvedContext(["bah"])43 s = Suite()44 s.add_context("foo", c_foo)45 s.add_context("bah", c_bah)46 expected_tools = set(["fooer", "bahbah", "blacksheep"])47 self.assertEqual(set(s.get_tools().keys()), expected_tools)48 s.set_context_prefix("foo", "fx_")49 expected_tools = set(["fx_fooer", "bahbah", "blacksheep"])50 self.assertEqual(set(s.get_tools().keys()), expected_tools)51 s.set_context_suffix("foo", "_fun")52 s.set_context_suffix("bah", "_anim")53 expected_tools = set(["fx_fooer_fun", "bahbah_anim", "blacksheep_anim"])54 self.assertEqual(set(s.get_tools().keys()), expected_tools)55 s.remove_context("bah")56 expected_tools = set(["fx_fooer_fun"])57 self.assertEqual(set(s.get_tools().keys()), expected_tools)58 s.add_context("bah", c_bah)59 expected_tools = set(["fx_fooer_fun", "bahbah", "blacksheep"])60 self.assertEqual(set(s.get_tools().keys()), expected_tools)61 s.alias_tool("bah", "blacksheep", "whitesheep")62 expected_tools = set(["fx_fooer_fun", "bahbah", "whitesheep"])63 self.assertEqual(set(s.get_tools().keys()), expected_tools)64 # explicit alias takes precedence over prefix/suffix65 s.alias_tool("foo", "fooer", "floober")66 expected_tools = set(["floober", "bahbah", "whitesheep"])67 self.assertEqual(set(s.get_tools().keys()), expected_tools)68 s.unalias_tool("foo", "fooer")69 s.unalias_tool("bah", "blacksheep")70 expected_tools = set(["fx_fooer_fun", "bahbah", "blacksheep"])71 self.assertEqual(set(s.get_tools().keys()), expected_tools)72 s.hide_tool("bah", "bahbah")73 expected_tools = set(["fx_fooer_fun", "blacksheep"])74 self.assertEqual(set(s.get_tools().keys()), expected_tools)75 s.unhide_tool("bah", "bahbah")76 expected_tools = set(["fx_fooer_fun", "bahbah", "blacksheep"])77 self.assertEqual(set(s.get_tools().keys()), expected_tools)78 self._test_serialization(s)79 def test_3(self):80 """Test tool clashes in a suite."""81 c_foo = ResolvedContext(["foo"])82 c_bah = ResolvedContext(["bah"])83 s = Suite()84 s.add_context("foo", c_foo)85 s.add_context("bah", c_bah)86 s.add_context("bah2", c_bah)87 expected_tools = set(["fooer", "bahbah", "blacksheep"])88 self.assertEqual(set(s.get_tools().keys()), expected_tools)89 self.assertEqual(s.get_tool_context("bahbah"), "bah2")90 self.assertEqual(s.get_tool_context("blacksheep"), "bah2")91 s.bump_context("bah")92 self.assertEqual(s.get_tool_context("bahbah"), "bah")93 self.assertEqual(s.get_tool_context("blacksheep"), "bah")94 expected_conflicts = set(["bahbah", "blacksheep"])95 self.assertEqual(set(s.get_conflicting_aliases()), expected_conflicts)96 s.set_context_prefix("bah", "hey_")97 expected_tools = set(["fooer", "bahbah", "blacksheep",98 "hey_bahbah", "hey_blacksheep"])99 self.assertEqual(set(s.get_tools().keys()), expected_tools)100 s.remove_context_prefix("bah")101 expected_tools = set(["fooer", "bahbah", "blacksheep"])102 self.assertEqual(set(s.get_tools().keys()), expected_tools)103 self.assertEqual(s.get_tool_context("bahbah"), "bah")104 self.assertEqual(s.get_tool_context("blacksheep"), "bah")105 s.hide_tool("bah", "bahbah")106 self.assertEqual(s.get_tool_context("bahbah"), "bah2")107 s.unhide_tool("bah", "bahbah")108 self.assertEqual(s.get_tool_context("bahbah"), "bah")109 self._test_serialization(s)110if __name__ == '__main__':111 unittest.main()112# Copyright 2013-2016 Allan Johns.113#114# This library is free software: you can redistribute it and/or115# modify it under the terms of the GNU Lesser General Public116# License as published by the Free Software Foundation, either...

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