Skip to content

Commit

Permalink
Merge 8502210 into c210bd2
Browse files Browse the repository at this point in the history
  • Loading branch information
dlax committed Sep 28, 2020
2 parents c210bd2 + 8502210 commit c8c8aa9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pytest_postgresql/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def init_directory(self):
self.clean_directory()
init_directory = [self.executable, 'initdb', '--pgdata', self.datadir]
options = ['--username=%s' % self.user]
env = self._envvars.copy()

if self.password:
with tempfile.NamedTemporaryFile() as password_file:
Expand All @@ -150,11 +151,11 @@ def init_directory(self):
password_file.write(password)
password_file.flush()
init_directory += ['-o', ' '.join(options)]
subprocess.check_output(init_directory)
subprocess.check_output(init_directory, env=env)
else:
options += ['--auth=trust']
init_directory += ['-o', ' '.join(options)]
subprocess.check_output(init_directory)
subprocess.check_output(init_directory, env=env)

self._directory_initialised = True

Expand Down Expand Up @@ -202,6 +203,7 @@ def running(self):
pg_ctl=self.executable,
datadir=self.datadir
),
env=self._envvars.copy(),
shell=True
).decode('utf-8')
except subprocess.CalledProcessError as ex:
Expand Down

0 comments on commit c8c8aa9

Please sign in to comment.