-
Notifications
You must be signed in to change notification settings - Fork 53
Refactor PostgreSQLExecutor to support Windows compatibility for process management #1182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tboy1337
wants to merge
52
commits into
dbfixtures:main
Choose a base branch
from
tboy1337:edit
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 4d77539
Enhance PostgreSQL workflow for Windows compatibility and streamline …
tboy1337 9d1742a
Enhance PostgreSQL workflow and executor for improved cross-platform …
tboy1337 5fa0b10
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 429d26c
Refactor PostgreSQLExecutor and enhance Windows compatibility in tests
tboy1337 f78f5d4
Improve process termination handling in PostgreSQLExecutor and refine…
tboy1337 79233aa
Update GitHub workflows to include editable package installation
tboy1337 d80f234
Update oldest-postgres.yml to install package without dependencies
tboy1337 c9bc3bc
Enhance PostgreSQL workflow error handling
tboy1337 411a03d
Refactor PostgreSQLExecutor command templates for platform compatibility
tboy1337 89d842b
Fix PostgreSQL path in Windows workflow
tboy1337 5033863
Update pytest configuration in test_postgres_options_plugin.py
tboy1337 7d8f38e
Update pytest_plugins declaration in test_postgres_options_plugin.py …
tboy1337 1aceba3
Enhance platform-specific command templates and test coverage for Pos…
tboy1337 686197a
Add Windows locale setup fixture and update test cases for password h…
tboy1337 b615a6a
Update locale handling in executor.py and remove Windows locale setup…
tboy1337 e268bee
Refactor socket directory handling in test_executor.py for PostgreSQL…
tboy1337 d3a8b41
Update path handling for pytest uploads in single-postgres.yml
tboy1337 e7c690b
Update pytest command options in single-postgres.yml to include --bas…
tboy1337 0054df8
Refine pytest upload path in single-postgres.yml for improved artifac…
tboy1337 0afbfdd
Update workflows to use pipenv-setup@v4.4.0 with editable flag
tboy1337 f89d3b3
Update workflow files to use pipenv-run@v4.2.1 and refine conditional…
tboy1337 0b7de46
Refactor socket directory handling in test_executor.py and clean up t…
tboy1337 1b1ff4b
Fix formatting issues in PostgreSQL command templates and update test…
tboy1337 9c3aa4a
Update test assertions for PostgreSQL command formatting in test_exec…
tboy1337 e92879b
Add FreeBSD to platform parameterization in test_executor.py
tboy1337 9a8dc2b
Fixed trailing whitespace in single-postgres.yml and test_executor.py
tboy1337 400bddd
Refine pytest temporary directory handling in single-postgres.yml
tboy1337 a8d9dd6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] ba73005
Update test documentation for Windows UNC paths in test_windows_compa…
tboy1337 44fc97e
Remove editable package changes extracted to separate PR
tboy1337 e4d8699
Refactor command quoting in PostgreSQLExecutor for consistency
tboy1337 bd12358
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] e676a74
Enhance PostgreSQLExecutor to escape apostrophes in unixsocketdir
tboy1337 87abf24
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 52fb056
Fix CI for Windows support and align with main workflow conventions
tboy1337 8c37b21
Action fizyk review requests: split Windows CI and skip non-Windows t…
tboy1337 6b49ce6
Fix three Windows CI failures
tboy1337 494e093
Fix Windows restart timeout and macOS xdist race in executor tests
tboy1337 60fa1b9
Refactor executor test assertions for path quoting
tboy1337 5534379
Fix connection leak, tighten socket-dir assertion, fix Windows start
tboy1337 0210c89
Refine Windows start() and check_subprocess() in executor
tboy1337 9fac771
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] cc7fe02
Honor executor timeout in Windows start() path
tboy1337 d530337
Fix output leakage, cross-platform test coverage, and Windows start e…
tboy1337 c96148a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 7f7914b
Refactor Windows command handling in PostgreSQLExecutor
tboy1337 8ff792b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 5ddaf2d
Update shlex.split for POSIX compatibility and reset process attribut…
tboy1337 49419dc
Merge branch 'edit' of https://github.com/tboy1337/pytest-postgresql …
tboy1337 9ccaabd
Update artifact naming in GitHub Actions and adjust shlex.split for W…
tboy1337 fc14bdc
Enhance PostgreSQLExecutor with wait_for_postgres and timeout handling
tboy1337 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add Windows support for ``PostgreSQLExecutor``, including platform-specific start/stop handling. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
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:
actions/checkout@v6fizyk/actions-reuse/.github/actions/pipenv-setup@v4.4.4ankane/setup-postgres@v1fizyk/actions-reuse/.github/actions/pipenv-run@v4.4.4actions/upload-artifact@v7codecov/codecov-action@v6.0.0Suggested update pattern
🤖 Prompt for AI Agents
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Unrecoverable error: Failed to clone repository
🏁 Script executed:
Length of output: 101
🏁 Script executed:
Length of output: 340
@fizyk, confirmed —.github/dependabot.ymlonmainalready haspackage-ecosystem: github-actionsconfigured (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?There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Length of output: 60
@fizyk, I've opened issue#1331to track the initial pinning. You're right that with Dependabot + auto-merge the ongoing maintenance is largely hands-off — the main practical benefit is thatankane/setup-postgresupdates will show up as explicit PRs rather than silently picking up whatever the tag points to.