[code-quality] pylint unit tests?

Skip Montanaro skip at pobox.com
Thu Jul 4 15:50:34 CEST 2013


>> How should PYTHONPATH be set?  How would I get a pytest command in my checkout?
>
> You should ensure that when you "import pylint", pylint.__path__ point to your
> checkout directory (or wherever you do your own modifications).

Thanks for the extra help.

Making this work required a bit of effort.  Distutils gets in the way
(inserting the various packages it installed in front of whatever
happens to be on PYTHONPATH), as does the default naming of the
logilab-common package.  For the benefit of others new to pylint
development, here's what I did.

1. I have checkouts of pylint, astroid and logilab-common in ~/src.  I
need to create ~/src/logilab, make it a package with an empty
__init__.py file, and mv logilab-common to ~/src/logilab/common.

2. Set PYTHONPATH to ~/src.

3. In the pylint/test directory, I ran this for loop:

for f in *.py ; do
  echo $f
  PYTHONPATH=$(pwd)/../.. python -S $f
done

The -S flag suppresses distutils' machinations.

When run this way, I get 100% success, modulo a few skips because of
other missing packages (gtk, etc).

I'll update doc/contribute.rst to reflect some of these extra steps
and create a separate pull request.

Skip


More information about the code-quality mailing list