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 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_usuari
Re: newcomer to django testing
The testing process creates db itself when using south it migrate all apps with migrations. Could you have a problem with your migrations when run from zero?. Regards Esau Rodriguez. On Sun, Jun 8, 2014 at 10:20 AM, monoBOT wrote: > 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 > 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/l
Re: newcomer to django testing
Hi Esau. Funny to see you here ;.D I checked what you told me and its true ... if I try to create the database starting with the comunidad table it raises the error but when starting the migrations with usuario it goes smooth. Simply changing the app order in the settings.py file fixed the problem ... Thanks mate 2014-06-08 15:39 GMT+01:00 Esau Rodriguez : > The testing process creates db itself when using south it migrate all > apps with migrations. Could you have a problem with your migrations > when run from zero?. > > Regards > Esau Rodriguez. > > > > On Sun, Jun 8, 2014 at 10:20 AM, monoBOT wrote: > > 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 > > 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) > >
Re: newcomer to django testing
You can also add a depends_on statement to your south migrations, if you really need them to run in a particular order: http://south.readthedocs.org/en/latest/dependencies.html On Sun, Jun 8, 2014 at 2:09 PM, monoBOT wrote: > Hi Esau. > > Funny to see you here ;.D > > I checked what you told me and its true ... if I try to create the > database starting with the comunidad table it raises the error but when > starting the migrations with usuario it goes smooth. > > Simply changing the app order in the settings.py file fixed the problem ... > > Thanks mate > > > 2014-06-08 15:39 GMT+01:00 Esau Rodriguez : > > The testing process creates db itself when using south it migrate all >> apps with migrations. Could you have a problem with your migrations >> when run from zero?. >> >> Regards >> Esau Rodriguez. >> >> >> >> On Sun, Jun 8, 2014 at 10:20 AM, monoBOT wrote: >> > 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 >> > 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, wor