← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1315035] [NEW] TypeError: fake_init_exception() with Neutron exceptions in the tests

 

Public bug reported:

When a Neutron Client exception is thrown in the unit tests (usually
because a call wasn't mocked properly, see e.g. bug 1284664), the
following error is displayed instead of the actual error:

TypeError: fake_init_exception() takes exactly 3 arguments (1 given)

Neutron seems to prefer to declare exceptions by overriding the message
attribute (and possibly adding additional information later, like a
'reason' for the failure), rather than passing the code + message around
as arguments.  We should handle this appropriately and display the
correct message.

An example of how to reproduce:
1. Open https://git.openstack.org/cgit/openstack/horizon/tree/openstack_dashboard/dashboards/project/instances/tests.py?id=e0dc562ec8
2. Comment out the api.network key/values from the stub declarations (L56-58), and comment out the network mocks in the test (L72, L75-76)
3. Run the tests

Actual results:
4. Trace shows as TypeError: fake_init_exception() takes exactly 3 arguments (1 given)

Expected results:
4. Trace shows the actual error (here something like Connection to Neutron failed: Maximum attempts reached)

** Affects: horizon
     Importance: Low
     Assignee: Julie Pichon (jpichon)
         Status: In Progress

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

Title:
  TypeError: fake_init_exception() with Neutron exceptions in the tests

Status in OpenStack Dashboard (Horizon):
  In Progress

Bug description:
  When a Neutron Client exception is thrown in the unit tests (usually
  because a call wasn't mocked properly, see e.g. bug 1284664), the
  following error is displayed instead of the actual error:

  TypeError: fake_init_exception() takes exactly 3 arguments (1 given)

  Neutron seems to prefer to declare exceptions by overriding the
  message attribute (and possibly adding additional information later,
  like a 'reason' for the failure), rather than passing the code +
  message around as arguments.  We should handle this appropriately and
  display the correct message.

  An example of how to reproduce:
  1. Open https://git.openstack.org/cgit/openstack/horizon/tree/openstack_dashboard/dashboards/project/instances/tests.py?id=e0dc562ec8
  2. Comment out the api.network key/values from the stub declarations (L56-58), and comment out the network mocks in the test (L72, L75-76)
  3. Run the tests

  Actual results:
  4. Trace shows as TypeError: fake_init_exception() takes exactly 3 arguments (1 given)

  Expected results:
  4. Trace shows the actual error (here something like Connection to Neutron failed: Maximum attempts reached)

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


Follow ups

References