]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add missing PYTHONPATH variable export to pylint job in CI
authorPetr Špaček <pspacek@isc.org>
Mon, 8 Nov 2021 15:43:05 +0000 (16:43 +0100)
committerPetr Špaček <pspacek@isc.org>
Tue, 9 Nov 2021 12:13:56 +0000 (13:13 +0100)
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

index 3107c4965f923c67f90349543d34ca5d13e8e828..c7e997a29c4f70a2bd3c22a35f5cc92dc4950cc1 100644 (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')