pytest-only
pytest-only copied to clipboard
ModuleNotFoundError: No module named 'pkg_resources' on Python 3.12
tox.ini
[tox]
minversion = 4.15.0
envlist = py312
[testenv]
deps =
pytest
pytest-only
commands = pytest --version
Commands
python3.12 -m venv venv
source venv/bin/activate
pip install tox
tox
Result
py312: commands[0]> pytest --version
Traceback (most recent call last):
File "/home/vagrant/works/temp/.tox/py312/bin/pytest", line 8, in <module>
sys.exit(console_main())
^^^^^^^^^^^^^^
File "/home/vagrant/works/temp/.tox/py312/lib/python3.12/site-packages/_pytest/config/__init__.py", line 206, in console_main
code = main()
^^^^^^
File "/home/vagrant/works/temp/.tox/py312/lib/python3.12/site-packages/_pytest/config/__init__.py", line 159, in main
config = _prepareconfig(args, plugins)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vagrant/works/temp/.tox/py312/lib/python3.12/site-packages/_pytest/config/__init__.py", line 346, in _prepareconfig
config = pluginmanager.hook.pytest_cmdline_parse(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vagrant/works/temp/.tox/py312/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vagrant/works/temp/.tox/py312/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vagrant/works/temp/.tox/py312/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
raise exception.with_traceback(exception.__traceback__)
File "/home/vagrant/works/temp/.tox/py312/lib/python3.12/site-packages/pluggy/_callers.py", line 122, in _multicall
teardown.throw(exception) # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vagrant/works/temp/.tox/py312/lib/python3.12/site-packages/_pytest/helpconfig.py", line 106, in pytest_cmdline_parse
config = yield
^^^^^
File "/home/vagrant/works/temp/.tox/py312/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vagrant/works/temp/.tox/py312/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1152, in pytest_cmdline_parse
self.parse(args)
File "/home/vagrant/works/temp/.tox/py312/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1501, in parse
self._preparse(args, addopts=addopts)
File "/home/vagrant/works/temp/.tox/py312/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1388, in _preparse
self.pluginmanager.load_setuptools_entrypoints("pytest11")
File "/home/vagrant/works/temp/.tox/py312/lib/python3.12/site-packages/pluggy/_manager.py", line 421, in load_setuptools_entrypoints
plugin = ep.load()
^^^^^^^^^
File "/usr/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
module = import_module(match.group('module'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "/home/vagrant/works/temp/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
exec(co, module.__dict__)
File "/home/vagrant/works/temp/.tox/py312/lib/python3.12/site-packages/pytest_only/__init__.py", line 2, in <module>
from .version import __version__
File "/home/vagrant/works/temp/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
exec(co, module.__dict__)
File "/home/vagrant/works/temp/.tox/py312/lib/python3.12/site-packages/pytest_only/version.py", line 1, in <module>
import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'
py312: exit 1 (0.14 seconds) /home/vagrant/works/temp> pytest --version pid=19750
py312: FAIL code 1 (0.17=setup[0.03]+cmd[0.14] seconds)
evaluation failed :( (0.22 seconds)