Skip to content

Commit 11181aa

Browse files
committed
tests: clone pylint locally for CI. Fixes #250
Pylint 2.4.0 (pylint-dev/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.
1 parent 695d1b6 commit 11181aa

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ matrix:
2626
- { stage: test, python: 3.6, env: TOXENV=readme }
2727
- { stage: build_and_package_sanity, python: 3.6, env: SANITY_CHECK=1 }
2828

29+
before_install:
30+
- git clone --depth 1 https://github.com/PyCQA/pylint.git ~/pylint
31+
2932
install:
3033
- pip install tox-travis
3134
- pip install -e .[for_tests]

pylint_django/tests/test_func.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@
44
import pytest
55

66
import pylint
7-
# because there's no __init__ file in pylint/test/
8-
sys.path.append(os.path.join(os.path.dirname(pylint.__file__), 'test'))
7+
8+
if pylint.__version__ >= '2.4':
9+
# after version 2.4 pylint stopped shipping the test directory
10+
# as part of the package so we check it out locally for testing
11+
sys.path.append(os.path.join(os.getenv('HOME', '/home/travis'), 'pylint', 'tests'))
12+
else:
13+
# because there's no __init__ file in pylint/test/
14+
sys.path.append(os.path.join(os.path.dirname(pylint.__file__), 'test'))
15+
916
import test_functional # noqa: E402
1017

1118
# alter sys.path again because the tests now live as a subdirectory

0 commit comments

Comments
 (0)