Merge #11835: Add Travis check for unused Python imports

d60b32074 Add Travis check for unused Python imports (practicalswift)
c7399e708 Remove unused Python imports (practicalswift)

Pull request description:

  Add Travis check for unused Python imports.

  ```
  $ contrib/devtools/lint-python.sh
  ./test/functional/example_test.py:18:1: F401 'test_framework.mininode.NODE_NETWORK' imported but unused
  ./test/functional/test_framework/messages.py:27:1: F401 'test_framework.util.wait_until' imported but unused
  ./test/functional/test_framework/test_framework.py:16:1: F401 'traceback' imported but unused
  ```

Tree-SHA512: 78e50fb1488abe3ebe365e766cb8d6d448cf1bd16c8691e102cb9bf7c202988bdf6e10b25ff772c62e05c72568168462e88cdc7ad98069d9eb3be727735b2d56
This commit is contained in:
MarcoFalke 2017-12-10 18:32:55 -05:00
commit f60b4ad579
No known key found for this signature in database
GPG Key ID: D2EA4850E7528B25
5 changed files with 13 additions and 4 deletions

View File

@ -21,7 +21,7 @@ env:
- WINEDEBUG=fixme-all
matrix:
# ARM
- HOST=arm-linux-gnueabihf PACKAGES="g++-arm-linux-gnueabihf" DEP_OPTS="NO_QT=1" CHECK_DOC=1 GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports"
- HOST=arm-linux-gnueabihf PACKAGES="g++-arm-linux-gnueabihf python3-pip" DEP_OPTS="NO_QT=1" CHECK_DOC=1 GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports"
# Win32
- HOST=i686-w64-mingw32 DPKG_ADD_ARCH="i386" DEP_OPTS="NO_QT=1" PACKAGES="python3 nsis g++-mingw-w64-i686 wine1.6" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-reduce-exports"
# Qt4 & system libs
@ -43,6 +43,7 @@ install:
- if [ -n "$DPKG_ADD_ARCH" ]; then sudo dpkg --add-architecture "$DPKG_ADD_ARCH" ; fi
- if [ -n "$PACKAGES" ]; then travis_retry sudo apt-get update; fi
- if [ -n "$PACKAGES" ]; then travis_retry sudo apt-get install --no-install-recommends --no-upgrade -qq $PACKAGES; fi
- if [ "$CHECK_DOC" = 1 -a "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then travis_retry pip3 install flake8 --user; fi
before_script:
- if [ "$CHECK_DOC" = 1 -a "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then contrib/devtools/commit-script-check.sh $TRAVIS_COMMIT_RANGE; fi
- if [ "$CHECK_DOC" = 1 ]; then contrib/devtools/git-subtree-check.sh src/crypto/ctaes; fi

10
contrib/devtools/lint-python.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
#
# Copyright (c) 2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Check for specified flake8 warnings in python files.
# F401: module imported but unused
flake8 --ignore=B,C,E,F,I,N,W --select=F401 .

View File

@ -22,7 +22,6 @@ from test_framework.mininode import (
mininode_lock,
msg_block,
msg_getdata,
NODE_NETWORK,
)
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (

View File

@ -24,7 +24,7 @@ import struct
import time
from test_framework.siphash import siphash256
from test_framework.util import hex_str_to_bytes, bytes_to_hex_str, wait_until
from test_framework.util import hex_str_to_bytes, bytes_to_hex_str
MIN_VERSION_SUPPORTED = 60001
MY_VERSION = 70014 # past bip-31 for ping/pong

View File

@ -13,7 +13,6 @@ import shutil
import sys
import tempfile
import time
import traceback
from .authproxy import JSONRPCException
from . import coverage