13

When I run my tests in Django, after a fail I got several pages of debug output from South, like these:

south: DEBUG: south execute "CREATE INDEX "sometable_4d5bad5" ON "video_playable" ("network_id");" with params "[]"
south: DEBUG: south execute "CREATE INDEX "sometable_790e6d98" ON "video_playable" ("published");" with params "[]"
south: DEBUG: south execute "CREATE INDEX "sometable_72312277" ON "video_playable" ("archived");" with params "[]"

And with all this logging output, the relevant error messages are lost in a sea of garbage. Is there a way to disable this ouput?

lfagundes
  • 2,978
  • 5
  • 24
  • 25
  • This is a really helpful post - http://pypede.wordpress.com/2012/06/17/disable-south-debug-logging-when-testing-apps-with-nose-in-django/ – shad0w_wa1k3r Aug 06 '14 at 20:26

3 Answers3

15

Put this somewhere in your code. I have it in myapp/migrations/__init__.py

import logging
south_logger=logging.getLogger('south')
south_logger.setLevel(logging.INFO)
guettli
  • 25,042
  • 81
  • 346
  • 663
7

You can set SOUTH_TESTS_MIGRATE to False in your setting.py. This will disable all migrations during the tests. I know it's not exactly what you want, but hope will be usefull

If this is False, South’s test runner integration will make the test database be created using syncdb, rather than via migrations (the default). Set this to False if you have migrations which take too long to migrate every time tests run, but be wary if you rely on migrations to do special things.

Alexey Savanovich
  • 1,893
  • 11
  • 19
  • yes, this does not exactly solve my problem, because currently my tests depend on data migrations. but these messages are so annoying that redesigning the tests are worth the trouble... thanks! – lfagundes Dec 27 '11 at 12:20
3
import logging
import south.logger
logging.getLogger('south').setLevel(logging.CRITICAL)

I am able to set this in my setting/testing.py

Also if this is only bothering you with your django-nose tests add

nosetests --nologcapture
rhigdon
  • 1,483
  • 1
  • 15
  • 20