← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1221674] Re: test_midonet_lib failes because of a missing import

 

** Changed in: neutron
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1221674

Title:
  test_midonet_lib failes because of a missing import

Status in OpenStack Neutron (virtual network service):
  Fix Released

Bug description:
  This bug was reported by Dane Leblanc (leblancd) <leblancd@xxxxxxxxx>

  I don't know if anyone else is seeing this, but I'm seeing a failure
  in test_midonet_lib.py whereby the midonetclient module is not found
  for an import in midonet_lib.py:

  ImportError: Failed to import test module: neutron.tests.unit.midonet.test_midonet_lib
  Traceback (most recent call last):
    File "/usr/lib/python2.7/unittest/loader.py", line 252, in _find_tests
      module = self._get_module_from_name(name)
    File "/usr/lib/python2.7/unittest/loader.py", line 230, in _get_module_from_name
      __import__(name)
    File "/opt/stack/neutron/neutron/tests/unit/midonet/test_midonet_lib.py", line 29, in <module>
      from neutron.plugins.midonet import midonet_lib
    File "/opt/stack/neutron/neutron/plugins/midonet/midonet_lib.py", line 24, in <module>
      from midonetclient import midoapi_exceptions
  ImportError: No module named midonetclient

  I found that making the following change allows this test to pass:

  diff --git neutron/tests/unit/midonet/test_midonet_lib.py neutron/tests/unit/midonet/test_midonet_lib.py
  index 1dd6b3a..1774657 100644
  --- neutron/tests/unit/midonet/test_midonet_lib.py
  +++ neutron/tests/unit/midonet/test_midonet_lib.py
  @@ -20,6 +20,8 @@
   # @author: Tomoe Sugihara, Midokura Japan KK

   import mock
  +import sys
  +sys.modules["midonetclient"] = mock.Mock()
   import testtools
   import webob.exc as w_exc

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