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

Test against sqlite3 #25

Open
sloria opened this issue Sep 21, 2018 · 0 comments
Open

Test against sqlite3 #25

sloria opened this issue Sep 21, 2018 · 0 comments

Comments

@sloria
Copy link
Collaborator

sloria commented Sep 21, 2018

We are evaluating using in-memory sqlite3 to speed up our OSF tests. Let's get sqlite3 working in django-include.

I changed the test settings to:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': ':memory:'
    }
}

Miraculously, only 1 test fails:

tox -e py36-django111
_____________________________ TestGenericForeignKey.test_reverse_gfk __________________________________________________________________________________
.tox/py36-django111/lib/python3.6/site-packages/django/db/backends/utils.py:64: in execute
    return self.cursor.execute(sql, params)
.tox/py36-django111/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py:328: in execute
    return Database.Cursor.execute(self, query, params)
E   sqlite3.OperationalError: near "ORDER": syntax error

The above exception was the direct cause of the following exception:
tests/test_include.py:325: in test_reverse_gfk
    ket = models.Cat.objects.include('aliases').get(pk=cat.id)
.tox/py36-django111/lib/python3.6/site-packages/django/db/models/query.py:374: in get
    num = len(clone)
.tox/py36-django111/lib/python3.6/site-packages/django/db/models/query.py:232: in __len__
    self._fetch_all()
.tox/py36-django111/lib/python3.6/site-packages/django/db/models/query.py:1118: in _fetch_all
    self._result_cache = list(self._iterable_class(self))
include/query.py:76: in __iter__
    for instance in super(IncludeModelIterable, self).__iter__():
.tox/py36-django111/lib/python3.6/site-packages/django/db/models/query.py:53: in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
.tox/py36-django111/lib/python3.6/site-packages/django/db/models/sql/compiler.py:899: in execute_sql
    raise original_exception
.tox/py36-django111/lib/python3.6/site-packages/django/db/models/sql/compiler.py:889: in execute_sql
    cursor.execute(sql, params)
.tox/py36-django111/lib/python3.6/site-packages/django/db/backends/utils.py:79: in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
.tox/py36-django111/lib/python3.6/site-packages/django/db/backends/utils.py:64: in execute
    return self.cursor.execute(sql, params)
.tox/py36-django111/lib/python3.6/site-packages/django/db/utils.py:94: in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
.tox/py36-django111/lib/python3.6/site-packages/django/utils/six.py:685: in reraise
    raise value.with_traceback(tb)
.tox/py36-django111/lib/python3.6/site-packages/django/db/backends/utils.py:64: in execute
    return self.cursor.execute(sql, params)
.tox/py36-django111/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py:328: in execute
    return Database.Cursor.execute(self, query, params)
E   django.db.utils.OperationalError: near "ORDER": syntax error

I don't have time to look into it further right now, so just opening this issue as a TODO.

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