From 21b5dd81ef0cbdb5ac8577a41bd5e4bc1b5ef613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pa=C4=8Dek?= Date: Mon, 8 Nov 2021 16:43:05 +0100 Subject: [PATCH] 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 --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3107c4965f..c7e997a29c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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')