Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing suite fails to run #2537

Closed
jkmarx opened this issue Jan 25, 2018 · 6 comments
Closed

Testing suite fails to run #2537

jkmarx opened this issue Jan 25, 2018 · 6 comments

Comments

@jkmarx
Copy link
Member

jkmarx commented Jan 25, 2018

Issue is seen on a separate branch, but thought it was worth writing an issue.
Django 1.8 upgrade branch

Steps

  • On Django 1.8 upgrade branch, run the test suite

Observed behavior

Locally

  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 30, in run_from_argv
    super(Command, self).run_from_argv(argv)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 74, in execute
    super(Command, self).execute(*args, **options)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/core/management/commands/test.py", line 90, in handle
    failures = test_runner.run_tests(test_labels)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/test/runner.py", line 210, in run_tests
    old_config = self.setup_databases()
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/test/runner.py", line 166, in setup_databases
    **kwargs
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/test/runner.py", line 370, in setup_databases
    serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True),
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/db/backends/base/creation.py", line 368, in create_test_db
    test_flush=not keepdb,
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 120, in call_command
    return command.execute(*args, **defaults)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 179, in handle
    created_models = self.sync_apps(connection, executor.loader.unmigrated_apps)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 318, in sync_apps
    cursor.execute(statement)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/db/utils.py", line 98, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 62, in execute
    return self.cursor.execute(sql)
django.db.utils.ProgrammingError: relation "auth_user" does not exist

Travis:

  Synchronize unmigrated apps: djangular, visualization_manager, chunked_upload, staticfiles, admindocs, django_markwhat, workflow_manager, messages, rest_framework_swagger, humanize, flatblocks, selenium_testing, registration, rest_framework, haystack, django_docker_engine
  Apply all migrations: core, annotation_server, sessions, admin, data_set_manager, djcelery, sites, auth, tastypie, galaxy_connector, contenttypes, file_server, tool_manager, file_store, guardian, httpproxy, analysis_manager
Synchronizing apps without migrations:
  Creating tables...
    Creating table registration_registrationprofile
    Creating table flatblocks_flatblock
    Creating table chunked_upload_chunkedupload
    Running deferred SQL...
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 179, in handle
    created_models = self.sync_apps(connection, executor.loader.unmigrated_apps)
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 318, in sync_apps
    cursor.execute(statement)
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/django/db/utils.py", line 98, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/travis/virtualenv/python2.7.14/lib/python2.7/site-packages/django/db/backends/utils.py", line 62, in execute
    return self.cursor.execute(sql)
django.db.utils.ProgrammingError: relation "auth_user" does not exist```

### Expected behavior
* Suite to run
@jkmarx jkmarx self-assigned this Jan 25, 2018
@jkmarx jkmarx added this to the Release 1.6.3 milestone Jan 25, 2018
@jkmarx
Copy link
Member Author

jkmarx commented Jan 25, 2018

@scottx611x registration_redux add info

@scottx611x
Copy link
Member

scottx611x commented Jan 25, 2018

@jkmarx So a quick messing around yesterday led me to update to django-registration-redux==1.2 due to a mention of addition of initial migrations being added in the CHANGELOG.

This upgrade only led to a different error when I tried to migrate:

(refinery-platform)vagrant@refinery:/vagrant/refinery$ ./manage.py migrate
System check identified some issues:

WARNINGS:
file_server._FileServerItem.data_file: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
	HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.
tool_manager.FileRelationship.file_relationship: (fields.W340) null has no effect on ManyToManyField.
Operations to perform:
  Synchronize unmigrated apps: djangular, visualization_manager, chunked_upload, staticfiles, admindocs, django_markwhat, messages, rest_framework_swagger, humanize, flatblocks, selenium_testing, workflow_manager, django_extensions, rest_framework, haystack, django_docker_engine
  Apply all migrations: core, annotation_server, sessions, admin, data_set_manager, registration, djcelery, sites, auth, tastypie, galaxy_connector, contenttypes, file_server, tool_manager, file_store, guardian, httpproxy, analysis_manager
Synchronizing apps without migrations:
  Creating tables...
  Running deferred SQL...
  Installing custom SQL...
Running migrations:
  Rendering model states...Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
    utility.execute()
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/core/management/base.py", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute
    output = self.handle(*args, **options)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 222, in handle
    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 100, in migrate
    state.apps  # Render all real_apps -- performance critical
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/utils/functional.py", line 59, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/db/migrations/state.py", line 166, in apps
    return StateApps(self.real_apps, self.models)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/db/migrations/state.py", line 232, in __init__
    self.render_multiple(list(models.values()) + self.real_models)
  File "/home/vagrant/.virtualenvs/refinery-platform/local/lib/python2.7/site-packages/django/db/migrations/state.py", line 270, in render_multiple
    "for more" % (new_unrendered_models, get_docs_version())
django.db.migrations.state.InvalidBasesError: Cannot resolve bases for [<ModelState: 'core.CustomRegistrationProfile'>]
This can happen if you are inheriting models from an app with migrations (e.g. contrib.auth)
 in an app with no migrations; see https://docs.djangoproject.com/en/1.8/topics/migrations/#dependencies for more

Not sure how much it helps but could shed some more light on the issue!

@jkmarx
Copy link
Member Author

jkmarx commented Jan 26, 2018

https://docs.djangoproject.com/en/1.8/topics/migrations/#dependencies

Narrowed the source to three dependencies.
Be aware, however, that unmigrated apps cannot depend on migrated apps, by the very nature of not having migrations. ........ As time goes on, more and more third-party apps will get migrations, but in the meantime you can either give them migrations yourself (using MIGRATION_MODULES to store those modules outside of the app’s own module if you wish), or keep the app with your user model unmigrated.

@jkmarx
Copy link
Member Author

jkmarx commented Jan 29, 2018

@jkmarx
Copy link
Member Author

jkmarx commented Jan 31, 2018

KDD-OpenSource/fexum#64

@jkmarx jkmarx closed this as completed Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants