Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unittest error no such function: to_tsvector #67

Open
chrisspen opened this issue Nov 30, 2015 · 0 comments
Open

Unittest error no such function: to_tsvector #67

chrisspen opened this issue Nov 30, 2015 · 0 comments

Comments

@chrisspen
Copy link

I have a package that runs some unittests on a Django model with a VectorField. Since Django runs its unittests with an in-memory Sqlite3 database that doesn't support VectorField, it throws the error:

  File "/usr/local/myproject/.env/local/lib/python2.7/site-packages/django/db/models/base.py", line 546, in save
    force_update=force_update, update_fields=update_fields)
  File "/usr/local/myproject/.env/local/lib/python2.7/site-packages/django/db/models/base.py", line 664, in save_base
    update_fields=update_fields, raw=raw, using=using)
  File "/usr/local/myproject/.env/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 170, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/usr/local/myproject/.env/local/lib/python2.7/site-packages/djorm_pgfulltext/models.py", line 47, in auto_update_search_field_handler
    instance.update_search_field()
  File "/usr/local/myproject/.env/local/lib/python2.7/site-packages/djorm_pgfulltext/models.py", line 111, in update_search_field
    self._fts_manager.update_search_field(pk=self.pk, using=using, config=config)
  File "/usr/local/myproject/.env/local/lib/python2.7/site-packages/djorm_pgfulltext/models.py", line 169, in update_search_field
    cursor.execute(sql, params)
  File "/usr/local/myproject/.env/local/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 366, in execute
    six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
  File "/usr/local/myproject/.env/local/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 362, in execute
    return Database.Cursor.execute(self, query, params)
DatabaseError: no such function: to_tsvector

How would I work around this, just so my unittests will run? I'm not testing the full text search. I just need it to not break everything in Sqlite. Is there someway to make the field revert to a simple CharField just for Sqlite?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant