From c1321462d7381b00e79f39c6805d95dc40128f42 Mon Sep 17 00:00:00 2001 From: Robert Martin Date: Wed, 22 May 2013 16:25:57 -0400 Subject: prevent south migrate during tests Many tests would fail when run in MySQL because the test database was not being set up correctly. With this setting, the MySQL database constructs itself correctly. --- askbot/setup_templates/settings.py | 6 +++++- askbot/setup_templates/settings.py.mustache | 14 +++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/askbot/setup_templates/settings.py b/askbot/setup_templates/settings.py index 258a5989..1427e506 100644 --- a/askbot/setup_templates/settings.py +++ b/askbot/setup_templates/settings.py @@ -307,5 +307,9 @@ if 'ASKBOT_CSS_DEVEL' in locals() and ASKBOT_CSS_DEVEL == True: ) COMPRESS_JS_FILTERS = [] -COMPRESS_PARSER = 'compressor.parser.HtmlParser' +COMPRESS_PARSER = 'compressor.parser.HtmlParser' JINJA2_EXTENSIONS = ('compressor.contrib.jinja2ext.CompressorExtension',) + +# Use syncdb for tests instead of South migrations. Without this, some tests +# fail spuriously in MySQL. +SOUTH_TESTS_MIGRATE = False diff --git a/askbot/setup_templates/settings.py.mustache b/askbot/setup_templates/settings.py.mustache index f3c0a35b..c14ebaee 100644 --- a/askbot/setup_templates/settings.py.mustache +++ b/askbot/setup_templates/settings.py.mustache @@ -46,7 +46,7 @@ EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' #go to the site's live settings and enable the feature #"Email settings" -> "allow asking by email" # -# WARNING: command post_emailed_questions DELETES all +# WARNING: command post_emailed_questions DELETES all # emails from the mailbox each time # do not use your personal mail box here!!! # @@ -125,7 +125,7 @@ ROOT_URLCONF = os.path.basename(os.path.dirname(__file__)) + '.urls' #UPLOAD SETTINGS FILE_UPLOAD_TEMP_DIR = os.path.join( - os.path.dirname(__file__), + os.path.dirname(__file__), 'tmp' ).replace('\\','/') @@ -258,7 +258,7 @@ HAYSTACK_SITECONF = 'askbot.search.haystack' #http://django-haystack.readthedocs.org/en/v1.2.7/settings.html HAYSTACK_SEARCH_ENGINE = 'simple' -TINYMCE_COMPRESSOR = True +TINYMCE_COMPRESSOR = True TINYMCE_SPELLCHECKER = False TINYMCE_JS_ROOT = os.path.join(STATIC_ROOT, 'default/media/js/tinymce/') #TINYMCE_JS_URL = STATIC_URL + 'default/media/js/tinymce/tiny_mce.js' @@ -287,7 +287,7 @@ TINYMCE_DEFAULT_CONFIG = { } #delayed notifications, time in seconds, 15 mins by default -NOTIFICATION_DELAY_TIME = 60 * 15 +NOTIFICATION_DELAY_TIME = 60 * 15 GROUP_MESSAGING = { 'BASE_URL_GETTER_FUNCTION': 'askbot.models.user_get_profile_url', @@ -303,5 +303,9 @@ if 'ASKBOT_CSS_DEVEL' in locals() and ASKBOT_CSS_DEVEL == True: ) COMPRESS_JS_FILTERS = [] -COMPRESS_PARSER = 'compressor.parser.HtmlParser' +COMPRESS_PARSER = 'compressor.parser.HtmlParser' JINJA2_EXTENSIONS = ('compressor.contrib.jinja2ext.CompressorExtension',) + +# Use syncdb for tests instead of South migrations. Without this, some tests +# fail spuriously in MySQL. +SOUTH_TESTS_MIGRATE = False -- cgit v1.2.3-1-g7c22 From 05d3f1e85aaa0e9f5e5fc5db78ac4949893027d6 Mon Sep 17 00:00:00 2001 From: Robert Martin Date: Wed, 22 May 2013 17:59:46 -0400 Subject: set test charset & collation to utf-8 Without these settings, MySQL chooses the wrong charset and collation, which causes some utf-8 tests to fail. --- askbot/setup_templates/settings.py.mustache | 2 ++ 1 file changed, 2 insertions(+) diff --git a/askbot/setup_templates/settings.py.mustache b/askbot/setup_templates/settings.py.mustache index c14ebaee..f30297d7 100644 --- a/askbot/setup_templates/settings.py.mustache +++ b/askbot/setup_templates/settings.py.mustache @@ -27,6 +27,8 @@ DATABASES = { 'PASSWORD': '{{database_password}}', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. + 'TEST_CHARSET': 'utf8', # Setting the character set and collation to utf-8 + 'TEST_COLLATION': 'utf8_general_ci', # is necessary for MySQL tests to work properly. } } -- cgit v1.2.3-1-g7c22