Title: #5636: Improve assertion when verifying paths for Python modules
Heh, I had written a whole wall of text replying to your last comment, but then I
investigated a bit more and ended up finding what's happening. In a nutshell:
* Ubuntu Impish (the development version) is using Python 3.9.5.
* Debian sid is using Python 3.9.2.
When I looked at the Python 3.9.5 changelog, I found this bug:
And voilà: everything makes sense. Python 3.9.5+ resolves relative paths in imported
modules, which breaks the current test because, unless `SSS_TEST_DIR` is set (which it is
not), the path will always be relative. IMHO, and if I understand the purpose of the
test, this means that the proposed change is actually the correct way to address this
For what it's worth, and because I had written so much before:
* I don't think there is a way to determine the "chroot" part from
`module.__file__`, because from what I gathered the path change happens even when
you're building sssd outside of a chroot (inside a VM, a container or even natively,
for example). Moreover, it's not really possible to determine that we're inside a
chroot just by looking at this path. For example, for `sbuild` the
`<<PKGBUILDDIR>>` part is actually something like
`build/sssd-GhFpxp/sssd-2.4.1`, which is a regular path like any other.
See the full comment at https://github.com/SSSD/sssd/pull/5636#issuecomment-843637837