From 952085c84d80a7fe40bf0fdfadf7d4eaf0fbcc61 Mon Sep 17 00:00:00 2001 From: "Mr. Senko" Date: Wed, 30 Oct 2019 13:50:52 +0200 Subject: [PATCH] tests: clone pylint locally for CI. Fixes #250 Pylint 2.4.0 (PyCQA/pylint@33b8185) removed the 'test' module from its package and this broke our tests. Clone the sources locally and adjust the paths so that CI continues to work. --- .travis.yml | 3 +++ pylint_django/tests/test_func.py | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 25a4ae81..2ca6545f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,9 @@ matrix: - { stage: test, python: 3.6, env: TOXENV=readme } - { stage: build_and_package_sanity, python: 3.6, env: SANITY_CHECK=1 } +before_install: + - git clone --depth 1 https://github.com/PyCQA/pylint.git + install: - pip install tox-travis - pip install -e .[for_tests] diff --git a/pylint_django/tests/test_func.py b/pylint_django/tests/test_func.py index b8bfbab9..a02a1020 100644 --- a/pylint_django/tests/test_func.py +++ b/pylint_django/tests/test_func.py @@ -4,8 +4,15 @@ import pytest import pylint -# because there's no __init__ file in pylint/test/ -sys.path.append(os.path.join(os.path.dirname(pylint.__file__), 'test')) + +if pylint.__version__ >= '2.4': + # after version 2.4 pylint stopped shipping the test directory + # as part of the package so we check it out locally for testing + sys.path.append(os.getenv('HOME'), 'pylint', 'tests') +else: + # because there's no __init__ file in pylint/test/ + sys.path.append(os.path.join(os.path.dirname(pylint.__file__), 'test')) + import test_functional # noqa: E402 # alter sys.path again because the tests now live as a subdirectory