When pylint runs in parallel, it seems to process paths to individual files differently from when -j 1 is set. Since with change detection we pass a list of individual files, this is a problem.
For exampe running ANTSIBULL_CHANGE_DETECTION=true nox -Re codeqa -v in the checkout of ansible-collections/community.docker#1155 results in the errors shown in CI, while nox -Re codeqa -v passes. I've traced the call chain back to:
pylint.lint.expand_modules() calls astroid.modutils.modpath_from_file()
astroid.modutils.modpath_from_file() calls astroid.interpreter._import.util.is_namespace()
astroid.interpreter._import.util.is_namespace() calls importlib.util._find_spec_from_path()
- The latter returns different results depending on wether pylint is called with
-j 1 or not.
The problem seems to be that _frozen_importlib_external.PathFinder.find_spec() returns None (without -j 1) vs. a proper spec (with -j 1) for ansible_collections. I've tried adding print() statements to my system's importlib version, but for some reason that doesn't result in anything.