Skip to content

Commit

Permalink
Initialize the postgres cluster with no locale support
Browse files Browse the repository at this point in the history
We change the call to 'initdb' to add --locale=C in order to disable
locale support so that log messages that will then be emitted by
postgres will be in English. Otherwise, initdb will pick the locale
setting of its execution environment [1] which, when not an English one,
will then make the checks in PostgreSQLExecutor.running() (where the
message "pg_ctl: server is running" is expected) fail.

Fix #315.

[1]: https://www.postgresql.org/docs/current/locale.html
  • Loading branch information
dlax committed Sep 27, 2020
1 parent 035f90c commit efb49cf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pytest_postgresql/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def init_directory(self):
# remove old one if exists first.
self.clean_directory()
init_directory = [self.executable, 'initdb', '--pgdata', self.datadir]
options = ['--username=%s' % self.user]
options = ['--locale=C', '--username=%s' % self.user]

if self.password:
with tempfile.NamedTemporaryFile() as password_file:
Expand Down

0 comments on commit efb49cf

Please sign in to comment.