Skip to content

cukinia_python_pkg: Fix check for import module - #111

Merged
kevlhop merged 1 commit into
savoirfairelinux:masterfrom
edraac:era/master/find-spec-fix
Oct 10, 2026
Merged

kevlhop merged 1 commit into
savoirfairelinux:masterfrom
edraac:era/master/find-spec-fix

Conversation

@edraac

@edraac edraac commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Note: I found this due to this discussion, I was attempting to set up something closer to your CI in order to run future tests if needed and noticed that I introduced an issue in 48915f3. I'm not sure why it didn't fail in CI due to the wrong import (AFAIK my container has the same Ubuntu and Python version), but I decided to fix it anyway.

Commit message:

Tests for cukinia_python_pkg failed in a toolbx container running Ubuntu 24.04 with Python 3.12. Two issues were found:

  1. The condition to check for find_loader was never met, so find_spec was always used
  2. In (at least) Python 3.12, 'import importlib' fails and 'import importlib.util' should be used (both of these work in 3.14)

Issue 1 was probably masked by versions of Python supporting find_spec (3.4+), while Issue 2 was probably masked by versions of Python where 'import importlib' works as expected.

Tests for cukinia_python_pkg failed in a toolbx container running
Ubuntu 24.04 with Python 3.12. Two issues were found:

1. The condition to check for find_loader was never met, so find_spec
   was always used
2. In (at least) Python 3.12, 'import importlib' fails and 'import
   importlib.util' should be used (both of these work in 3.14)

Issue 1 was probably masked by versions of Python supporting find_spec
(3.4+), while Issue 2 was probably masked by versions of Python where
'import importlib' works as expected.

Signed-off-by: Eduardo Ramirez <eramirez@data-modul.com>
@kevlhop
kevlhop merged commit d8d6a31 into savoirfairelinux:master Oct 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants