#12640 closed (fixed)
Test execution order isn't exactly equal to the used before since r12255
Reported by: | Ramiro Morales | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This cause a failure in the model_package
modeltest (it has a model defined in tests.py
file, see #12245).
File "/home/buildbot/slave-py2.6/parts/ubuntu9.10-py2.6-sqlite/django-trunk_ubuntu9.10-py2.6-sqlite/build/tests/modeltests/model_package/tests.py", line ?, in modeltests.model_package.tests.__test__.API_TESTS Failed example: ad.save() Exception raised: Traceback (most recent call last): File "/home/buildbot/slave-py2.6/parts/ubuntu9.10-py2.6-sqlite/django-trunk_ubuntu9.10-py2.6-sqlite/build/django/test/_doctest.py", line 1267, in __run compileflags, 1) in test.globs File "<doctest modeltests.model_package.tests.__test__.API_TESTS[18]>", line 1, in <module> ad.save() File "/home/buildbot/slave-py2.6/parts/ubuntu9.10-py2.6-sqlite/django-trunk_ubuntu9.10-py2.6-sqlite/build/django/db/models/base.py", line 430, in save self.save_base(using=using, force_insert=force_insert, force_update=force_update) File "/home/buildbot/slave-py2.6/parts/ubuntu9.10-py2.6-sqlite/django-trunk_ubuntu9.10-py2.6-sqlite/build/django/db/models/base.py", line 519, in save_base result = manager._insert(values, return_id=update_pk, using=using) File "/home/buildbot/slave-py2.6/parts/ubuntu9.10-py2.6-sqlite/django-trunk_ubuntu9.10-py2.6-sqlite/build/django/db/models/manager.py", line 197, in _insert return insert_query(self.model, values, **kwargs) File "/home/buildbot/slave-py2.6/parts/ubuntu9.10-py2.6-sqlite/django-trunk_ubuntu9.10-py2.6-sqlite/build/django/db/models/query.py", line 1345, in insert_query return query.get_compiler(using=using).execute_sql(return_id) File "/home/buildbot/slave-py2.6/parts/ubuntu9.10-py2.6-sqlite/django-trunk_ubuntu9.10-py2.6-sqlite/build/django/db/models/sql/compiler.py", line 730, in execute_sql cursor = super(SQLInsertCompiler, self).execute_sql(None) File "/home/buildbot/slave-py2.6/parts/ubuntu9.10-py2.6-sqlite/django-trunk_ubuntu9.10-py2.6-sqlite/build/django/db/models/sql/compiler.py", line 674, in execute_sql cursor.execute(sql, params) File "/home/buildbot/slave-py2.6/parts/ubuntu9.10-py2.6-sqlite/django-trunk_ubuntu9.10-py2.6-sqlite/build/django/db/backends/sqlite3/base.py", line 189, in execute return Database.Cursor.execute(self, query, params) OperationalError: no such table: model_package_advertisment
Problem is the test database creation step and the create test suite steps have their order exchanged when compared to how they were run before.
I guess this is because the suite building step populates the app cache and that allows models defined in tests.py
to be picked and their DB table created.
Attachments (1)
Change History (5)
by , 15 years ago
Attachment: | 12640.diff added |
---|
comment:1 by , 15 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:2 by , 15 years ago
Triage Stage: | Design decision needed → Accepted |
---|
A closer read of Ramiro's patch points out that #12245 has already decided the 'test models' issue.
comment:3 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Hrm. I'm not sure of the right response is here.
You are correct that the order has changed - but it now matches what the documentation has said from the beginning.
Also, I'm not entirely convinced that the model_packages test isn't in error as written - allowing a model definition in tests.py isn't documented behavior as far as I am aware.
On a related ticket - #7835 exists as a ticket for adding 'test models'.