Add compile option to Dockerfile to fix failing test (fixes #696) #1223
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This test was failing when run inside the Docker container:
test_searchable[/fixtures/searchable.json?_search=te*+AND+do*&_searchmode=raw-expected_rows3]
,with this error:
The issue was that the version of sqlite3 built inside the Docker container was built with FTS3 and FTS4 enabled, but without the
SQLITE_ENABLE_FTS3_PARENTHESIS
compile option passed, which adds support for usingAND
andNOT
withinmatch
expressions (see https://sqlite.org/fts3.html#compiling_and_enabling_fts3_and_fts4 and https://www.sqlite.org/compile.html).Without this, the
AND
used in the search in this test was being interpreted as a literal string, and so no matches were found. Adding this compile option fixes this.I actually ran into this issue because the same test was failing when I ran the test suite on my own machine, outside of Docker, and so I eventually tracked this down to my system sqlite3 also being compiled without this option.
I wonder if this is a sign of a slightly deeper issue, that Datasette can silently behave differently based on the version and compilation of sqlite3 it is being used with. On my own system I fixed the test suite by running
pip install pysqlite3-binary
, so that this would be picked up instead of thesqlite
package, as this seems to be compiled using this option, . Maybe usingpysqlite3-binary
could be installed/recommended by default so a more deterministic version of sqlite is used? Or there could be some feature detection done on the available sqlite version, to know what features are available and can be used/tested?