avocado-framework / avocado

Avocado is a set of tools and libraries to help with automated testing. One can call it a test framework with benefits. Native tests are written in Python and they follow the unittest pattern, but any executable can serve as a test.
https://avocado-framework.github.io/
Other
345 stars 343 forks source link

Usage of external dependency "packaging" in avocado/utils/kernel.py #5988

Closed clebergnu closed 2 months ago

clebergnu commented 3 months ago

Describe the bug The packaging module, while a suggested replacement for pkg_resources in Python 3.12, is not a standard library module, but an external one.

If setuptools<70.0 is present, the "packaging" package needs to be installed. If, setuptools>=70 is installed, it probably contains packaging as a "vendor" submodule.

This means that currently, installations of Avocado on systems with setuptools <70.0, need another external library (packaging) or will not be able to use avocado.utils.kernel.

Steps to reproduce On a Fedora 40 system:

$ dnf install python3-pip python3-setuptools
$ python3 -m pip install avocado-framework==106.0
$ python3 -c 'import avocado.utils.kernel'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.12/site-packages/avocado/utils/kernel.py", line 26, in <module>
    from packaging.version import parse
ModuleNotFoundError: No module named 'packaging'

Expected behavior A successful import of avocado.utils.kernel

Current behavior A failure to import it:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.12/site-packages/avocado/utils/kernel.py", line 26, in <module>
    from packaging.version import parse
ModuleNotFoundError: No module named 'packaging'

System information (please complete the following information):

richtja commented 3 months ago

This was probably caused by changes in #5942