Apply ruff formatting to postgres adapter and tests.
PR Title Check / check-title (pull_request) Successful in 8s
Test Python Package / unit-tests (pull_request) Successful in 13s
Code Quality Pipeline / code-quality (pull_request) Successful in 24s
Test Python Package / integration-tests (pull_request) Successful in 29s
Test Python Package / coverage-report (pull_request) Successful in 10s
PR Title Check / check-title (pull_request) Successful in 8s
Test Python Package / unit-tests (pull_request) Successful in 13s
Code Quality Pipeline / code-quality (pull_request) Successful in 24s
Test Python Package / integration-tests (pull_request) Successful in 29s
Test Python Package / coverage-report (pull_request) Successful in 10s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
63ee17d544
commit
1babb52d09
@@ -94,9 +94,7 @@ class PostgresAdapter(ConnectionAwareAdapter, TableRepositoryInterface):
|
||||
cursor.execute("SELECT 1")
|
||||
try:
|
||||
cursor.execute(
|
||||
sql.SQL("SELECT 1 FROM {} LIMIT 0").format(
|
||||
self._table_identifier()
|
||||
)
|
||||
sql.SQL("SELECT 1 FROM {} LIMIT 0").format(self._table_identifier())
|
||||
)
|
||||
except UndefinedTable as exc:
|
||||
raise ConnectionError(
|
||||
@@ -189,9 +187,7 @@ class PostgresAdapter(ConnectionAwareAdapter, TableRepositoryInterface):
|
||||
on_conflict = sql.SQL("DO UPDATE SET {}").format(update_assignments)
|
||||
else:
|
||||
on_conflict = sql.SQL("DO NOTHING")
|
||||
query = sql.SQL(
|
||||
"INSERT INTO {} ({}) VALUES ({}) ON CONFLICT ({}) {}"
|
||||
).format(
|
||||
query = sql.SQL("INSERT INTO {} ({}) VALUES ({}) ON CONFLICT ({}) {}").format(
|
||||
self._table_identifier(),
|
||||
column_list,
|
||||
placeholders,
|
||||
|
||||
@@ -149,7 +149,9 @@ def test_adapters_dir_exposes_lazy_exports() -> None:
|
||||
"""dir(adapters) includes lazy adapter names for tab completion."""
|
||||
import python_repositories.adapters as adapters
|
||||
|
||||
assert {"RedisAdapter", "MinioAdapter", "PostgresAdapter"}.issubset(set(dir(adapters)))
|
||||
assert {"RedisAdapter", "MinioAdapter", "PostgresAdapter"}.issubset(
|
||||
set(dir(adapters))
|
||||
)
|
||||
|
||||
|
||||
def test_adapters_getattr_raises_for_unknown() -> None:
|
||||
|
||||
@@ -125,7 +125,9 @@ def test_connect_with_injected_client_skips_validation_when_client_cleared() ->
|
||||
def test_connect_reconnects_when_existing_client_unhealthy(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
stale_client = _mock_client(probe_raises=psycopg.OperationalError("connection lost"))
|
||||
stale_client = _mock_client(
|
||||
probe_raises=psycopg.OperationalError("connection lost")
|
||||
)
|
||||
new_client = _mock_client()
|
||||
adapter = PostgresAdapter(config=TEST_POSTGRES_CONFIG)
|
||||
adapter._client = stale_client
|
||||
|
||||
Reference in New Issue
Block a user