Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
6c86cc3
Refactor PostgreSQLExecutor to support Windows compatibility for proc…
tboy1337 Jan 29, 2026
4d77539
Enhance PostgreSQL workflow for Windows compatibility and streamline …
tboy1337 Feb 11, 2026
9d1742a
Enhance PostgreSQL workflow and executor for improved cross-platform …
tboy1337 Feb 11, 2026
5fa0b10
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 11, 2026
429d26c
Refactor PostgreSQLExecutor and enhance Windows compatibility in tests
tboy1337 Feb 11, 2026
f78f5d4
Improve process termination handling in PostgreSQLExecutor and refine…
tboy1337 Feb 11, 2026
79233aa
Update GitHub workflows to include editable package installation
tboy1337 Feb 15, 2026
d80f234
Update oldest-postgres.yml to install package without dependencies
tboy1337 Feb 15, 2026
c9bc3bc
Enhance PostgreSQL workflow error handling
tboy1337 Feb 15, 2026
411a03d
Refactor PostgreSQLExecutor command templates for platform compatibility
tboy1337 Feb 15, 2026
89d842b
Fix PostgreSQL path in Windows workflow
tboy1337 Feb 15, 2026
5033863
Update pytest configuration in test_postgres_options_plugin.py
tboy1337 Feb 15, 2026
7d8f38e
Update pytest_plugins declaration in test_postgres_options_plugin.py …
tboy1337 Feb 15, 2026
1aceba3
Enhance platform-specific command templates and test coverage for Pos…
tboy1337 Feb 16, 2026
686197a
Add Windows locale setup fixture and update test cases for password h…
tboy1337 Feb 16, 2026
b615a6a
Update locale handling in executor.py and remove Windows locale setup…
tboy1337 Feb 16, 2026
e268bee
Refactor socket directory handling in test_executor.py for PostgreSQL…
tboy1337 Feb 16, 2026
d3a8b41
Update path handling for pytest uploads in single-postgres.yml
tboy1337 Feb 16, 2026
e7c690b
Update pytest command options in single-postgres.yml to include --bas…
tboy1337 Feb 16, 2026
0054df8
Refine pytest upload path in single-postgres.yml for improved artifac…
tboy1337 Feb 16, 2026
0afbfdd
Update workflows to use pipenv-setup@v4.4.0 with editable flag
tboy1337 Feb 16, 2026
f89d3b3
Update workflow files to use pipenv-run@v4.2.1 and refine conditional…
tboy1337 Feb 16, 2026
0b7de46
Refactor socket directory handling in test_executor.py and clean up t…
tboy1337 Feb 23, 2026
1b1ff4b
Fix formatting issues in PostgreSQL command templates and update test…
tboy1337 Feb 23, 2026
9c3aa4a
Update test assertions for PostgreSQL command formatting in test_exec…
tboy1337 Feb 23, 2026
e92879b
Add FreeBSD to platform parameterization in test_executor.py
tboy1337 Feb 23, 2026
9a8dc2b
Fixed trailing whitespace in single-postgres.yml and test_executor.py
tboy1337 Mar 1, 2026
400bddd
Refine pytest temporary directory handling in single-postgres.yml
tboy1337 Mar 1, 2026
a8d9dd6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 1, 2026
ba73005
Update test documentation for Windows UNC paths in test_windows_compa…
tboy1337 Mar 3, 2026
44fc97e
Remove editable package changes extracted to separate PR
tboy1337 Mar 13, 2026
e4d8699
Refactor command quoting in PostgreSQLExecutor for consistency
tboy1337 Apr 14, 2026
bd12358
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 14, 2026
e676a74
Enhance PostgreSQLExecutor to escape apostrophes in unixsocketdir
tboy1337 Apr 14, 2026
87abf24
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 14, 2026
52fb056
Fix CI for Windows support and align with main workflow conventions
tboy1337 Apr 16, 2026
8c37b21
Action fizyk review requests: split Windows CI and skip non-Windows t…
tboy1337 May 1, 2026
6b49ce6
Fix three Windows CI failures
tboy1337 May 1, 2026
494e093
Fix Windows restart timeout and macOS xdist race in executor tests
tboy1337 May 1, 2026
60fa1b9
Refactor executor test assertions for path quoting
tboy1337 May 1, 2026
5534379
Fix connection leak, tighten socket-dir assertion, fix Windows start
tboy1337 May 1, 2026
0210c89
Refine Windows start() and check_subprocess() in executor
tboy1337 May 1, 2026
9fac771
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 1, 2026
cc7fe02
Honor executor timeout in Windows start() path
tboy1337 May 1, 2026
d530337
Fix output leakage, cross-platform test coverage, and Windows start e…
tboy1337 May 1, 2026
c96148a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 1, 2026
7f7914b
Refactor Windows command handling in PostgreSQLExecutor
tboy1337 May 1, 2026
8ff792b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 1, 2026
5ddaf2d
Update shlex.split for POSIX compatibility and reset process attribut…
tboy1337 May 1, 2026
49419dc
Merge branch 'edit' of https://github.com/tboy1337/pytest-postgresql …
tboy1337 May 1, 2026
9ccaabd
Update artifact naming in GitHub Actions and adjust shlex.split for W…
tboy1337 May 1, 2026
fc14bdc
Enhance PostgreSQLExecutor with wait_for_postgres and timeout handling
tboy1337 May 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/oldest-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
run: |
sudo locale-gen de_DE.UTF-8
- name: install libpq
if: ${{ contains(inputs.python-versions, 'pypy') }}
if: ${{ contains(matrix.python-version, 'pypy') && runner.os == 'Linux' }}
run: sudo apt install libpq5
- name: Install oldest supported versions
uses: fizyk/actions-reuse/.github/actions/pipenv-run@v4.4.4
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/single-postgres-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Run pytest tests on Windows

on:
workflow_call:
inputs:
python-versions:
description: 'Supported python versions'
default: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
required: false
type: string
postgresql:
description: 'PostgreSQL version'
required: true
type: number
secrets:
codecov_token:
description: 'Codecov token'
required: false

jobs:
postgres:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJSON(inputs.python-versions) }}
env:
OS: windows-latest
PYTHON: ${{ matrix.python-version }}
POSTGRES: ${{ inputs.postgresql }}
steps:
- uses: actions/checkout@v6
- name: Set up Pipenv on python ${{ matrix.python-version }}
uses: fizyk/actions-reuse/.github/actions/pipenv-setup@v4.4.4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: ankane/setup-postgres@v1
Comment on lines +32 to +38
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot May 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

file=".github/workflows/single-postgres-windows.yml"

echo "All action references:"
rg -nP '^\s*-\s*uses:\s*[^ ]+@[^ ]+' "$file"

echo
echo "Action references NOT pinned to a 40-char SHA:"
rg -nP '^\s*-\s*uses:\s*[^ ]+@(?![0-9a-fA-F]{40}\b)[^ ]+' "$file"

Repository: dbfixtures/pytest-postgresql

Length of output: 389


🏁 Script executed:

cat -n ".github/workflows/single-postgres-windows.yml"

Repository: dbfixtures/pytest-postgresql

Length of output: 3503


Pin all external actions to immutable commit SHAs.

Using mutable tags for uses: leaves the workflow open to upstream tag retargeting and supply-chain drift. Replace version tags with full-length commit SHA pins (optionally with a trailing comment for the tag/release).

Seven actions currently use mutable tags across this workflow:

  • Line 32: actions/checkout@v6
  • Line 34: fizyk/actions-reuse/.github/actions/pipenv-setup@v4.4.4
  • Line 38: ankane/setup-postgres@v1
  • Lines 60, 64: fizyk/actions-reuse/.github/actions/pipenv-run@v4.4.4
  • Line 67: actions/upload-artifact@v7
  • Line 73: codecov/codecov-action@v6.0.0
Suggested update pattern
-      - uses: actions/checkout@v6
+      - uses: actions/checkout@<40-char-commit-sha> # v6

-        uses: fizyk/actions-reuse/.github/actions/pipenv-setup@v4.4.4
+        uses: fizyk/actions-reuse/.github/actions/pipenv-setup@<40-char-commit-sha> # v4.4.4

-      - uses: ankane/setup-postgres@v1
+      - uses: ankane/setup-postgres@<40-char-commit-sha> # v1

-        uses: fizyk/actions-reuse/.github/actions/pipenv-run@v4.4.4
+        uses: fizyk/actions-reuse/.github/actions/pipenv-run@<40-char-commit-sha> # v4.4.4

-      - uses: actions/upload-artifact@v7
+      - uses: actions/upload-artifact@<40-char-commit-sha> # v7

-        uses: codecov/codecov-action@v6.0.0
+        uses: codecov/codecov-action@<40-char-commit-sha> # v6.0.0
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/single-postgres-windows.yml around lines 32 - 38, Replace
mutable action tags with full commit SHAs for each external action use: update
actions/checkout@v6, fizyk/actions-reuse/.github/actions/pipenv-setup@v4.4.4,
ankane/setup-postgres@v1, both
fizyk/actions-reuse/.github/actions/pipenv-run@v4.4.4 entries,
actions/upload-artifact@v7, and codecov/codecov-action@v6.0.0 to their
corresponding full-length commit SHAs (you can obtain the SHA from each action's
GitHub repo by selecting the tag/release commit) and leave an optional comment
noting the original tag; ensure the YAML values remain under uses: and no other
changes are made to the action inputs or step names.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coderabbitai if dependabot handles it, defer that to separate issue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check for Dependabot configuration
fd -i 'dependabot.yml' .github/ --exec cat {}
echo "---"
fd -i 'dependabot.yaml' .github/ --exec cat {}

Unrecoverable error: Failed to clone repository


🏁 Script executed:

#!/bin/bash
# Fetch dependabot config via GitHub API
gh api repos/dbfixtures/pytest-postgresql/contents/.github/dependabot.yml \
  --jq '.content' | base64 -d 2>/dev/null || echo "NOT FOUND"

Length of output: 101


🏁 Script executed:

#!/bin/bash
# Try fetching dependabot config via raw GitHub URL
curl -s -o /dev/null -w "%{http_code}" \
  "https://raw.githubusercontent.com/dbfixtures/pytest-postgresql/main/.github/dependabot.yml"
echo ""
curl -s "https://raw.githubusercontent.com/dbfixtures/pytest-postgresql/main/.github/dependabot.yml"

Length of output: 340


@fizyk, confirmed — .github/dependabot.yml on main already has package-ecosystem: github-actions configured (weekly, Sundays). Would you like me to open a follow-up GitHub issue to track pinning the action references in this new workflow to immutable commit SHAs?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that's what I asked. Not sure how that would help, with my resources being a dependabot and auto-merge, with no real time for manual review od those updates. Well at least setup-posgres updates would be more visible.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
gh issue create \
  --repo dbfixtures/pytest-postgresql \
  --title "Pin GitHub Actions to immutable commit SHAs in single-postgres-windows.yml" \
  --body "## Summary

The new workflow \`.github/workflows/single-postgres-windows.yml\` (introduced in PR `#1182`) references external actions using mutable version tags rather than immutable commit SHAs. Using mutable tags leaves the workflow open to upstream tag retargeting and supply-chain drift.

Dependabot (\`.github/dependabot.yml\`) is already configured with \`package-ecosystem: github-actions\` and will raise PRs to keep these pinned; this issue tracks the initial pinning.

## Actions to pin

| Step | Current reference | Notes |
|---|---|---|
| checkout | \`actions/checkout@v6\` | |
| pipenv-setup | \`fizyk/actions-reuse/.github/actions/pipenv-setup@v4.4.4\` | |
| setup-postgres | \`ankane/setup-postgres@v1\` | |
| pipenv-run (×2) | \`fizyk/actions-reuse/.github/actions/pipenv-run@v4.4.4\` | |
| upload-artifact | \`actions/upload-artifact@v7\` | |
| codecov-action | \`codecov/codecov-action@v6.0.0\` | |

## Suggested approach

Replace each mutable tag with the full 40-character commit SHA of that release, leaving the tag in a trailing comment for readability, e.g.:

\`\`\`yaml
- uses: actions/checkout@<40-char-sha> # v6
\`\`\`

Once pinned, Dependabot will keep them up to date automatically via PRs.

---

Backlink: PR `#1182`, comment https://github.com/dbfixtures/pytest-postgresql/pull/1182#discussion_r3173411799
Requested by: `@fizyk`" \
  --assignee fizyk

Length of output: 60


@fizyk, I've opened issue #1331 to track the initial pinning. You're right that with Dependabot + auto-merge the ongoing maintenance is largely hands-off — the main practical benefit is that ankane/setup-postgres updates will show up as explicit PRs rather than silently picking up whatever the tag points to.

with:
postgres-version: ${{ inputs.postgresql }}
- name: Detect PostgreSQL path on Windows
shell: pwsh
run: |
$pgPath = "C:\Program Files\PostgreSQL\${{ inputs.postgresql }}\bin\pg_ctl.exe"
if (Test-Path $pgPath) {
echo "POSTGRESQL_EXEC=$pgPath" >> $env:GITHUB_ENV
} else {
$pgPath = (Get-Command pg_ctl -ErrorAction SilentlyContinue).Source
if ($pgPath) {
echo "POSTGRESQL_EXEC=$pgPath" >> $env:GITHUB_ENV
}
}

# Verify that PostgreSQL was found
if (-not $pgPath) {
Write-Error "Error: pg_ctl not found in expected locations. Checked hardcoded path and system PATH."
exit 1
}
- name: Run test
uses: fizyk/actions-reuse/.github/actions/pipenv-run@v4.4.4
with:
command: pytest -svv -p no:xdist --postgresql-exec="${{ env.POSTGRESQL_EXEC }}" -k "not docker" --cov-report=xml --basetemp="${{ runner.temp }}/pytest-basetemp"
- name: Run xdist test
uses: fizyk/actions-reuse/.github/actions/pipenv-run@v4.4.4
with:
command: pytest -n auto --dist loadgroup --max-worker-restart 0 --postgresql-exec="${{ env.POSTGRESQL_EXEC }}" -k "not docker" --cov-report=xml:coverage-xdist.xml --basetemp="${{ runner.temp }}/pytest-basetemp"
- uses: actions/upload-artifact@v7
if: failure()
with:
name: postgresql-windows-${{ matrix.python-version }}-${{ inputs.postgresql }}
path: ${{ runner.temp }}/pytest-basetemp/**
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6.0.0
with:
token: ${{ secrets.codecov_token }}
flags: unittests
env_vars: OS,PYTHON
fail_ci_if_error: false
27 changes: 23 additions & 4 deletions .github/workflows/single-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,25 @@ jobs:
- uses: ankane/setup-postgres@v1
with:
postgres-version: ${{ inputs.postgresql }}
- name: Set PostgreSQL path
run: |
# Try to find pg_ctl dynamically for cross-platform compatibility
if command -v pg_ctl >/dev/null 2>&1; then
Comment thread
tboy1337 marked this conversation as resolved.
PG_CTL_PATH=$(command -v pg_ctl)
echo "POSTGRESQL_EXEC=$PG_CTL_PATH" >> $GITHUB_ENV
elif [ -f "/opt/homebrew/opt/postgresql@${{ inputs.postgresql }}/bin/pg_ctl" ]; then
# macOS Apple Silicon Homebrew path
echo "POSTGRESQL_EXEC=/opt/homebrew/opt/postgresql@${{ inputs.postgresql }}/bin/pg_ctl" >> $GITHUB_ENV
elif [ -f "/usr/local/opt/postgresql@${{ inputs.postgresql }}/bin/pg_ctl" ]; then
# macOS Intel Homebrew path
echo "POSTGRESQL_EXEC=/usr/local/opt/postgresql@${{ inputs.postgresql }}/bin/pg_ctl" >> $GITHUB_ENV
elif [ -f "/usr/lib/postgresql/${{ inputs.postgresql }}/bin/pg_ctl" ]; then
# Debian/Ubuntu path (fallback)
echo "POSTGRESQL_EXEC=/usr/lib/postgresql/${{ inputs.postgresql }}/bin/pg_ctl" >> $GITHUB_ENV
else
echo "Error: pg_ctl not found in expected locations"
exit 1
fi
- name: Check installed locales
run: |
locale -a
Expand All @@ -51,21 +70,21 @@ jobs:
run: |
sudo locale-gen de_DE.UTF-8
- name: install libpq
if: ${{ contains(inputs.python-versions, 'pypy') }}
if: ${{ contains(matrix.python-version, 'pypy') && runner.os == 'Linux' }}
run: sudo apt install libpq5
- name: Run test
uses: fizyk/actions-reuse/.github/actions/pipenv-run@v4.4.4
with:
command: pytest -svv -p no:xdist --postgresql-exec="/usr/lib/postgresql/${{ inputs.postgresql }}/bin/pg_ctl" -k "not docker" --cov-report=xml
command: pytest -svv -p no:xdist --postgresql-exec="${{ env.POSTGRESQL_EXEC }}" -k "not docker" --cov-report=xml --basetemp="${{ runner.temp }}/pytest-basetemp"
- name: Run xdist test
uses: fizyk/actions-reuse/.github/actions/pipenv-run@v4.4.4
with:
command: pytest -n auto --dist loadgroup --max-worker-restart 0 --postgresql-exec="/usr/lib/postgresql/${{ inputs.postgresql }}/bin/pg_ctl" -k "not docker" --cov-report=xml:coverage-xdist.xml
command: pytest -n auto --dist loadgroup --max-worker-restart 0 --postgresql-exec="${{ env.POSTGRESQL_EXEC }}" -k "not docker" --cov-report=xml:coverage-xdist.xml --basetemp="${{ runner.temp }}/pytest-basetemp"
- uses: actions/upload-artifact@v7
if: failure()
with:
name: postgresql-${{ matrix.python-version }}-${{ inputs.postgresql }}
path: /tmp/pytest-of-runner/**
path: ${{ runner.temp }}/pytest-basetemp/**
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6.0.0
with:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ jobs:
python-versions: '["3.13", "3.14"]'
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
windows_postgres_17:
needs: [postgresql_17]
uses: ./.github/workflows/single-postgres-windows.yml
with:
postgresql: 17
python-versions: '["3.12", "3.13", "3.14"]'
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
docker_postgresql_18:
needs: [postgresql_18]
uses: ./.github/workflows/dockerised-postgres.yml
Expand Down
1 change: 1 addition & 0 deletions newsfragments/1182.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add Windows support for ``PostgreSQLExecutor``, including platform-specific start/stop handling.
Loading
Loading