Logic of nova-cells test case 'test_cells_scheduler.test_filter_schedule_skipping' is odd

Bug #1560437 reported by Wenzhi Yu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Undecided
Wenzhi Yu

Bug Description

Logic of nova-cells test case 'nova.tests.unit.cells.test_cells_scheduler.test_filter_schedule_skipping'[1] is really odd:

def test_filter_schedule_skipping(self):
 # if a filter handles scheduling, short circuit

 def _grab(filter_properties):
  return None

 self.stubs.Set(self.scheduler, '_grab_target_cells', _grab)

 def _test(self, *args):
  raise test.TestingException("shouldn't be called")

 try:
  self.scheduler._schedule_build_to_cells(None, None, None, _test,
            None)
 except test.TestingException:
  self.fail("Scheduling did not properly short circuit")

It uses a try-except block to ensure that '_test()' function will not be called during case execution, which is odd and poorly readable.

[1]https://github.com/openstack/nova/blob/13.0.0.0rc1/nova/tests/unit/cells/test_cells_scheduler.py#L354-L369

Wenzhi Yu (yuywz)
Changed in nova:
assignee: nobody → Wenzhi Yu (yuywz)
description: updated
Wenzhi Yu (yuywz)
description: updated
Changed in nova:
status: New → In Progress
Revision history for this message
Wenzhi Yu (yuywz) wrote :
Revision history for this message
Sylvain Bauza (sylvain-bauza) wrote :

I don't feel it's a bug. You should just provide a change, without really needing to add this one.

Changed in nova:
status: In Progress → Invalid
Revision history for this message
Markus Zoeller (markus_z) (mzoeller) wrote :

In addition to comment #2:
The commit message of the change is documentation enough. No need to go through the bug triage process.

Changed in nova:
status: Invalid → In Progress
Wenzhi Yu (yuywz)
Changed in nova:
status: In Progress → Invalid
Revision history for this message
Wenzhi Yu (yuywz) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.