Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#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: master
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


This cause a failure in the model_package modeltest (it has a model defined in 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/", line ?, in modeltests.model_package.tests.__test__.API_TESTS
Failed example:
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/", line 1267, in __run
        compileflags, 1) in test.globs
      File "<doctest modeltests.model_package.tests.__test__.API_TESTS[18]>", line 1, in <module>
      File "/home/buildbot/slave-py2.6/parts/ubuntu9.10-py2.6-sqlite/django-trunk_ubuntu9.10-py2.6-sqlite/build/django/db/models/", 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/", 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/", 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/", 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/", 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/", 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/", 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 to be picked and their DB table created.

Attachments (1)

12640.diff (2.2 KB) - added by Ramiro Morales 9 years ago.

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by Ramiro Morales

Attachment: 12640.diff added

comment:1 Changed 9 years ago by Russell Keith-Magee

Triage Stage: UnreviewedDesign decision needed

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 isn't documented behavior as far as I am aware.

On a related ticket - #7835 exists as a ticket for adding 'test models'.

comment:2 Changed 9 years ago by Russell Keith-Magee

Triage Stage: Design decision neededAccepted

A closer read of Ramiro's patch points out that #12245 has already decided the 'test models' issue.

comment:3 Changed 9 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [12261]) Fixed #12640 -- Corrected a regression in test suite construction order introduced by #12255. Also updated the docs to reflect what the test code has always done. Thanks to Ramiro Morales for the report and patch.

comment:4 Changed 7 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top