How to use configure_node method in pytest-cov

Best Python code snippet using pytest-cov

test_tasks.py

Source:test_tasks.py Github

copy

Full Screen

...21 Test that, if the node is active, it configures it.22 """23 mock_node = mock_node_class.query.get.return_value24 mock_node.provider_status = 'active'25 configure_node(123)26 mock_node.update_provider_attributes.assert_called()27 mock_node.configure.assert_called()28 @patch('app.tasks.configure_node')29 @patch('app.tasks.Node')30 def test_configure_node_unsuccessful_new(self, mock_node_class, mock_configure_node):31 """32 Test that,33 if the node is new,34 it reschedules configuration for a later time.35 """36 mock_node = mock_node_class.query.get.return_value37 mock_node.provider_status = 'new'38 configure_node(123)39 mock_node.update_provider_attributes.assert_called()40 mock_node.configure.assert_not_called()41 mock_configure_node.apply_async.assert_called()42 @patch('app.tasks.configure_node')43 @patch('app.tasks.Node')44 def test_configure_node_unsuccessful_off(self, mock_node_class, mock_configure_node):45 """46 Test that,47 if the node is off,48 it reschedules configuration for a later time.49 """50 mock_node = mock_node_class.query.get.return_value51 mock_node.provider_status = 'off'52 configure_node(123)53 mock_node.update_provider_attributes.assert_called()54 mock_node.configure.assert_not_called()55 mock_configure_node.apply_async.assert_called()56 @patch('app.tasks.configure_node')57 @patch('app.tasks.Node')58 def test_configure_node_unsuccessful_unknown(self, mock_node_class, mock_configure_node):59 """60 Test that,61 if the node has an unrecognized status,62 it throws an exception.63 """64 mock_node = mock_node_class.query.get.return_value65 mock_node.provider_status = 'exploding'66 with self.assertRaises(Exception):67 configure_node(123)68 mock_node.update_provider_attributes.assert_called()69 mock_node.configure.assert_not_called()70 mock_configure_node.apply_async.assert_not_called()71 def test_delete_unprovisioned_nodes(self):72 """73 Test that74 old nodes that were never provisioned are deleted,75 along with their invoices.76 """77 one_day_ago = datetime.utcnow() - timedelta(days=1)78 twelve_day_ago = datetime.utcnow() - timedelta(days=12)79 user = User(email='test@example.com', password='abcd')80 db.session.add(user)81 db.session.commit()...

Full Screen

Full Screen

depth4_reduction_right.py

Source:depth4_reduction_right.py Github

copy

Full Screen

...44# convert to fixed point 8 for use in hardware45vec_a_f8 = [cast_f_to_f8(val) for val in vec_a_fp]46vec_b_f8 = [cast_f_to_f8(val) for val in vec_b_fp]47# re-useables48def configure_node(node, Data, Inject_En):49 config_port = dut.skeleton.node_v_port[node]50 yield dut.config_ports[config_port].En.eq(1)51 yield dut.config_ports[config_port].Addr.eq(node.id)52 yield dut.config_ports[config_port].Data.eq(Data)53 yield dut.config_ports[config_port].Inject_En.eq(Inject_En)54def process():55 # set collect port to collect from node 056 # and node 4. The values should actually be57 # the same with a delay of 258 yield dut.select_ports[0].eq(0)59 yield dut.select_ports[1].eq(5)60 # set leave weights61 yield from configure_node(nodes[7], vec_a_f8[0], 0)62 yield from configure_node(nodes[11], vec_a_f8[4], 0)63 yield Tick()64 yield from configure_node(nodes[8], vec_a_f8[1], 1)65 yield from configure_node(nodes[12], vec_a_f8[5], 1)66 yield Tick()67 yield from configure_node(nodes[9], vec_a_f8[2], 0)68 yield from configure_node(nodes[13], vec_a_f8[6], 0)69 yield Tick()70 yield from configure_node(nodes[10], vec_a_f8[3], 1)71 yield from configure_node(nodes[14], vec_a_f8[7], 1)72 yield Tick()73 # configure adder nodes74 yield from configure_node(nodes[2], ConfigUp.sum_l_r, 0)75 yield from configure_node(nodes[3], ConfigUp.l, 0)76 yield from configure_node(nodes[4], ConfigForward.sum_l_r, 0)77 yield from configure_node(nodes[5], ConfigUp.sum_l_r_f, 0)78 yield from configure_node(nodes[6], ConfigUp.r, 0)79 yield Tick()80 yield from configure_node(nodes[1], ConfigUp.l, 0)81 yield Tick()82 yield from configure_node(nodes[0], ConfigUp.sum_l_r, 0)83 yield Tick()84 # start injecting data over which to perform85 # computation86 for inject_val, port in zip(vec_b_f8[::2], dut.inject_ports):87 yield port.eq(inject_val)88 yield Tick()89 for inject_val, port in zip(vec_b_f8[1::2], dut.inject_ports):90 yield port.eq(inject_val)91 yield Tick()92 yield Tick()93 yield Tick()94 yield from print_sig(dut.collect_ports[1], format=cast_f8_to_f)95 # allow value to propagate to collection port96 for tick in range(2):...

Full Screen

Full Screen

ParseConfigure.py

Source:ParseConfigure.py Github

copy

Full Screen

...34 self.core_tree.write(self.core_site,encoding="utf-8") 35 def write_yarn(self):36 self.yarn_tree.write(self.yarn_site,encoding="utf-8") 37 def configure_mapred(self,key,value):38 self.configure_node(self.mapred_tree,key,value)39 self.write_mapred()40 def configure_hdfs(self,key,value):41 self.configure_node(self.hdfs_tree,key,value)42 self.write_hdfs()43 def configure_core(self,key,value):44 self.configure_node(self.core_tree,key,value)45 self.write_core()46 def configure_yarn(self,key,value):47 self.configure_node(self.yarn_tree,key,value)48 self.write_yarn()49 def configure_node(self,tree,key,value):50 property_nodes = tree.getroot().findall("property")51 if len(property_nodes)==0:52 print "load property error"53 return 54 for property_node in tree.findall("property"):55 if property_node.find("name").text==key:56 property_node.find("value").text=value57 else:...

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 pytest-cov 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