sqlite ファイルを使用しているときにパスするテスト スイートがありますが、メモリにはありません。以前にこの問題に遭遇した人はいますか?
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'db.sqlite3',
}
}
...テストに合格しました。
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
...テストは失敗します
DatabaseError: no such table: foo_bar
テストを実行する前にすべてのテーブルを強制的に作成する方法はありますか? 以下の完全なスタックトレース
======================================================================
ERROR: Failure: DatabaseError (no such table: core_industry)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/igniteflow/Projects/foo/src/lib/nose/loader.py", line 413, in loadTestsFromName
addr.filename, addr.module)
File "/home/igniteflow/Projects/foo/src/lib/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/home/igniteflow/Projects/foo/src/lib/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/igniteflow/Projects/foo/src/app/cms/tests/__init__.py", line 5, in <module>
from bulk_export import *
File "/home/igniteflow/Projects/foo/src/app/cms/tests/bulk_export.py", line 8, in <module>
from cms.input_parsers import SiteProspectInputParser
File "/home/igniteflow/Projects/foo/src/app/cms/input_parsers.py", line 10, in <module>
from cms.bulkimport import SiteProspectBulkUploadForm, SiteUserBulkUploadForm
File "/home/igniteflow/Projects/foo/src/app/cms/bulkimport.py", line 683, in <module>
class BaseContentBulkUploadForm(BaseBulkUploadForm):
File "/home/igniteflow/Projects/foo/src/app/cms/bulkimport.py", line 709, in BaseContentBulkUploadForm
'industries': m2m_column_help_text(Industry),
File "/home/igniteflow/Projects/foo/src/app/cms/bulkimport.py", line 674, in m2m_column_help_text
[i[0] for i in ModelClass.objects.all().values_list(field)[:3]]
File "/home/igniteflow/Projects/foo/src/lib/django/db/models/query.py", line 123, in _result_iter
self._fill_cache()
File "/home/igniteflow/Projects/foo/src/lib/django/db/models/query.py", line 927, in _fill_cache
self._result_cache.append(next(self._iter))
File "/home/igniteflow/Projects/foo/src/lib/django/db/models/query.py", line 1129, in iterator
for row in self.query.get_compiler(self.db).results_iter():
File "/home/igniteflow/Projects/foo/src/lib/django/db/models/sql/compiler.py", line 775, in results_iter
for rows in self.execute_sql(MULTI):
File "/home/igniteflow/Projects/foo/src/lib/django/db/models/sql/compiler.py", line 840, in execute_sql
cursor.execute(sql, params)
File "/home/igniteflow/Projects/foo/src/lib/django/db/backends/util.py", line 41, in execute
return self.cursor.execute(sql, params)
File "/home/igniteflow/Projects/foo/src/lib/django/db/backends/sqlite3/base.py", line 366, in execute
six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
File "/home/igniteflow/Projects/foo/src/lib/django/db/backends/sqlite3/base.py", line 362, in execute
return Database.Cursor.execute(self, query, params)
DatabaseError: no such table: core_industry