From 448ec86e90b483d69eba36c9f15d6a96581d3b7e Mon Sep 17 00:00:00 2001 From: Joachim Metz Date: Tue, 9 Jun 2020 15:09:18 +0200 Subject: [PATCH] Moved pylint CI tests to run from tox (#160) --- .travis.yml | 16 +++++++++------- config/travis/install.sh | 25 +++++-------------------- config/travis/run_pylint.sh | 22 ---------------------- config/travis/runtests.sh | 8 -------- tox.ini | 18 +++++++++++++++++- 5 files changed, 31 insertions(+), 58 deletions(-) delete mode 100755 config/travis/run_pylint.sh diff --git a/.travis.yml b/.travis.yml index 738664aa..357d146e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,13 +4,6 @@ os: linux dist: bionic jobs: include: - - name: "Pylint on Ubuntu Bionic (20.04) (Docker) with Python 3.8" - env: [TARGET="pylint", UBUNTU_VERSION="20.04"] - group: edge - language: python - python: 3.8 - services: - - docker - name: "Fedora 31 (Docker) with Python 3.7" env: FEDORA_VERSION="31" group: edge @@ -75,6 +68,15 @@ jobs: python: 3.8 services: - docker + - name: "Pylint on Ubuntu Focal (20.04) (Docker) with Python 3.8 (tox)" + env: + - TOXENV="pylint" + - UBUNTU_VERSION="20.04" + group: edge + language: python + python: 3.8 + services: + - docker - name: "MacOS 10.14 with Python 3.7 (tox)" env: TOXENV="py37" os: osx diff --git a/config/travis/install.sh b/config/travis/install.sh index 56caaf44..c5a23644 100755 --- a/config/travis/install.sh +++ b/config/travis/install.sh @@ -35,12 +35,6 @@ then RPM_PACKAGES="python3-tox"; else - RPM_PACKAGES=""; - - if test ${TARGET} = "pylint"; - then - RPM_PACKAGES="${RPM_PACKAGES} findutils pylint"; - fi RPM_PACKAGES="${RPM_PACKAGES} python3 ${RPM_PYTHON3_DEPENDENCIES} ${RPM_PYTHON3_TEST_DEPENDENCIES}"; fi docker exec ${CONTAINER_NAME} dnf install -y ${RPM_PACKAGES}; @@ -76,21 +70,12 @@ then if test -n "${TOXENV}"; then DPKG_PACKAGES="build-essential curl python${TRAVIS_PYTHON_VERSION} python${TRAVIS_PYTHON_VERSION}-dev tox"; + + elif test "${TARGET}" = "jenkins3"; + then + DPKG_PACKAGES="sudo"; else - DPKG_PACKAGES=""; - - if test "${TARGET}" = "jenkins3"; - then - DPKG_PACKAGES="${DPKG_PACKAGES} sudo"; - - elif test ${TARGET} = "pylint"; - then - DPKG_PACKAGES="${DPKG_PACKAGES} python3-distutils pylint"; - fi - if test "${TARGET}" != "jenkins3"; - then - DPKG_PACKAGES="${DPKG_PACKAGES} python3 ${DPKG_PYTHON3_DEPENDENCIES} ${DPKG_PYTHON3_TEST_DEPENDENCIES}"; - fi + DPKG_PACKAGES="python3 ${DPKG_PYTHON3_DEPENDENCIES} ${DPKG_PYTHON3_TEST_DEPENDENCIES}"; fi docker exec -e "DEBIAN_FRONTEND=noninteractive" ${CONTAINER_NAME} sh -c "apt-get install -y ${DPKG_PACKAGES}"; diff --git a/config/travis/run_pylint.sh b/config/travis/run_pylint.sh deleted file mode 100755 index a6f63d4f..00000000 --- a/config/travis/run_pylint.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# Script to run pylint on Travis-CI. -# -# This file is generated by l2tdevtools update-dependencies.py, any dependency -# related changes should be made in dependencies.ini. - -# Exit on error. -set -e; - -pylint --version - -# Ignore setup.py for now due to: -# setup.py:15:0: E0001: Cannot import 'distutils.command.bdist_msi' due to -# syntax error 'expected an indented block (, line 347)' (syntax-error) - -for FILE in $(find config dfdatetime tests -name \*.py); -do - echo "Checking: ${FILE}"; - - pylint --rcfile=.pylintrc ${FILE}; -done diff --git a/config/travis/runtests.sh b/config/travis/runtests.sh index 3fc69a79..7f099f55 100755 --- a/config/travis/runtests.sh +++ b/config/travis/runtests.sh @@ -16,10 +16,6 @@ then if test -n "${TOXENV}"; then TEST_COMMAND="tox -e ${TOXENV}"; - - elif test "${TARGET}" = "pylint"; - then - TEST_COMMAND="./config/travis/run_pylint.sh"; else TEST_COMMAND="./config/travis/run_python3.sh"; fi @@ -46,10 +42,6 @@ then elif test "${TARGET}" = "jenkins3"; then TEST_COMMAND="./config/jenkins/linux/run_end_to_end_tests_py3.sh travis"; - - elif test "${TARGET}" = "pylint"; - then - TEST_COMMAND="./config/travis/run_pylint.sh"; else TEST_COMMAND="./config/travis/run_python3.sh"; fi diff --git a/tox.ini b/tox.ini index f7543c5b..ed703d4b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py3{5,6,7,8},coverage +envlist = py3{5,6,7,8},coverage,pylint [testenv] pip_pre = True @@ -29,3 +29,19 @@ deps = codecov commands = codecov + +[testenv:pylint] +skipsdist=True +pip_pre = True +setenv = + PYTHONPATH = {toxinidir} +deps = + -rrequirements.txt + -rtest_requirements.txt + pylint >= 2.4.0, < 2.5.0 +commands = + pylint --version + # Ignore setup.py for now due to: + # setup.py:15:0: E0001: Cannot import 'distutils.command.bdist_msi' due to + # syntax error 'expected an indented block (, line 347)' (syntax-error) + pylint --rcfile=.pylintrc dfdatetime tests