Skip to content

Commit

Permalink
Fix mysql tests collation
Browse files Browse the repository at this point in the history
  • Loading branch information
spectras committed Nov 18, 2018
1 parent 2005f09 commit c067021
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,30 @@
'sqlite': 'django.db.backends.sqlite3',
}

EXTRA = {
'django.db.backends.postgresql_psycopg2': {
'TEST': {'CHARSET': 'utf8'},
},
'django.db.backends.mysql': {
'TEST': {'CHARSET': 'utf8', 'COLLATION': 'utf8_general_ci'},
},
}

#=============================================================================

def parse_database(url):
url = urlparse(url)
return {
'ENGINE': ENGINES[url.scheme],
engine = ENGINES[url.scheme]
result = {
'ENGINE': engine,
'NAME': url.path.strip('/'),
'HOST': url.hostname,
'PORT': url.port,
'USER': url.username,
'PASSWORD': url.password,
'CHARSET': 'utf8',
'COLLATION': 'utf8_general_ci',
}
result.update(EXTRA.get(engine, {}))
return result

#=============================================================================

Expand Down

0 comments on commit c067021

Please sign in to comment.