Opened 10 years ago

Last modified 9 years ago

#24779 closed Bug

django-1.8.1 fails test with pypy - FAIL: test_serialize_datetime_safe (migrations.test_writer.WriterTests) — at Version 1

Reported by: Justin Owned by: nobody
Component: Migrations Version: 1.8
Severity: Normal 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 (last modified by Tim Graham)

This happens with pypy-2.5.1 and python-dateutil-2.4.2

test_written_spooled_temp (files.tests.SpooledTempTests) ... ok

======================================================================
ERROR: test_serialize_datetime (migrations.test_writer.WriterTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/django-1.8.1/work/Django-1.8.1/tests/migrations/test_writer.py", line 240, in test_serialize_datetime
    self.assertSerializedEqual(datetime.datetime.utcnow)
  File "/var/tmp/portage/dev-python/django-1.8.1/work/Django-1.8.1/tests/migrations/test_writer.py", line 176, in assertSerializedEqual
    self.assertEqual(self.serialize_round_trip(value), value)
  File "/var/tmp/portage/dev-python/django-1.8.1/work/Django-1.8.1/tests/migrations/test_writer.py", line 172, in serialize_round_trip
    string, imports = MigrationWriter.serialize(value)
  File "/var/tmp/portage/dev-python/django-1.8.1/work/Django-1.8.1/django/db/migrations/writer.py", line 465, in serialize
    "topics/migrations/#migration-serializing" % (value, get_docs_version())
ValueError: Cannot serialize: <bound method type.utcnow of <class 'datetime.datetime'>>
There are some values Django cannot serialize into migration files.
For more, see https://docs.djangoproject.com/en/1.8/topics/migrations/#migration-serializing

======================================================================
ERROR: test_simple_migration (migrations.test_writer.WriterTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/django-1.8.1/work/Django-1.8.1/tests/migrations/test_writer.py", line 425, in test_simple_migration
    output = writer.as_string()
  File "/var/tmp/portage/dev-python/django-1.8.1/work/Django-1.8.1/django/db/migrations/writer.py", line 166, in as_string
    operation_string, operation_imports = OperationWriter(operation).serialize()
  File "/var/tmp/portage/dev-python/django-1.8.1/work/Django-1.8.1/django/db/migrations/writer.py", line 124, in serialize
    _write(arg_name, arg_value)
  File "/var/tmp/portage/dev-python/django-1.8.1/work/Django-1.8.1/django/db/migrations/writer.py", line 75, in _write
    arg_string, arg_imports = MigrationWriter.serialize(item)
  File "/var/tmp/portage/dev-python/django-1.8.1/work/Django-1.8.1/django/db/migrations/writer.py", line 303, in serialize
    item_string, item_imports = cls.serialize(item)
  File "/var/tmp/portage/dev-python/django-1.8.1/work/Django-1.8.1/django/db/migrations/writer.py", line 377, in serialize
    return cls.serialize_deconstructed(path, args, kwargs)
  File "/var/tmp/portage/dev-python/django-1.8.1/work/Django-1.8.1/django/db/migrations/writer.py", line 268, in serialize_deconstructed
    arg_string, arg_imports = cls.serialize(arg)
  File "/var/tmp/portage/dev-python/django-1.8.1/work/Django-1.8.1/django/db/migrations/writer.py", line 465, in serialize
    "topics/migrations/#migration-serializing" % (value, get_docs_version())
ValueError: Cannot serialize: <bound method type.utcnow of <class 'datetime.datetime'>>
There are some values Django cannot serialize into migration files.
For more, see https://docs.djangoproject.com/en/1.8/topics/migrations/#migration-serializing

======================================================================
FAIL: test_serialize_datetime_safe (migrations.test_writer.WriterTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/django-1.8.1/work/Django-1.8.1/tests/migrations/test_writer.py", line 263, in test_serialize_datetime_safe
    ("datetime.date(2014, 3, 31)", {'import datetime'})
  File "/var/tmp/portage/dev-python/django-1.8.1/work/Django-1.8.1/tests/migrations/test_writer.py", line 179, in assertSerializedResultEqual
    self.assertEqual(MigrationWriter.serialize(value), target)
AssertionError: Tuples differ: (u'datetime.datetime.date(2014... != (u'datetime.date(2014, 3, 31)'...

First differing element 0:
datetime.datetime.date(2014, 3, 31)
datetime.date(2014, 3, 31)

- (u'datetime.datetime.date(2014, 3, 31)', set([u'import datetime']))
?    ---------

+ (u'datetime.date(2014, 3, 31)', set([u'import datetime']))

----------------------------------------------------------------------

Change History (1)

comment:1 by Tim Graham, 10 years ago

Component: Testing frameworkMigrations
Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top