← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1807970] [NEW] test_multi_cell_list fails in python 3.7

 

Public bug reported:

Generators used in multi cell list handling raise StopIteration, which
is not something python 3.7 likes. Efforts to add python 3.7 testing to
nova [1] revealed this (and similar for neighboring tests):

nova.tests.unit.compute.test_multi_cell_list.TestBaseClass.test_with_failing_cells
----------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    b'Traceback (most recent call last):'
    b'  File "/mnt/share/cdentsrc/nova/nova/compute/multi_cell_list.py", line 101, in query_wrapper'
    b'    for record in fn(ctx, *args, **kwargs):'
    b'  File "/mnt/share/cdentsrc/nova/nova/compute/multi_cell_list.py", line 348, in do_query'
    b'    **kwargs)'
    b'  File "/mnt/share/cdentsrc/nova/nova/tests/unit/compute/test_multi_cell_list.py", line 356, in get_by_filters'
    b'    raise exception.CellTimeout'
    b'nova.exception.CellTimeout: Timeout waiting for response from cell'
    b''
    b'During handling of the above exception, another exception occurred:'
    b''
    b'Traceback (most recent call last):'
    b'  File "/mnt/share/cdentsrc/nova/nova/compute/multi_cell_list.py", line 108, in query_wrapper'
    b'    raise StopIteration'
    b'StopIteration'
    b''
    b'The above exception was the direct cause of the following exception:'
    b''
    b'Traceback (most recent call last):'
    b'  File "/mnt/share/cdentsrc/nova/.tox/py37/lib/python3.7/site-packages/mock/mock.py", line 1305, in patched'
    b'    return func(*args, **keywargs)'
    b'  File "/mnt/share/cdentsrc/nova/nova/tests/unit/compute/test_multi_cell_list.py", line 384, in test_with_failing_cells'
    b'    self.assertEqual(50, len(list(result)))'
    b'  File "/mnt/share/cdentsrc/nova/nova/compute/multi_cell_list.py", line 400, in get_records_sorted'
    b'    item = next(feeder)'
    b'  File "/mnt/share/cdentsrc/nova/.tox/py37/lib/python3.7/heapq.py", line 359, in merge'
    b'    s[0] = next()           # raises StopIteration when exhausted'
    b'RuntimeError: generator raised StopIteration'
    b''

According to pep 479 [2] the fix for this is to 'return' instead of
'raise StopIteration'.


[1] https://review.openstack.org/#/c/624055/
[2] https://www.python.org/dev/peps/pep-0479/#writing-backwards-and-forwards-compatible-code

** Affects: nova
     Importance: Undecided
         Status: New


** Tags: testing

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1807970

Title:
  test_multi_cell_list fails in python 3.7

Status in OpenStack Compute (nova):
  New

Bug description:
  Generators used in multi cell list handling raise StopIteration, which
  is not something python 3.7 likes. Efforts to add python 3.7 testing
  to nova [1] revealed this (and similar for neighboring tests):

  nova.tests.unit.compute.test_multi_cell_list.TestBaseClass.test_with_failing_cells
  ----------------------------------------------------------------------------------

  Captured traceback:
  ~~~~~~~~~~~~~~~~~~~
      b'Traceback (most recent call last):'
      b'  File "/mnt/share/cdentsrc/nova/nova/compute/multi_cell_list.py", line 101, in query_wrapper'
      b'    for record in fn(ctx, *args, **kwargs):'
      b'  File "/mnt/share/cdentsrc/nova/nova/compute/multi_cell_list.py", line 348, in do_query'
      b'    **kwargs)'
      b'  File "/mnt/share/cdentsrc/nova/nova/tests/unit/compute/test_multi_cell_list.py", line 356, in get_by_filters'
      b'    raise exception.CellTimeout'
      b'nova.exception.CellTimeout: Timeout waiting for response from cell'
      b''
      b'During handling of the above exception, another exception occurred:'
      b''
      b'Traceback (most recent call last):'
      b'  File "/mnt/share/cdentsrc/nova/nova/compute/multi_cell_list.py", line 108, in query_wrapper'
      b'    raise StopIteration'
      b'StopIteration'
      b''
      b'The above exception was the direct cause of the following exception:'
      b''
      b'Traceback (most recent call last):'
      b'  File "/mnt/share/cdentsrc/nova/.tox/py37/lib/python3.7/site-packages/mock/mock.py", line 1305, in patched'
      b'    return func(*args, **keywargs)'
      b'  File "/mnt/share/cdentsrc/nova/nova/tests/unit/compute/test_multi_cell_list.py", line 384, in test_with_failing_cells'
      b'    self.assertEqual(50, len(list(result)))'
      b'  File "/mnt/share/cdentsrc/nova/nova/compute/multi_cell_list.py", line 400, in get_records_sorted'
      b'    item = next(feeder)'
      b'  File "/mnt/share/cdentsrc/nova/.tox/py37/lib/python3.7/heapq.py", line 359, in merge'
      b'    s[0] = next()           # raises StopIteration when exhausted'
      b'RuntimeError: generator raised StopIteration'
      b''

  According to pep 479 [2] the fix for this is to 'return' instead of
  'raise StopIteration'.

  
  [1] https://review.openstack.org/#/c/624055/
  [2] https://www.python.org/dev/peps/pep-0479/#writing-backwards-and-forwards-compatible-code

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1807970/+subscriptions


Follow ups