[llvm] r283710 - [lit] Remove (or allow specific) unused imports

Chris Matthews via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 10 14:00:27 PDT 2016


Brian, this seems to break some of our bots with something along the lines of:

ImportError: 'module' object has no attribute ‘main'

These bots are installing lit into a virtualenv, then using it.
Many of our test bots are broken because of this.  Can you investigate or revert asap? Thanks!



On October 9, 2016 at 6:31:16 PM, Brian Gesiak via llvm-commits (llvm-commits at lists.llvm.org) wrote:

Author: modocache
Date: Sun Oct 9 20:22:06 2016
New Revision: 283710

URL: http://llvm.org/viewvc/llvm-project?rev=283710&view=rev
Log:
[lit] Remove (or allow specific) unused imports

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.

Reviewers: echristo, delcypher, beanz, ddunbar

Subscribers: mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D25407

Modified:
llvm/trunk/utils/lit/lit.py
llvm/trunk/utils/lit/lit/LitConfig.py
llvm/trunk/utils/lit/lit/__init__.py
llvm/trunk/utils/lit/lit/formats/__init__.py

Modified: llvm/trunk/utils/lit/lit.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit.py?rev=283710&r1=283709&r2=283710&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit.py (original)
+++ llvm/trunk/utils/lit/lit.py Sun Oct 9 20:22:06 2016
@@ -1,5 +1,6 @@
#!/usr/bin/env python

+from lit.main import main
+
if __name__=='__main__':
- import lit
- lit.main()
+ main()

Modified: llvm/trunk/utils/lit/lit/LitConfig.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/LitConfig.py?rev=283710&r1=283709&r2=283710&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/LitConfig.py (original)
+++ llvm/trunk/utils/lit/lit/LitConfig.py Sun Oct 9 20:22:06 2016
@@ -83,7 +83,7 @@ class LitConfig(object):
# a timeout per test. Check it's available.
# See lit.util.killProcessAndChildren()
try:
- import psutil
+ import psutil # noqa: F401
except ImportError:
self.fatal("Setting a timeout per test requires the"
" Python psutil module but it could not be"

Modified: llvm/trunk/utils/lit/lit/__init__.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/__init__.py?rev=283710&r1=283709&r2=283710&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/__init__.py (original)
+++ llvm/trunk/utils/lit/lit/__init__.py Sun Oct 9 20:22:06 2016
@@ -1,8 +1,5 @@
"""'lit' Testing Tool"""

-from __future__ import absolute_import
-from .main import main
-
__author__ = 'Daniel Dunbar'
__email__ = 'daniel at minormatter.com'
__versioninfo__ = (0, 6, 0)

Modified: llvm/trunk/utils/lit/lit/formats/__init__.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/formats/__init__.py?rev=283710&r1=283709&r2=283710&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/formats/__init__.py (original)
+++ llvm/trunk/utils/lit/lit/formats/__init__.py Sun Oct 9 20:22:06 2016
@@ -1,4 +1,8 @@
-from __future__ import absolute_import
-from lit.formats.base import TestFormat, FileBasedTest, OneCommandPerFileTest
-from lit.formats.googletest import GoogleTest
-from lit.formats.shtest import ShTest
+from lit.formats.base import ( # noqa: F401
+ TestFormat,
+ FileBasedTest,
+ OneCommandPerFileTest
+)
+
+from lit.formats.googletest import GoogleTest # noqa: F401
+from lit.formats.shtest import ShTest # noqa: F401


_______________________________________________
llvm-commits mailing list
llvm-commits at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161010/27383c66/attachment.html>


More information about the llvm-commits mailing list