This is an archive of the discontinued LLVM Phabricator instance.

[lit] Remove (or allow specific) unused imports
ClosedPublic

Authored by modocache on Oct 9 2016, 1:41 PM.

Details

Summary

Using Python linter flake8 on the utils/lit reveals several linter
warnings designated "F401: Unused import". Fix or silence these
warnings.

Some of these unused imports are legitimate, while some are part of lit's API.
For example, users of lit expect to be able to access lit.formats.ShTest in
their lit.cfg, despite the module hierarchy for that symbol actually being
lit.formats.shtest.ShTest. To silence linter errors for these lines,
include a "noqa" directive.

Event Timeline

modocache updated this revision to Diff 74078.Oct 9 2016, 1:41 PM
modocache retitled this revision from to [lit] Remove (or allow specific) unused imports.
modocache updated this object.
modocache added a subscriber: llvm-commits.
ddunbar accepted this revision.Oct 9 2016, 5:04 PM
ddunbar edited edge metadata.
This revision is now accepted and ready to land.Oct 9 2016, 5:04 PM
modocache closed this revision.Oct 9 2016, 6:31 PM
grimar added a subscriber: grimar.Oct 10 2016, 5:13 AM

Hi Brian, I have a error after that change on windows (when reverting r283710, it is works fine again):

C:\c_make_build_dir\Debug\bin\llvm-lit.py -v C:\llvm\test\Object\invalid.test
Traceback (most recent call last):

  File "C:\c_make_build_dir\Debug\bin\llvm-lit.py", line 44, in <module>
    lit.main(builtin_parameters)
AttributeError: 'module' object has no attribute 'main'
asb added a subscriber: asb.Oct 10 2016, 6:17 AM

Hi Brian, I have a error after that change on windows (when reverting r283710, it is works fine again):

C:\c_make_build_dir\Debug\bin\llvm-lit.py -v C:\llvm\test\Object\invalid.test
Traceback (most recent call last):

  File "C:\c_make_build_dir\Debug\bin\llvm-lit.py", line 44, in <module>
    lit.main(builtin_parameters)
AttributeError: 'module' object has no attribute 'main'

Same issue on Arch:

./bin/llvm-lit test
Traceback (most recent call last):
  File "./bin/llvm-lit", line 44, in <module>
    lit.main(builtin_parameters)
AttributeError: module 'lit' has no attribute 'main'

@chapuni Apologies again! I'm testing llvm-lit with Python 3 now. I assume it's been fixed by the other patches (thanks again), but I'm double-checking now.

I'm at r283822 and have confirmed that the following work:

python3 /path/to/llvm/build/bin/llvm-lit /path/to/llvm/utils/lit/tests
python3 /path/to/llvm/build/bin/llvm-lit /path/to/llvm/build/test