mirror of
https://github.com/Hopiu/django-cachalot.git
synced 2026-03-16 21:30:23 +00:00
Update utils.py (#225)
* Update utils.py verify get_meta isn't none before requesting db_table * Add passenv to tox.ini * Fix test_explain in sqlite --------- Co-authored-by: Andrew Chen Wang <60190294+Andrew-Chen-Wang@users.noreply.github.com>
This commit is contained in:
parent
52406ec111
commit
866b662273
3 changed files with 4 additions and 2 deletions
|
|
@ -907,7 +907,7 @@ class ReadTestCase(TestUtilsMixin, TransactionTestCase):
|
|||
def test_explain(self):
|
||||
explain_kwargs = {}
|
||||
if self.is_sqlite:
|
||||
expected = (r'\d+ 0 0 SCAN TABLE cachalot_test\n'
|
||||
expected = (r'\d+ 0 0 SCAN cachalot_test\n'
|
||||
r'\d+ 0 0 USE TEMP B-TREE FOR ORDER BY')
|
||||
elif self.is_mysql:
|
||||
if self.django_version < (3, 1):
|
||||
|
|
|
|||
|
|
@ -217,7 +217,8 @@ def _get_tables(db_alias, query, compiler=False):
|
|||
|
||||
# Gets all tables already found by the ORM.
|
||||
tables = set(query.table_map)
|
||||
tables.add(query.get_meta().db_table)
|
||||
if query.get_meta():
|
||||
tables.add(query.get_meta().db_table)
|
||||
|
||||
# Gets tables in subquery annotations.
|
||||
for annotation in query.annotations.values():
|
||||
|
|
|
|||
1
tox.ini
1
tox.ini
|
|
@ -7,6 +7,7 @@ envlist =
|
|||
py{38,39,310}-djangomain-{sqlite3,postgresql,mysql}-{redis,memcached,pylibmc,locmem,filebased},
|
||||
|
||||
[testenv]
|
||||
passenv = *
|
||||
basepython =
|
||||
py37: python3.7
|
||||
py38: python3.8
|
||||
|
|
|
|||
Loading…
Reference in a new issue