#30964 closed Bug (invalid)
macOS/SQLite test failure
Reported by: | Johannes Maron | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Simon Charette | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This bug was discovered during GitHub action trails, while running the test suite agianst macOS, see also: https://github.com/codingjoe/django/runs/292481675
FAIL: test_db_table (schema.tests.SchemaTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/runner/runners/2.160.0/work/django/django/django/test/utils.py", line 370, in inner return func(*args, **kwargs) File "/Users/runner/runners/2.160.0/work/django/django/tests/schema/tests.py", line 2249, in test_db_table self.assertForeignKeyExists(Book, "author_id", "schema_otherauthor") File "/Users/runner/runners/2.160.0/work/django/django/tests/schema/tests.py", line 207, in assertForeignKeyExists self.assertEqual(constraint_fk, (expected_fk_table, field)) AssertionError: Tuples differ: ('schema_author', 'id') != ('schema_otherauthor', 'id') First differing element 0: 'schema_author' 'schema_otherauthor' - ('schema_author', 'id') + ('schema_otherauthor', 'id') ? +++++ ---------------------------------------------------------------------- Ran 13209 tests in 487.293s
Change History (11)
comment:2 by , 5 years ago
Probably want to brew install sqlite
as well at https://github.com/codingjoe/django/blob/f67edd20b80de813d55f5df79c0d0c6134e8b754/.github/workflows/ci.yml#L52
comment:3 by , 5 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
This passed for me with SQLite 3.24, so I'm going to close assuming that the SQLite version is the underlying cause.
It's probably invalid
but I'll give it a needsinfo
since 7444f3252757ed4384623e5afd7dcfeef3e0c74e added a check_sqlite_version()
which raises if Database.sqlite_version_info < (3, 8, 3)
— so the version in play must be higher that that — maybe there's room for a cleanup here, if you can follow-up Joe 🤔
(No worries if not.)
comment:4 by , 5 years ago
Summary: | macOS test failure → macOS/SQLite test failure |
---|
comment:5 by , 5 years ago
Resolution: | needsinfo |
---|---|
Status: | closed → new |
Hold your horses, it's version 3.28.0 which should be supported, right?
Run python -c "import sqlite3; print(sqlite3.sqlite_version)" 3.28.0
comment:6 by , 5 years ago
Cc: | added |
---|
It should indeed be supported but I can't reproduce on macOS Mojave with 3.28.0.
Did brew install sqlite
help anyhow?
comment:7 by , 5 years ago
@Simon
$ brew update $ brew install sqlite Warning: sqlite 3.30.1 is already installed and up-to-date To reinstall 3.30.1, run `brew reinstall sqlite`
Interestingly enough sqlite3.sqlite_version
is still 3.28.0.
In am not 100% sure this is a sqlite issue. This could also be something OS related. Which would make sense considering that it apears to happen only on macOS.
comment:8 by , 5 years ago
Version: | 2.2 → master |
---|
comment:9 by , 5 years ago
Hey Joe:
Interestingly enough sqlite3.sqlite_version is still 3.28.0.
You have to tell Python where to find your SQLite. The internet suggests LD_LIBRARY_PATH, but on macOS I find you have to set DYLD_LIBRARY_PATH:
export DYLD_LIBRARY_PATH=/opt/homebrew/Cellar/sqlite/3.28.1/lib
Simon has a variation on those instructions here: https://github.com/orf/django-docker-box/issues/25
(I haven't had the bandwidth to try to reproduce this this week, but will have another go after the weekend. If I can't reproduce I will close as needsinfo.)
comment:10 by , 5 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
OK, I can't reproduce the issue here. I'll keep an eye on it but, short of more concrete steps, or someone else confirming, I'm not sure what we can do.
comment:11 by , 5 years ago
Resolution: | needsinfo → invalid |
---|
Thanks Carlton,
I was able to resolve this failure by:
- installing SQLite 3.31.1 using
brew install sqlite
- Setting
export DYLD_LIBRARY_PATH=/usr/local/Cellar/sqlite/3.31.1/lib
in the shell startup file (~/.bashrc
in my case)
Resolved as invalid
Quick question - Should we add this in the Troubleshooting section of Contributing guidelines - https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#troubleshooting?
Pretty sure this is related to the SQLite version installed.
What does
python -c"import sqlite3; print(sqlite3.version_info, sqlite3.sqlite_version)"
yield?