Opened 16 years ago

Closed 16 years ago

Last modified 12 years ago

#10033 closed (fixed)

Oracle test suite failures after aggregation checkin

Reported by: Karen Tracey Owned by:
Component: Database layer (models, ORM) Version: 1.0
Severity: Keywords: oracle
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Trying to run the full test suite with the Oracle backend after updating to r9745 I'm seeing some errors. I was actually trying to run it with the transaction speedups from #8138, but backed off to bare trunk and individual tests when I started seeing unexpected errors. (The full suite takes about nine hours to run on this machine without #8138, so in testing aggregates on Oracle previously I limited the tests to the newly-added aggregation tests.) Anyway, the first test that fails is basic:

D:\u\kmt\django\trunk>svn info
Path: .
URL: http://code.djangoproject.com/svn/django/trunk
Repository Root: http://code.djangoproject.com/svn
Repository UUID: bcc190cf-cafb-0310-a4f2-bffc1f526a37
Revision: 9745
Node Kind: directory
Schedule: normal
Last Changed Author: russellm
Last Changed Rev: 9745
Last Changed Date: 2009-01-15 07:44:45 -0500 (Thu, 15 Jan 2009)


D:\u\kmt\django\trunk>svn diff

D:\u\kmt\django\trunk>echo %pythonpath%
d:\u\kmt\django\trunk

D:\u\kmt\django\trunk>cd tests

D:\u\kmt\django\trunk\tests>\bin\Python2.5.2\python.exe runtests.py --settings=oracle --verbosity=1 basic
Importing model basic
Creating test database...
Creating test database...
Creating test user...
Creating table django_content_type
Creating table auth_permission
Creating table auth_group
Creating table auth_user
Creating table auth_message
Creating table django_site
Creating table django_flatpage
Creating table django_redirect
Creating table django_session
Creating table django_comments
Creating table django_comment_flags
Creating table django_admin_log
Creating table basic_article
Installing index for auth.Permission model
Installing index for auth.Message model
Installing index for flatpages.FlatPage model
Installing index for redirects.Redirect model
Installing index for comments.Comment model
Installing index for comments.CommentFlag model
Installing index for admin.LogEntry model
F
======================================================================
FAIL: Doctest: modeltests.basic.models.__test__.API_TESTS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "d:\u\kmt\django\trunk\django\test\_doctest.py", line 2180, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for modeltests.basic.models.__test__.API_TESTS
  File "D:\u\kmt\django\trunk\tests\modeltests\basic\models.py", line unknown line number, in API_TESTS

----------------------------------------------------------------------
File "D:\u\kmt\django\trunk\tests\modeltests\basic\models.py", line ?, in modeltests.basic.models.__test__.API_TESTS
Failed example:
    Article.objects.dates('pub_date', 'year')
Expected:
    [datetime.datetime(2005, 1, 1, 0, 0)]
Got:
    [datetime.date(2005, 1, 1)]
----------------------------------------------------------------------
File "D:\u\kmt\django\trunk\tests\modeltests\basic\models.py", line ?, in modeltests.basic.models.__test__.API_TESTS
Failed example:
    Article.objects.dates('pub_date', 'month')
Expected:
    [datetime.datetime(2005, 7, 1, 0, 0)]
Got:
    [datetime.date(2005, 7, 1)]
----------------------------------------------------------------------
File "D:\u\kmt\django\trunk\tests\modeltests\basic\models.py", line ?, in modeltests.basic.models.__test__.API_TESTS
Failed example:
    Article.objects.dates('pub_date', 'day')
Expected:
    [datetime.datetime(2005, 7, 28, 0, 0), datetime.datetime(2005, 7, 29, 0, 0), datetime.datetime(2005, 7, 30, 0, 0), d
atetime.datetime(2005, 7, 31, 0, 0)]
Got:
    [datetime.date(2005, 7, 28), datetime.date(2005, 7, 29), datetime.date(2005, 7, 30), datetime.date(2005, 7, 31)]
----------------------------------------------------------------------
File "D:\u\kmt\django\trunk\tests\modeltests\basic\models.py", line ?, in modeltests.basic.models.__test__.API_TESTS
Failed example:
    Article.objects.dates('pub_date', 'day', order='ASC')
Expected:
    [datetime.datetime(2005, 7, 28, 0, 0), datetime.datetime(2005, 7, 29, 0, 0), datetime.datetime(2005, 7, 30, 0, 0), d
atetime.datetime(2005, 7, 31, 0, 0)]
Got:
    [datetime.date(2005, 7, 28), datetime.date(2005, 7, 29), datetime.date(2005, 7, 30), datetime.date(2005, 7, 31)]
----------------------------------------------------------------------
File "D:\u\kmt\django\trunk\tests\modeltests\basic\models.py", line ?, in modeltests.basic.models.__test__.API_TESTS
Failed example:
    Article.objects.dates('pub_date', 'day', order='DESC')
Expected:
    [datetime.datetime(2005, 7, 31, 0, 0), datetime.datetime(2005, 7, 30, 0, 0), datetime.datetime(2005, 7, 29, 0, 0), d
atetime.datetime(2005, 7, 28, 0, 0)]
Got:
    [datetime.date(2005, 7, 31), datetime.date(2005, 7, 30), datetime.date(2005, 7, 29), datetime.date(2005, 7, 28)]
----------------------------------------------------------------------
File "D:\u\kmt\django\trunk\tests\modeltests\basic\models.py", line ?, in modeltests.basic.models.__test__.API_TESTS
Failed example:
    for a in Article.objects.dates('pub_date', 'day', order='DESC').iterator():
        print repr(a)
Expected:
    datetime.datetime(2005, 7, 31, 0, 0)
    datetime.datetime(2005, 7, 30, 0, 0)
    datetime.datetime(2005, 7, 29, 0, 0)
    datetime.datetime(2005, 7, 28, 0, 0)
Got:
    datetime.date(2005, 7, 31)
    datetime.date(2005, 7, 30)
    datetime.date(2005, 7, 29)
    datetime.date(2005, 7, 28)
----------------------------------------------------------------------
File "D:\u\kmt\django\trunk\tests\modeltests\basic\models.py", line ?, in modeltests.basic.models.__test__.API_TESTS
Failed example:
    Article.objects.get(pk=a.id).headline
Expected:
    u'\u6797\u539f \u3081\u3050\u307f'
Got:
    u'\xbf\xbf \xbf\xbf\xbf'


----------------------------------------------------------------------
Ran 1 test in 1.652s

FAILED (failures=1)
Destroying test database...
Destroying test user...
Destroying test database tables...

D:\u\kmt\django\trunk\tests>

That last error with headline is something I see all the time and haven't tracked down. It's the datetime.dates coming back instead of datetime.datetimes that are new with the aggregation checkin.

I'll continue checking the individual tests where I'm seeing errors and update here if I see others that look like different issues.

Attachments (1)

10033.diff (886 bytes ) - added by Ramiro Morales 16 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by Ramiro Morales, 16 years ago

Component: UncategorizedORM aggregation
Keywords: oracle added
Owner: nobody removed

It's because of these heuristics:

http://code.djangoproject.com/browser/django/trunk/django/db/backends/oracle/query.py#L94

See the note a few lines above:

http://code.djangoproject.com/browser/django/trunk/django/db/backends/oracle/query.py#L73

during the aggregation merge the

if isinstance(field, DateTimeField):
    pass

test at http://code.djangoproject.com/browser/django/trunk/django/db/backends/oracle/query.py?rev=9741#L89 got lost and that's why it started to fail after that.

Adding a

if field and field.get_internal_type() == 'DateTimeField':
    return value

test before should solve the problem.

by Ramiro Morales, 16 years ago

Attachment: 10033.diff added

comment:2 by Ramiro Morales, 16 years ago

Has patch: set

comment:3 by Karen Tracey, 16 years ago

Cool, thanks for the fix. Only I think I'll make it pass and maintain the one return spot from the function, as it used to do.

comment:4 by Karen Tracey, 16 years ago

Resolution: fixed
Status: newclosed

(In [9747]) Fixed #10033: In the Oracle backend, restored code lost in the aggregation merge that ensured a datetime object is returned for fields known to be datetimes, even when the time part is all zero.

comment:5 by Karen Tracey, 16 years ago

Drat, I left the end off the commit message. MANY thanks Ramiro!

comment:6 by Anssi Kääriäinen, 12 years ago

Component: ORM aggregationDatabase layer (models, ORM)
Note: See TracTickets for help on using tickets.
Back to Top