WilliamRen / django-pyodbc

Automatically exported from code.google.com/p/django-pyodbc
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

IndexError: list index out of range exception at return list(qs)[0] in multiple tests when running Django test suite #38

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

Run the Django test suite (as of rev. 9788) against an SQL Server 2000
database using django-pyodbc trunk as of r134

What is the expected output? What do you see instead?

Expected: Most test pass
Actual result: The following tests fail because of this bug:

ERROR: testBasicEditGet
(regressiontests.generic_inline_admin.tests.GenericAdminViewTest)

ERROR: testBasicEditPost
(regressiontests.generic_inline_admin.tests.GenericAdminViewTest)

ERROR: Test signals emitted by the comment posting view
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"~/django/tests/regressiontests/comment_tests/tests/comment_view_tests.py",
line 152, in testCommentSignals

ERROR: testCreateValidComment
(regressiontests.comment_tests.tests.comment_view_tests.CommentViewTests)

ERROR: testPostAsAuthenticatedUser
(regressiontests.comment_tests.tests.comment_view_tests.CommentViewTests)

ERROR: testWillBePostedSignalModifyComment
(regressiontests.comment_tests.tests.comment_view_tests.CommentViewTests)

File "~/django/tests/modeltests/generic_relations/models.py", line ?, in
modeltests.generic_relations.models.__test__.API_TESTS
Failed example:
    TaggedItem.objects.filter(tag='fatty').delete()

File "~/django/tests/modeltests/model_inheritance/models.py", line ?, in
modeltests.model_inheritance.models.__test__.API_TESTS
Failed example:
    ItalianRestaurant.objects.all()[0].chef

File "~/django/tests/regressiontests/datatypes/models.py", line ?, in
regressiontests.datatypes.models.__test__.API_TESTS
Failed example:
    d2 = Donut.objects.all()[0]

File "~/django/tests/regressiontests/extra_regress/models.py", line ?, in
regressiontests.extra_regress.models.__test__.API_TESTS
Failed example:
    User.objects.extra(select={"alpha": "%s"},
select_params=(1,)).extra(select={"beta": "%s"}, select_params=(2,))[0].alpha

File "~/django/tests/regressiontests/extra_regress/models.py", line ?, in
regressiontests.extra_regress.models.__test__.API_TESTS
Failed example:
    User.objects.extra(select={"beta": "%s"},
select_params=(1,)).extra(select={"alpha": "%s"}, select_params=(2,))[0].alpha

File "~/django/tests/regressiontests/queries/models.py", line ?, in
regressiontests.queries.models.__test__.API_TESTS
Failed example:
    'note_id' in ExtraInfo.objects.values()[0]

File "~/django/tests/regressiontests/queries/models.py", line ?, in
regressiontests.queries.models.__test__.API_TESTS
Failed example:
    Item.objects.dates('created', 'day')[0]

File "~/django/tests/regressiontests/queries/models.py", line ?, in
regressiontests.queries.models.__test__.API_TESTS
Failed example:
    obj = m1.children.select_related("person__details")[0]

File "~/django/tests/regressiontests/model_inheritance_regress/models.py",
line ?, in regressiontests.model_inheritance_regress.models.__test__.API_TESTS
Failed example:
    ident = ItalianRestaurant.objects.all()[0].id

File "~/django/tests/regressiontests/model_regress/models.py", line ?, in
regressiontests.model_regress.models.__test__.API_TESTS
Failed example:
    p = Party.objects.filter(when__month=1)[0]

File "~/django/tests/regressiontests/model_regress/models.py", line ?, in
regressiontests.model_regress.models.__test__.API_TESTS
Failed example:
    l[0].month == 1

File "~/django/tests/regressiontests/null_fk/models.py", line ?, in
regressiontests.null_fk.models.__test__.API_TESTS
Failed example:

Comment.objects.select_related('post').filter(post__isnull=True)[0].post is
None

File "~/django/tests/regressiontests/select_related_regress/models.py",
line ?, in regressiontests.select_related_regress.models.__test__.API_TESTS
Failed example:
    e_related = Enrollment.objects.all().select_related()[0]

File "~/django/tests/regressiontests/select_related_regress/models.py",
line ?, in regressiontests.select_related_regress.models.__test__.API_TESTS
Failed example:
    Client.objects.select_related()[0].status

File "~/django/tests/regressiontests/select_related_regress/models.py",
line ?, in regressiontests.select_related_regress.models.__test__.API_TESTS
Failed example:
    Client.objects.select_related('state')[0].status

File "~/django/tests/regressiontests/select_related_regress/models.py",
line ?, in regressiontests.select_related_regress.models.__test__.API_TESTS
Failed example:
    Client.objects.select_related('state', 'status')[0].status

File "~/django/tests/regressiontests/select_related_regress/models.py",
line ?, in regressiontests.select_related_regress.models.__test__.API_TESTS
Failed example:
    Client.objects.select_related('state__country')[0].status

File "~/django/tests/regressiontests/select_related_regress/models.py",
line ?, in regressiontests.select_related_regress.models.__test__.API_TESTS
Failed example:
    Client.objects.select_related('state__country', 'status')[0].status

File "~/django/tests/regressiontests/select_related_regress/models.py",
line ?, in regressiontests.select_related_regress.models.__test__.API_TESTS
Failed example:
    Client.objects.select_related('status')[0].status

Example of a traceback:

Traceback (most recent call last):
  File "~/django/tests/regressiontests/generic_inline_admin/tests.py", line
44, in testBasicEditGet
    response =
self.client.get('/generic_inline_admin/admin/generic_inline_admin/episode/%d/'
% self.episode_pk)
  File "~/django/django/test/client.py", line 277, in get
    return self.request(**r)
  File "~/django/django/core/handlers/base.py", line 86, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "~/django/django/contrib/admin/sites.py", line 450, in root
    return self.model_page(request, *url.split('/', 2))
  File "~/django/django/views/decorators/cache.py", line 44, in
_wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "~/django/django/contrib/admin/sites.py", line 469, in model_page
    return admin_obj(request, rest_of_url)
  File "~/django/django/contrib/admin/options.py", line 801, in __call__
    return self.change_view(request, unquote(url))
  File "~/django/django/db/transaction.py", line 238, in _commit_on_success
    res = func(*args, **kw)
  File "~/django/django/contrib/admin/options.py", line 629, in change_view
    formset = FormSet(instance=obj)
  File "~/django/django/contrib/contenttypes/generic.py", line 303, in __init__
    prefix=self.rel_name
  File "~/django/django/forms/models.py", line 360, in __init__
    super(BaseModelFormSet, self).__init__(**defaults)
  File "~/django/django/forms/formsets.py", line 67, in __init__
    self._construct_forms()
  File "~/django/django/forms/formsets.py", line 76, in _construct_forms
    self.forms.append(self._construct_form(i))
  File "~/django/django/forms/models.py", line 364, in _construct_form
    kwargs['instance'] = self.get_queryset()[i]
  File "~/django/django/db/models/query.py", line 239, in __getitem__
    return list(qs)[0]
IndexError: list index out of range

Original issue reported on code.google.com by cra...@gmail.com on 24 Jan 2009 at 2:58

GoogleCodeExporter commented 8 years ago

Original comment by cra...@gmail.com on 24 Jan 2009 at 3:02

GoogleCodeExporter commented 8 years ago
Fixed in r135.

Original comment by cra...@gmail.com on 24 Jan 2009 at 5:05

GoogleCodeExporter commented 8 years ago
Reopening because this is a problem introduced by Django revisions 9785-9791. 
Trying
to figure it out.

Original comment by cra...@gmail.com on 24 Jan 2009 at 9:33

GoogleCodeExporter commented 8 years ago
fixed in r140.

Original comment by cra...@gmail.com on 24 Jan 2009 at 10:33