PEP8 conformance tests complain about missing files #2072

Closed
mdboom opened this Issue May 28, 2013 · 2 comments

Projects

None yet

2 participants

@mdboom
Member
mdboom commented May 28, 2013

There are some setuptools "stub" files for C extensions that only get exist when the C dependencies are present on the system. Unfortunately, these stub files are not PEP8 compliant, and making them PEP8 compliant would probably require patching setuptools.

Here's an example:

def __bootstrap__():
   global __bootstrap__, __loader__, __file__
   import sys, pkg_resources, imp
   __file__ = pkg_resources.resource_filename(__name__,'_gtkagg.so')
   __loader__ = None; del __bootstrap__, __loader__
   imp.load_dynamic(__name__,__file__)
__bootstrap__()

The PEP8 conformance test will fail if these files are present, so I excluded them. However, since they don't exist on Travis, we now get this over there:

======================================================================
ERROR: matplotlib.tests.test_coding_standards.test_pep8_conformance
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/matplotlib-1.3.x-py2.7-linux-x86_64.egg/matplotlib/tests/test_coding_standards.py", line 231, in test_pep8_conformance
    '{}'.format('\n  '.join(unexpectedly_good)))
ValueError: Some exclude patterns were unnecessary as the files they pointed to either passed the PEP8 tests or do not point to a file:
  */matplotlib/backends/_backend_gdk.py
  */matplotlib/backends/_gtkagg.py
----------------------------------------------------------------------

I think I'd prefer it if it was just silent if an excluded file is missing.

@pelson: What do you think?

@pelson
Member
pelson commented May 29, 2013

I submitted a PR to distribute to fix the PEP8 problem, but it was rejected on the grounds of mirroring v0.7 of setuptools (https://bitbucket.org/tarek/distribute/pull-request/40/made-bootstrap-bdist_egg-files-pep8/activity).

I encountered this problem when writing the test in the first place and thought I'd excluded all of the C wrappers, but clearly I've missed some. Just add the necessary files to the list at https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/tests/test_coding_standards.py#L195 😉

@mdboom
Member
mdboom commented May 29, 2013

Ah -- I missed that other list the first time. I have fixed this in 8eef95e

@mdboom mdboom closed this May 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment