Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#23039 closed Bug (fixed)

Django 1.7.x test serialization on unmanaged models

Reported by: Gert Van Gool Owned by: nobody
Component: Testing framework Version: 1.7-rc-1
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I believe that in 08218252d8be4633ac0e94863da527d824648d63 a change was introduced that make the test cases fail for apps that have migrations and unmanaged models in the same app.

Traceback (most recent call last):
  File "", line 16, in <module>
  File "tariffs/.direnv/env/src/django/django/core/management/", line 385, in execute_from_command_line
  File "tariffs/.direnv/env/src/django/django/core/management/", line 377, in execute
  File "tariffs/.direnv/env/src/django/django/core/management/commands/", line 50, in run_from_argv
    super(Command, self).run_from_argv(argv)
  File "tariffs/.direnv/env/src/django/django/core/management/", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "tariffs/.direnv/env/src/django/django/core/management/commands/", line 71, in execute
    super(Command, self).execute(*args, **options)
  File "tariffs/.direnv/env/src/django/django/core/management/", line 337, in execute
    output = self.handle(*args, **options)
  File "tariffs/.direnv/env/src/django/django/core/management/commands/", line 88, in handle
    failures = test_runner.run_tests(test_labels)
  File "tariffs/.direnv/env/src/django/django/test/", line 147, in run_tests
    old_config = self.setup_databases()
  File "tariffs/.direnv/env/src/django/django/test/", line 109, in setup_databases
    return setup_databases(self.verbosity, self.interactive, **kwargs)
  File "tariffs/.direnv/env/src/django/django/test/", line 299, in setup_databases
    serialize=connection.settings_dict.get("TEST_SERIALIZE", True),
  File "tariffs/.direnv/env/src/django/django/db/backends/", line 382, in create_test_db
    self.connection._test_serialized_contents = self.serialize_db_to_string()
  File "tariffs/.direnv/env/src/django/django/db/backends/", line 418, in serialize_db_to_string
    serializers.serialize("json", get_objects(), indent=None, stream=out)
  File "tariffs/.direnv/env/src/django/django/core/serializers/", line 128, in serialize
    s.serialize(queryset, **options)
  File "tariffs/.direnv/env/src/django/django/core/serializers/", line 52, in serialize
    for obj in queryset:
  File "tariffs/.direnv/env/src/django/django/db/backends/", line 414, in get_objects
    for obj in queryset.iterator():
  File "tariffs/.direnv/env/src/django/django/db/models/", line 265, in iterator
    for row in compiler.results_iter():
  File "tariffs/.direnv/env/src/django/django/db/models/sql/", line 699, in results_iter
    for rows in self.execute_sql(MULTI):
  File "tariffs/.direnv/env/src/django/django/db/models/sql/", line 785, in execute_sql
    cursor.execute(sql, params)
  File "tariffs/.direnv/env/src/django/django/db/backends/", line 65, in execute
    return self.cursor.execute(sql, params)
  File "tariffs/.direnv/env/src/django/django/db/", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "tariffs/.direnv/env/src/django/django/db/backends/", line 65, in execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "countryprefix" does not exist
LINE 1: ...x"."routingcode", "countryprefix"."provider" FROM "countrypr...

Change History (3)

comment:1 Changed 5 years ago by Tim Graham

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

comment:2 Changed 5 years ago by Andrew Godwin <andrew@…>

Resolution: fixed
Status: newclosed

In 2984b30ce84eccedfcc5b5241d12720913d0b80a:

Fixed #23039: Don't try to serialize unmanaged models in tests

comment:3 Changed 5 years ago by Andrew Godwin <andrew@…>

In ff8d715a0a62eb4d70e6c2bf38fa1113ed2899e5:

[1.7.x] Fixed #23039: Don't try to serialize unmanaged models in tests

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