Skip to content

Commit 717e81f

Browse files
committed
revert: remove Windows-specific changes deferred to PR-1182
Remove Windows executor compatibility changes (log_destination quoting, unix_socket_directories platform guard, os.killpg AttributeError catch) and the Windows-only event_loop_policy fixture from conftest.py. These belong in the separate Windows compatibility PR dbfixtures#1182. Made-with: Cursor
1 parent bdca11e commit 717e81f

2 files changed

Lines changed: 3 additions & 27 deletions

File tree

pytest_postgresql/executor.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ class PostgreSQLExecutor(TCPExecutor):
5050

5151
BASE_PROC_START_COMMAND = (
5252
'{executable} start -D "{datadir}" '
53-
"-o \"-F -p {port} -c log_destination=stderr "
53+
"-o \"-F -p {port} -c log_destination='stderr' "
5454
"-c logging_collector=off "
55-
"{unix_socket_opt}{postgres_options}\" "
55+
"-c unix_socket_directories='{unixsocketdir}' {postgres_options}\" "
5656
'-l "{logfile}" {startparams}'
5757
)
5858

@@ -108,17 +108,11 @@ def __init__(
108108
self.logfile = logfile
109109
self.startparams = startparams
110110
self.postgres_options = postgres_options
111-
# On Windows, Unix sockets are not supported; omit the parameter entirely.
112-
unix_socket_opt = (
113-
f"-c unix_socket_directories={self.unixsocketdir} "
114-
if platform.system() != "Windows"
115-
else ""
116-
)
117111
command = self.BASE_PROC_START_COMMAND.format(
118112
executable=self.executable,
119113
datadir=self.datadir,
120114
port=port,
121-
unix_socket_opt=unix_socket_opt,
115+
unixsocketdir=self.unixsocketdir,
122116
logfile=self.logfile,
123117
startparams=self.startparams,
124118
postgres_options=self.postgres_options,
@@ -236,10 +230,6 @@ def stop(self: T, sig: Optional[int] = None, exp_sig: Optional[int] = None) -> T
236230
except ProcessFinishedWithError:
237231
# Finished, leftovers ought to be cleaned afterwards anyway
238232
pass
239-
except AttributeError:
240-
# os.killpg is not available on Windows; the pg_ctl stop above
241-
# already terminated the process, so this is safe to ignore.
242-
pass
243233
return self
244234

245235
def __del__(self) -> None:

tests/conftest.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,12 @@
11
"""Tests main conftest file."""
22

3-
import asyncio
43
import os
5-
import sys
6-
import warnings
74
from pathlib import Path
85

9-
import pytest
106
from pytest_postgresql import factories
117
from pytest_postgresql.plugin import * # noqa: F403,F401
128

139
pytest_plugins = ["pytester"]
14-
15-
16-
@pytest.fixture(scope="session")
17-
def event_loop_policy(): # type: ignore[override]
18-
"""Use SelectorEventLoop on Windows; psycopg3 async requires it."""
19-
with warnings.catch_warnings():
20-
warnings.simplefilter("ignore", DeprecationWarning)
21-
if sys.platform == "win32":
22-
return asyncio.WindowsSelectorEventLoopPolicy()
23-
return asyncio.DefaultEventLoopPolicy()
2410
POSTGRESQL_VERSION = os.environ.get("POSTGRES", "13")
2511

2612

0 commit comments

Comments
 (0)