Failing tests for python 3.12
blotero opened this issue · 1 comments
When running contribution tests for python 3.12 env:
tox -e py312
I get the following output:
py312: install_package> python -I -m pip install --force-reinstall --no-deps /home/brandon/remotes/pytest-mock/.tox/.tmp/package/3/pytest-mock-3.12.1.dev10+g3d48ff9.tar.gz
py312: commands[0]> coverage run --append --source=/home/brandon/remotes/pytest-mock/.tox/py312/lib/python3.12/site-packages/pytest_mock -m pytest tests --color=yes
Traceback (most recent call last):
File "/home/brandon/remotes/pytest-mock/.tox/py312/bin/coverage", line 5, in <module>
from coverage.cmdline import main
File "/home/brandon/remotes/pytest-mock/.tox/py312/lib/python3.12/site-packages/coverage/__init__.py", line 24, in <module>
from coverage.control import (
File "/home/brandon/remotes/pytest-mock/.tox/py312/lib/python3.12/site-packages/coverage/control.py", line 28, in <module>
from coverage.collector import Collector, HAS_CTRACER
File "/home/brandon/remotes/pytest-mock/.tox/py312/lib/python3.12/site-packages/coverage/collector.py", line 19, in <module>
from coverage.data import CoverageData
File "/home/brandon/remotes/pytest-mock/.tox/py312/lib/python3.12/site-packages/coverage/data.py", line 24, in <module>
from coverage.sqldata import CoverageData
File "/home/brandon/remotes/pytest-mock/.tox/py312/lib/python3.12/site-packages/coverage/sqldata.py", line 16, in <module>
import sqlite3
File "/usr/local/lib/python3.12/sqlite3/__init__.py", line 57, in <module>
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.12/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
py312: exit 1 (0.05 seconds) /home/brandon/remotes/pytest-mock> coverage run --append --source=/home/brandon/remotes/pytest-mock/.tox/py312/lib/python3.12/site-packages/pytest_mock -m pytest tests --color=yes pid=2829753
.pkg: _exit> python /home/brandon/remotes/pytest-mock/.env/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
py312: FAIL code 1 (6.26=setup[6.21]+cmd[0.05] seconds)
evaluation failed :( (6.32 seconds)
I'm running this in Debian 12 inside a venv
with python 3.12.1
, and by the way, also get a similar failure when running pre-commit install
:
Traceback (most recent call last):
File "/home/brandon/remotes/pytest-mock/.env/bin/pre-commit", line 5, in <module>
from pre_commit.main import main
File "/home/brandon/remotes/pytest-mock/.env/lib/python3.12/site-packages/pre_commit/main.py", line 14, in <module>
from pre_commit.commands.clean import clean
File "/home/brandon/remotes/pytest-mock/.env/lib/python3.12/site-packages/pre_commit/commands/clean.py", line 6, in <module>
from pre_commit.store import Store
File "/home/brandon/remotes/pytest-mock/.env/lib/python3.12/site-packages/pre_commit/store.py", line 6, in <module>
import sqlite3
File "/usr/local/lib/python3.12/sqlite3/__init__.py", line 57, in <module>
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.12/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
Is there any other tool required to be installed in the machine and therefore not documented in contributing docs or is this a bug?
The stacktrace you posted points at inside coverage
, so this isn't really anything related to pytest-mock.
It's neither really - you seem to have a broken Python missing the built-in sqlite3 module. Given the /usr/local/lib
path, I'm assuming you built it yourself, and it was built without sqlite3 support. A quick search for the error message will lead you to possible causes, the most probably being that you didn't install libsqlite3-dev
before building Python.