Sunday, June 8, 2014

newcomer to django testing

Im new on testing ... to be honest its my first django test XD

Now i wanted to test one of my applications and after the innitial tweaking of allowing the django user to be able to create databases i get this error:

​The error was: relation "usuario_usuario" does not exist

Error in migration: comunidad:0001_initial
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/test.py", line 50, in run_from_argv
    super(Command, self).run_from_argv(argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/test.py", line 71, in execute
    super(Command, self).execute(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/home/monobot/.local/lib/python2.7/site-packages/south/management/commands/test.py", line 8, in handle
    super(Command, self).handle(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/test.py", line 88, in handle
    failures = test_runner.run_tests(test_labels)
  File "/usr/local/lib/python2.7/dist-packages/django/test/runner.py", line 145, in run_tests
    old_config = self.setup_databases()
  File "/usr/local/lib/python2.7/dist-packages/django/test/runner.py", line 107, in setup_databases
    return setup_databases(self.verbosity, self.interactive, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/test/runner.py", line 279, in setup_databases
    verbosity, autoclobber=not interactive)
  File "/home/monobot/.local/lib/python2.7/site-packages/south/hacks/django_1_0.py", line 104, in wrapper
    return f(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/creation.py", line 339, in create_test_db
    load_initial_data=False)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 159, in call_command
    return klass.execute(*args, **defaults)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 415, in handle
    return self.handle_noargs(**options)
  File "/home/monobot/.local/lib/python2.7/site-packages/south/management/commands/syncdb.py", line 103, in handle_noargs
    management.call_command('migrate', **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 159, in call_command
    return klass.execute(*args, **defaults)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/home/monobot/.local/lib/python2.7/site-packages/south/management/commands/migrate.py", line 111, in handle
    ignore_ghosts = ignore_ghosts,
  File "/home/monobot/.local/lib/python2.7/site-packages/south/migration/__init__.py", line 220, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/home/monobot/.local/lib/python2.7/site-packages/south/migration/migrators.py", line 305, in migrate_many
    result = self.migrate(migration, database)
  File "/home/monobot/.local/lib/python2.7/site-packages/south/migration/migrators.py", line 134, in migrate
    result = self.run(migration, database)
  File "/home/monobot/.local/lib/python2.7/site-packages/south/migration/migrators.py", line 115, in run
    return self.run_migration(migration, database)
  File "/home/monobot/.local/lib/python2.7/site-packages/south/migration/migrators.py", line 86, in run_migration
    south.db.db.execute_deferred_sql()
  File "/home/monobot/.local/lib/python2.7/site-packages/south/db/generic.py", line 318, in execute_deferred_sql
    self.execute(sql)
  File "/home/monobot/.local/lib/python2.7/site-packages/south/db/generic.py", line 282, in execute
    cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 99, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "usuario_usuario" does not exist

So you could understand usuario is 1 of my apps and Usuario is one model in there and i use south in my application.

Seems that the test module needs an already functional database before testing but that isnt ilogical because it deletes the database and creates 1other database...


Any help would be welcomed.

--
monoBOT
Visite mi sitio(Visit my site): monobotblog.alvarezalonso.es

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BxOsGCEzE6M9SHs2MFfk-XGmNSyUSsBdn6Hz-ypfH7E%3D-CjiA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment