← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1342464] [NEW] PEP 8 H305 test unpassable on both Python 2.6 & 2.7

 

Public bug reported:

https://review.openstack.org/105950 introduced (or, more precisely,
removed from flake8's ignore list) H305 which enforces grouping if
Python module imports by type: stdlib, third-party, or project-specific.
The problem is that some modules are third-party in Python 2.6, but
became part of the stdlib in Python 2.7.

For example, under Python 2.6:

./nova/cmd/manage.py:58:1: H305  imports not grouped correctly (argparse: third-party, os: stdlib)
./nova/tests/test_utils.py:19:1: H305  imports not grouped correctly (hashlib: stdlib, importlib: third-party)
./nova/tests/test_utils.py:20:1: H305  imports not grouped correctly (importlib: third-party, os: stdlib)

argparse and importlib are not part of Python 2.6's stdlib (and therefor
"third-party"), but were added to Python 2.7's stdlib.

This wasn't detect by the gate because, though Nova is tested against
Python 2.6 by gate-nova-python26, the PEP 8 tests are executed with
gate-nova-pep8, which appears to be using Python 2.7.

My proposed solution is to add "# noqa" to the aforementioned lines
(yes, those appear to be the only three occurrences), though that not
only makes them invisible to flake8 for Python 2.6, but unfortunately
Python 2.7 too.

I'll try to generate a patch in the next 24 hours unless someone beats
me to it.

** Affects: nova
     Importance: Undecided
         Status: New

-- 
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/1342464

Title:
  PEP 8 H305 test unpassable on both Python 2.6 & 2.7

Status in OpenStack Compute (Nova):
  New

Bug description:
  https://review.openstack.org/105950 introduced (or, more precisely,
  removed from flake8's ignore list) H305 which enforces grouping if
  Python module imports by type: stdlib, third-party, or project-
  specific.  The problem is that some modules are third-party in Python
  2.6, but became part of the stdlib in Python 2.7.

  For example, under Python 2.6:

  ./nova/cmd/manage.py:58:1: H305  imports not grouped correctly (argparse: third-party, os: stdlib)
  ./nova/tests/test_utils.py:19:1: H305  imports not grouped correctly (hashlib: stdlib, importlib: third-party)
  ./nova/tests/test_utils.py:20:1: H305  imports not grouped correctly (importlib: third-party, os: stdlib)

  argparse and importlib are not part of Python 2.6's stdlib (and
  therefor "third-party"), but were added to Python 2.7's stdlib.

  This wasn't detect by the gate because, though Nova is tested against
  Python 2.6 by gate-nova-python26, the PEP 8 tests are executed with
  gate-nova-pep8, which appears to be using Python 2.7.

  My proposed solution is to add "# noqa" to the aforementioned lines
  (yes, those appear to be the only three occurrences), though that not
  only makes them invisible to flake8 for Python 2.6, but unfortunately
  Python 2.7 too.

  I'll try to generate a patch in the next 24 hours unless someone beats
  me to it.

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


Follow ups

References