Skip to content

Commit

Permalink
Fix collation for postgres for unit tests (matrix-org#7359)
Browse files Browse the repository at this point in the history
When running the UTs against a postgres deatbase, we need to set the collation
correctly.
  • Loading branch information
richvdh authored and phil-flex committed Jun 16, 2020
1 parent 0137f87 commit 66fc4ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/7359.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix collation for postgres for unit tests.
5 changes: 4 additions & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 66fc4ae

Please sign in to comment.