Skip to content

Commit

Permalink
add support for \ character in pytest temporary path - Closes Clearco…
Browse files Browse the repository at this point in the history
  • Loading branch information
bhelgs committed Sep 3, 2024
1 parent bf18cc0 commit a24d7dc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions newsfragments/982.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add support for \\ character in pytest temporary path
8 changes: 4 additions & 4 deletions pytest_postgresql/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ class PostgreSQLExecutor(TCPExecutor):
"""

BASE_PROC_START_COMMAND = (
"{executable} start -D {datadir} "
'{executable} start -D "{datadir}" '
"-o \"-F -p {port} -c log_destination='stderr' "
"-c logging_collector=off "
"-c unix_socket_directories='{unixsocketdir}' {postgres_options}\" "
"-l {logfile} {startparams}"
'-l "{logfile}" {startparams}'
)

VERSION_RE = re.compile(r".* (?P<version>\d+(?:\.\d+)?)")
Expand Down Expand Up @@ -216,13 +216,13 @@ def running(self) -> bool:
"""Check if server is running."""
if not os.path.exists(self.datadir):
return False
status_code = subprocess.getstatusoutput(f"{self.executable} status -D {self.datadir}")[0]
status_code = subprocess.getstatusoutput(f'{self.executable} status -D "{self.datadir}"')[0]
return status_code == 0

def stop(self: T, sig: Optional[int] = None, exp_sig: Optional[int] = None) -> T:
"""Issue a stop request to executable."""
subprocess.check_output(
f"{self.executable} stop -D {self.datadir} -m f",
f'{self.executable} stop -D "{self.datadir}" -m f',
shell=True,
)
try:
Expand Down
1 change: 0 additions & 1 deletion tests/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def test_executor_init_with_password(
assert_executor_start_stop(executor)


@pytest.mark.xfail(reason="issue tracked by #982")
def test_executor_init_bad_tmp_path(
request: FixtureRequest,
tmp_path_factory: pytest.TempPathFactory,
Expand Down

0 comments on commit a24d7dc

Please sign in to comment.