autotest / virt-test

Linux Virtualization Tests
Other
97 stars 146 forks source link

tools.check_patch: always fails, no name 'client' in module 'autotest' #275

Closed ldoktor closed 10 years ago

ldoktor commented 11 years ago

Hi @lmr

with your patch 707048147c58611d190ddedc5375e12230b7f8e1 the check_patch.py always fails since pylint returns failure:

E0611:  2,0: No name 'client' in module 'autotest'

or similar. Since this is not error, but a way how imports works in autotest, shouldn't this be handled somehow differently? Or do I have just an incorrect setup?

Regards, Lukáš

lmr commented 11 years ago

Oh drat, I forgot to try things with the autotest rpm installed. During the release work for 0.15, I removed the autotest-framework package and ran all my stuff with the AUTOTEST_PATH env variable set. If you use that instead of the RPM things go smoothly. I need to get back to the rpm so I can figure out how to fix this (maybe ignore E0611)...

ldoktor commented 11 years ago

Hi, I'm using uninstalled git version of autotest (and always set the AUTOTEST_PATH on the cmdline. Anyway I also disabled the error as a temporary solution...

cevich commented 11 years ago

I tried fixing this by importing autotest module in checkpatch and run_pylint, but not fix it. I tried adding --init-hook="import autotest" and --init-hook="import common" but also not fix. I tried setting my AUTOTEST_PATH but not fix if using RPM. Suspect problem is inside 'common' because it expects 'client' to be located at ../../../ or something.

cevich commented 11 years ago

@lmr I found I can make this specific message go away by removing the whole logilab.common.modutils section and class CustomImportsChecker section. However, this causes a lot of other module name errors :S

I also found the errors all go away if I just run pylint from the command-line:

 pylint --reports=no --rcfile=/dev/null --good-names=i,j,k,Run,_,vm --msg-template="{msg_id}:{line:3d},{column}: {obj}: {msg}" --disable=E1002,E1101,E1103,E1120,F0401,I0011 virttest/libvirt_vm.py

Though again, it's a lot more noisy, but there certainly aren't any can't import errors. Anyway, my point is, I think the root of the problem is inside the combination of logilab.common.modutils section and class CustomImportsChecker section. I just have zero-clue how they work or what they do to even begin to know how to fix them.

lmr commented 10 years ago

This is a small bug on the autotest rpm. The workaround is to add to /usr/lib/python2.7/site-packages/autotest/__init__.py

__all__ = ['client', 'common']
import client
import common

Eventually @clebergnu can think of a cleaner solution once we start publishing our own autotest packages.

ldoktor commented 10 years ago

Hi Lucas, this doesn't work for me as I don't have this autotest.rpm installed. What works for me is to extend autotest path as runner does https://github.com/autotest/virt-test/pull/1432