Opened 10 years ago

Closed 10 years ago

Last modified 10 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

Description

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 "manage.py", line 16, in <module>
    execute_from_command_line(sys.argv)
  File "tariffs/.direnv/env/src/django/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "tariffs/.direnv/env/src/django/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "tariffs/.direnv/env/src/django/django/core/management/commands/test.py", line 50, in run_from_argv
    super(Command, self).run_from_argv(argv)
  File "tariffs/.direnv/env/src/django/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "tariffs/.direnv/env/src/django/django/core/management/commands/test.py", line 71, in execute
    super(Command, self).execute(*args, **options)
  File "tariffs/.direnv/env/src/django/django/core/management/base.py", line 337, in execute
    output = self.handle(*args, **options)
  File "tariffs/.direnv/env/src/django/django/core/management/commands/test.py", line 88, in handle
    failures = test_runner.run_tests(test_labels)
  File "tariffs/.direnv/env/src/django/django/test/runner.py", line 147, in run_tests
    old_config = self.setup_databases()
  File "tariffs/.direnv/env/src/django/django/test/runner.py", line 109, in setup_databases
    return setup_databases(self.verbosity, self.interactive, **kwargs)
  File "tariffs/.direnv/env/src/django/django/test/runner.py", line 299, in setup_databases
    serialize=connection.settings_dict.get("TEST_SERIALIZE", True),
  File "tariffs/.direnv/env/src/django/django/db/backends/creation.py", 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/creation.py", 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/__init__.py", line 128, in serialize
    s.serialize(queryset, **options)
  File "tariffs/.direnv/env/src/django/django/core/serializers/base.py", line 52, in serialize
    for obj in queryset:
  File "tariffs/.direnv/env/src/django/django/db/backends/creation.py", line 414, in get_objects
    for obj in queryset.iterator():
  File "tariffs/.direnv/env/src/django/django/db/models/query.py", line 265, in iterator
    for row in compiler.results_iter():
  File "tariffs/.direnv/env/src/django/django/db/models/sql/compiler.py", line 699, in results_iter
    for rows in self.execute_sql(MULTI):
  File "tariffs/.direnv/env/src/django/django/db/models/sql/compiler.py", line 785, in execute_sql
    cursor.execute(sql, params)
  File "tariffs/.direnv/env/src/django/django/db/backends/utils.py", line 65, in execute
    return self.cursor.execute(sql, params)
  File "tariffs/.direnv/env/src/django/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "tariffs/.direnv/env/src/django/django/db/backends/utils.py", 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 by Tim Graham, 10 years ago

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

comment:2 by Andrew Godwin <andrew@…>, 10 years ago

Resolution: fixed
Status: newclosed

In 2984b30ce84eccedfcc5b5241d12720913d0b80a:

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

comment:3 by Andrew Godwin <andrew@…>, 10 years ago

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