Fix collation for postgres for unit tests (#7359)

When running the UTs against a postgres deatbase, we need to set the collation
correctly.
This commit is contained in:
Richard van der Hoff 2020-04-28 14:21:48 +01:00 committed by GitHub
parent 38919b521e
commit fb8ff79efd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

1
changelog.d/7359.misc Normal file
View File

@ -0,0 +1 @@
Fix collation for postgres for unit tests.

View File

@ -74,7 +74,10 @@ def setupdb():
db_conn.autocommit = True
cur = db_conn.cursor()
cur.execute("DROP DATABASE IF EXISTS %s;" % (POSTGRES_BASE_DB,))
cur.execute("CREATE DATABASE %s;" % (POSTGRES_BASE_DB,))
cur.execute(
"CREATE DATABASE %s ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' "
"template=template0;" % (POSTGRES_BASE_DB,)
)
cur.close()
db_conn.close()