Add missing PYTHONPATH variable export to pylint job in CI

The old .gitlab-ci.yaml accidentally worked because pylint
was importing modules internally, probably as a side-effect
of testing other code.

This pylint invocation errors out when PYTHONPATH is not set:
    $ pylint --rcfile $CI_PROJECT_DIR/.pylintrc bin/tests/system/keymgr/testpolicy.py
    ************* Module testpolicy
    bin/tests/system/keymgr/testpolicy.py:13:0: E0401: Unable to import 'isc' (import-error)

And this invocation works even without PYTHONPATH:
    $ pylint --rcfile $CI_PROJECT_DIR/.pylintrc bin/python/setup.py bin/tests/system/keymgr/testpolicy.py
This commit is contained in:
Petr Špaček 2021-11-08 16:43:05 +01:00
parent f3838f76ac
commit 21b5dd81ef
No known key found for this signature in database
GPG key ID: ABD587CDF06581AE

View file

@ -525,7 +525,7 @@ pylint:
artifacts: true
script:
- *configure
- PYTHONPATH="$PYTHONPATH:$CI_PROJECT_DIR/bin/python"
- export PYTHONPATH="$PYTHONPATH:$CI_PROJECT_DIR/bin/python"
- pylint --rcfile $CI_PROJECT_DIR/.pylintrc $(git ls-files '*.py' | grep -vE '(ans\.py|dangerfile\.py|^bin/tests/system/)')
# Ignore Pylint wrong-import-position error in system test to enable use of pytest.importorskip
- pylint --rcfile $CI_PROJECT_DIR/.pylintrc --disable=wrong-import-position $(git ls-files 'bin/tests/system/*.py' | grep -vE 'ans\.py')