Merge pull request #48472 from gtmanfred/2017.7

use tox to run pylint
This commit is contained in:
Daniel Wallace 2018-07-06 21:46:46 -05:00 committed by GitHub
commit 22cd4206c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 9 deletions

View file

@ -16,8 +16,7 @@ pipeline {
stage('setup') {
steps {
sh 'eval "$(pyenv init -)"; pyenv install 2.7.14 || echo "We already have this python."; pyenv local 2.7.14; pyenv shell 2.7.14'
sh 'eval "$(pyenv init -)"; pip install pylint SaltPyLint'
sh 'eval "$(pyenv init -)"; which pylint; pylint --version'
sh 'eval "$(pyenv init -)"; pip install tox'
}
}
stage('linting') {
@ -25,13 +24,13 @@ pipeline {
parallel {
stage('salt linting') {
steps {
sh 'eval "$(pyenv init -)"; pylint --rcfile=.testing.pylintrc --disable=W1307,str-format-in-logging setup.py salt/ | tee pylint-report.xml'
sh 'eval "$(pyenv init -)"; tox -e pylint-salt | tee pylint-report.xml'
archiveArtifacts artifacts: 'pylint-report.xml'
}
}
stage('test linting') {
steps {
sh 'eval "$(pyenv init -)"; pylint --rcfile=.testing.pylintrc --disable=W0232,E1002,W1307,str-format-in-logging tests/ | tee pylint-report-tests.xml'
sh 'eval "$(pyenv init -)"; tox -e pylint-tests | tee pylint-report-tests.xml'
archiveArtifacts artifacts: 'pylint-report-tests.xml'
}
}

View file

@ -10,3 +10,4 @@ git+https://github.com/saltstack/pytest-salt.git@master#egg=pytest-salt
# satisfy other requirements, and httpretty 0.8.10 has bugs in setup.py that
# prevent it from being successfully installed (at least on Python 3.4).
httpretty; python_version >= '3.4'
pylint==1.6.5

View file

@ -210,7 +210,7 @@ import tornado
TORNADO_50 = tornado.version_info >= (5,)
if not TORNADO_50:
import zmq.eventloop.ioloop
import zmq.eventloop.ioloop # pylint: disable=import-error
# instantiate the zmq IOLoop (specialized poller)
zmq.eventloop.ioloop.install()

View file

@ -14,8 +14,8 @@
# Import python libs
from __future__ import absolute_import
# pylint: disable=blacklisted-module
from distutils.version import StrictVersion as _StrictVersion
from distutils.version import LooseVersion as _LooseVersion
from distutils.version import StrictVersion as _StrictVersion # pylint: disable=no-name-in-module
from distutils.version import LooseVersion as _LooseVersion # pylint: disable=no-name-in-module
# pylint: enable=blacklisted-module
# Import 3rd-party libs

View file

@ -366,7 +366,7 @@ class DownloadWindowsDlls(Command):
import pip
# pip has moved many things to `_internal` starting with pip 10
if LooseVersion(pip.__version__) < LooseVersion('10.0'):
from pip.utils.logging import indent_log
from pip.utils.logging import indent_log # pylint: disable=no-name-in-module
else:
from pip._internal.utils.logging import indent_log # pylint: disable=no-name-in-module
platform_bits, _ = platform.architecture()

18
tox.ini
View file

@ -1,5 +1,5 @@
[tox]
envlist = py27,py34,py35,py36
envlist = py27,py34,py35,py36,pylint-salt,pylint-tests
skip_missing_interpreters = True
skipsdist = True
@ -9,6 +9,22 @@ commands = pytest --rootdir {toxinidir} {posargs}
passenv = LANG HOME
sitepackages = True
[testenv:pylint-salt]
basepython = python2.7
deps = -r{toxinidir}/requirements/dev.txt
commands =
pylint --version
pylint --rcfile=.testing.pylintrc --disable=W1307,str-format-in-logging setup.py salt/
sitepackages = False
[testenv:pylint-tests]
basepython = python2.7
deps = -r{toxinidir}/requirements/dev.txt
commands =
pylint --version
pylint --rcfile=.testing.pylintrc --disable=W1307,str-format-in-logging setup.py salt/
sitepackages = False
[pytest]
addopts = --log-file /tmp/salt-runtests.log --no-print-logs --ssh-tests -ra -sv
testpaths = tests