Code

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#9592 closed (fixed)

generic_inline_admin test fails when run with all tests

Reported by: kmtracey Owned by: brosner
Component: Uncategorized Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Alone, the new generic_inline_admin test (r9412/r9413) runs fine. However when the whole test suite is run it's failing. From the buildbot logs:

======================================================================
ERROR: testBasicEditPost (regressiontests.generic_inline_admin.tests.GenericAdminViewTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/buildbots/slave/parts/ubuntu-feisty-python2.5-sqlite/django-trunk_ubuntu-feisty-python2.5-sqlite/build/tests/regressiontests/generic_inline_admin/tests.py", line 65, in testBasicEditPost
    response = self.client.post('/generic_inline_admin/admin/generic_inline_admin/episode/1/', post_data)
  File "/home/buildbots/slave/parts/ubuntu-feisty-python2.5-sqlite/django-trunk_ubuntu-feisty-python2.5-sqlite/build/django/test/client.py", line 296, in post
    return self.request(**r)
  File "/home/buildbots/slave/parts/ubuntu-feisty-python2.5-sqlite/django-trunk_ubuntu-feisty-python2.5-sqlite/build/django/core/handlers/base.py", line 86, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/home/buildbots/slave/parts/ubuntu-feisty-python2.5-sqlite/django-trunk_ubuntu-feisty-python2.5-sqlite/build/django/contrib/admin/sites.py", line 157, in root
    return self.model_page(request, *url.split('/', 2))
  File "/home/buildbots/slave/parts/ubuntu-feisty-python2.5-sqlite/django-trunk_ubuntu-feisty-python2.5-sqlite/build/django/views/decorators/cache.py", line 44, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/home/buildbots/slave/parts/ubuntu-feisty-python2.5-sqlite/django-trunk_ubuntu-feisty-python2.5-sqlite/build/django/contrib/admin/sites.py", line 176, in model_page
    return admin_obj(request, rest_of_url)
  File "/home/buildbots/slave/parts/ubuntu-feisty-python2.5-sqlite/django-trunk_ubuntu-feisty-python2.5-sqlite/build/django/contrib/admin/options.py", line 197, in __call__
    return self.change_view(request, unquote(url))
  File "/home/buildbots/slave/parts/ubuntu-feisty-python2.5-sqlite/django-trunk_ubuntu-feisty-python2.5-sqlite/build/django/db/transaction.py", line 238, in _commit_on_success
    res = func(*args, **kw)
  File "/home/buildbots/slave/parts/ubuntu-feisty-python2.5-sqlite/django-trunk_ubuntu-feisty-python2.5-sqlite/build/django/contrib/admin/options.py", line 576, in change_view
    instance=new_object)
  File "/home/buildbots/slave/parts/ubuntu-feisty-python2.5-sqlite/django-trunk_ubuntu-feisty-python2.5-sqlite/build/django/contrib/contenttypes/generic.py", line 303, in __init__
    prefix=self.rel_name
  File "/home/buildbots/slave/parts/ubuntu-feisty-python2.5-sqlite/django-trunk_ubuntu-feisty-python2.5-sqlite/build/django/forms/models.py", line 352, in __init__
    super(BaseModelFormSet, self).__init__(**defaults)
  File "/home/buildbots/slave/parts/ubuntu-feisty-python2.5-sqlite/django-trunk_ubuntu-feisty-python2.5-sqlite/build/django/forms/formsets.py", line 67, in __init__
    self._construct_forms()
  File "/home/buildbots/slave/parts/ubuntu-feisty-python2.5-sqlite/django-trunk_ubuntu-feisty-python2.5-sqlite/build/django/forms/formsets.py", line 76, in _construct_forms
    self.forms.append(self._construct_form(i))
  File "/home/buildbots/slave/parts/ubuntu-feisty-python2.5-sqlite/django-trunk_ubuntu-feisty-python2.5-sqlite/build/django/forms/models.py", line 356, in _construct_form
    kwargs['instance'] = self.get_queryset()[i]
  File "/home/buildbots/slave/parts/ubuntu-feisty-python2.5-sqlite/django-trunk_ubuntu-feisty-python2.5-sqlite/build/django/db/models/query.py", line 238, in __getitem__
    return list(qs)[0]
IndexError: list index out of range

----------------------------------------------------------------------
Ran 546 tests in 645.917s

FAILED (errors=1)
Destroying test database...
program finished with exit code 1

Attachments (0)

Change History (7)

comment:1 Changed 5 years ago by brosner

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to brosner
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 5 years ago by brosner

For the record it appears you can isolate things down to running admin_views and generic_inline_admin tests together that cause this breakage.

comment:3 Changed 5 years ago by kmtracey

Brian -- I'd like to commit the fix I just attached to #9076, but don't want to interfere with this one (which I ran into when running the test suite for the #9076 fix), so I'm holding off. If you think the #9076 fix is OK regardless, let me know and I'll check it in. I would like to get it in for 1.0.1 since it can cause mysterious errors for people following the tutorial, plus results in extra individual queries for each inline object on a page. The test does run fine with the fix when run individually.

comment:4 Changed 5 years ago by kmtracey

I think the problem is the fixtures for the new test assume a content type id of 13 for the episode content type. The admin_views test (for one) loads other fixtures which change the content type id for episode.

comment:5 Changed 5 years ago by kmtracey

I think the answer is to create the content in the test setup instead of loading it as a fixture. That works for running admin_views and this new one together...trying for the whole test suite now...

comment:6 Changed 5 years ago by kmtracey

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [9438]) Fixed #9592 -- Create data for the generic_inline_admin test during setup instead of via a fixutre since it uses a content type id which will vary depending on what other tests have been run.

comment:7 Changed 5 years ago by kmtracey

(In [9439]) [1.0.X] Fixed #9592 -- Create data for the generic_inline_admin test during setup instead of via a fixutre since it uses a content type id which will vary depending on what other tests have been run.

r9438 from trunk.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.