Running pep8 checks with ./run_tests.sh --pep8 results in ERROR messages

Bug #980009 reported by Kevin L. Mitchell
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Joe Gordon

Bug Description

Running "./run_tests.sh --pep8" results in the following messages:

Running PEP8 and HACKING compliance check...
Libvirt module could not be loaded. NWFilterFirewall will not work correctly.
ERROR: import 'import libvirt' failed: No module named libvirt
ERROR: import 'import qpid' failed: No module named qpid
ERROR: import 'from nova.rpc import impl_qpid' failed: No module named qpid.messaging
ERROR: import 'import qpid.messaging' failed: No module named qpid.messaging
ERROR: import 'import qpid.messaging.exceptions' failed: No module named qpid.messaging.exceptions
ERROR: import 'import libvirt' failed: No module named libvirt
ERROR: import 'import win32console as win' failed: No module named win32console
ERROR: import 'import win32console' failed: No module named win32console
ERROR: import 'import pywintypes' failed: No module named pywintypes
ERROR: import 'import rabbit' failed: No module named rabbit
ERROR: import 'import bpython' failed: No module named bpython
ERROR: import 'import IPython' failed: No module named IPython
ERROR: import 'import win32com.client' failed: No module named win32com.client
ERROR: import 'import simplejson as json' failed: No module named simplejson
tools/hacking.py:122: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  __import__(mod, globals(), locals(), [], -1)

ERROR: import 'import XenAPIPlugin' failed: No module named XenAPIPlugin
ERROR: import 'import XenAPIPlugin' failed: No module named XenAPIPlugin
ERROR: import 'import simplejson as json' failed: No module named simplejson
ERROR: import 'import XenAPIPlugin' failed: No module named XenAPIPlugin
ERROR: import 'import simplejson as json' failed: No module named simplejson
ERROR: import 'import XenAPIPlugin' failed: No module named XenAPIPlugin
ERROR: import 'import simplejson as json' failed: No module named simplejson
ERROR: import 'import XenAPIPlugin' failed: No module named XenAPIPlugin
ERROR: import 'import xenstore' failed: No module named XenAPIPlugin
ERROR: import 'import simplejson as json' failed: No module named simplejson
ERROR: import 'import simplejson as json' failed: No module named simplejson

Based on the DeprecationWarning emitted in the middle there, I suspect that this is specifically the checks against HACKING, implemented by tools/hacking.py. That file includes tests to ensure that imports are importing modules, rather than objects from modules, and would attempt each import discovered in all of nova; however, it would appear that it is not intercepting error messages about missing imports. As some of our imports are expected to potentially not be present, it should catch these messages and not emit them.

For the DeprecationWarning, by the way, there is a convenient way of inhibiting warnings by using the catch_warnings context manager from the warnings module.

Dan Prince (dan-prince)
Changed in nova:
assignee: nobody → Dan Prince (dan-prince)
status: New → In Progress
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/6706

Changed in nova:
assignee: Dan Prince (dan-prince) → Joe Gordon (joe-gordon0)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/6629
Committed: http://github.com/openstack/nova/commit/7ee0d7848d9292c0f888c890c492b011299a3bc3
Submitter: Jenkins
Branch: master

commit 7ee0d7848d9292c0f888c890c492b011299a3bc3
Author: Joe Gordon <email address hidden>
Date: Fri Apr 13 16:46:42 2012 -0400

    Improved tools/hacking.py

    * cleaner output
    * fix bug 980009
    * Fix N201
    * N306: alphabetical order imports
    * N401: docstring start
    * N402: one line docstring start
    * N403: multi line docstring end
    * Until fixed, N40* will be disabled by default

    Change-Id: I9addafdaa7a1f8fb950e14a5409f661dec6c7b87

Changed in nova:
status: In Progress → Fix Committed
Devin Carlen (devcamcar)
Changed in nova:
milestone: none → folsom-1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: folsom-1 → 2012.2
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.