Skip to content

Loading…

Tests break when nashvegas is enabled. #56

Closed
justinabrahms opened this Issue · 2 comments

2 participants

@justinabrahms

Version: nashvegas==0.8b1

When I have nashvegas in my installed apps, my tables don't seem to get created. I have one .py migration which is a data migration.

./manage.py test streamer
Creating test database for alias 'default'...
Got an error creating the test database: (1007, "Can't create database 'test_gitstreams'; database exists")
Type 'yes' if you would like to try deleting the test database 'test_gitstreams', or 'no' to cancel: yes
Destroying old test database 'default'...
Executing migration '0001_populate_activity_repo.py' on 'default'....Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/core/management/commands/test.py", line 49, in run_from_argv
    super(Command, self).run_from_argv(argv)
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/core/management/commands/test.py", line 72, in handle
    failures = test_runner.run_tests(test_labels)
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/test/simple.py", line 381, in run_tests
    old_config = self.setup_databases()
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/test/simple.py", line 317, in setup_databases
    self.verbosity, autoclobber=not self.interactive)
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/db/backends/creation.py", line 271, in create_test_db
    load_initial_data=False)
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/core/management/__init__.py", line 150, in call_command
    return klass.execute(*args, **defaults)
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/nashvegas/management/commands/syncdb.py", line 18, in handle_noargs
    verbosity=options.get("verbosity"),
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/core/management/__init__.py", line 150, in call_command
    return klass.execute(*args, **defaults)
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/nashvegas/management/commands/upgradedb.py", line 421, in handle
    self.execute_migrations()
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/nashvegas/management/commands/upgradedb.py", line 298, in execute_migrations
    show_traceback=show_traceback
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/nashvegas/management/commands/upgradedb.py", line 177, in _execute_migration
    execfile(migration, {}, module)
  File "/Users/justinlilly/src/hacks/gitstreams/gitstreams/migrations/0001_populate_activity_repo.py", line 7, in <module>
    total = qs.count()
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/db/models/query.py", line 351, in count
    return self.query.get_count(using=self.db)
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/db/models/sql/query.py", line 418, in get_count
    number = obj.get_aggregation(using=using)[None]
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/db/models/sql/query.py", line 384, in get_aggregation
    result = query.get_compiler(using).execute_sql(SINGLE)
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 818, in execute_sql
    cursor.execute(sql, params)
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 114, in execute
    return self.cursor.execute(query, args)
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/Users/justinlilly/.virtualenvs/gitstreams/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
django.db.utils.DatabaseError: (1146, "Table 'test_gitstreams.streamer_activity' doesn't exist")

Do I need to create initial schema migrations w/ nashvegas? The docs didn't really make it clear. I thought it would basically be syncdb + any changes that need to happen.

@paltman

yeah, i generally do a manage.py upgradedb -c > migrations/001_initial.sql

@justinabrahms

That does seem to work. Thanks! It would be helpful if the documentation said that somewhere.

@paltman paltman closed this in 78ca23c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.