Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#9592 closed (fixed)

generic_inline_admin test fails when run with all tests

Reported by: Karen Tracey Owned by: Brian Rosner
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: no UI/UX: no

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

Change History (7)

comment:1 by Brian Rosner, 16 years ago

Owner: changed from nobody to Brian Rosner
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:2 by Brian Rosner, 16 years ago

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 by Karen Tracey, 16 years ago

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 by Karen Tracey, 16 years ago

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 by Karen Tracey, 16 years ago

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 by Karen Tracey, 16 years ago

Resolution: fixed
Status: assignedclosed

(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 by Karen Tracey, 16 years ago

(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.

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