Skip to content

Add Windows Compatibility#1

Merged
aliciusschroeder merged 25 commits intoaliciusschroeder:mainfrom
tboy1337:edit
Feb 18, 2026
Merged

Add Windows Compatibility#1
aliciusschroeder merged 25 commits intoaliciusschroeder:mainfrom
tboy1337:edit

Conversation

@aliciusschroeder
Copy link
Copy Markdown
Owner

tboy1337 and others added 25 commits January 29, 2026 12:46
…ess management

- Convert _get_base_command method to BASE_PROC_START_COMMAND class attribute

- Use unified command format without single quotes around PostgreSQL config values

- Add _windows_terminate_process method for graceful Windows process termination

- Update stop() method to use list args instead of shell=True for security

- Add platform-specific termination logic with killpg fallback

- Add comprehensive Windows compatibility test suite

- Rename parameter in _windows_terminate_process method for clarity
…environment variable usage

- Added detection of PostgreSQL path for Windows runners.
- Set PostgreSQL path for Unix/macOS environments.
- Updated test commands to utilize the dynamically set PostgreSQL executable path.
- Introduced new Windows job configurations for PostgreSQL versions 16, 17, and 18 in tests.yml.
- Removed unnecessary import in conftest.py as the plugin is registered via entry point.
…compatibility

- Implement dynamic detection of pg_ctl path for Unix/macOS environments in the GitHub Actions workflow.
- Add logging for exception handling during Windows process termination in PostgreSQLExecutor.
- Update test mocks to reference the correct subprocess path for better compatibility.
- Remove unnecessary import in conftest.py to streamline the codebase.
- Reintroduce logger initialization in executor.py for improved logging.
- Remove unnecessary pass statement in exception handling within the stop method.
- Update test assertions to ensure correct subprocess call format for Windows compatibility.
- Temporarily modify os.killpg attribute in tests to validate fallback behavior on Windows termination.
… test assertions

- Add timeout handling for process cleanup in the stop method to prevent zombie processes.
- Update test to assert correct argument usage for mock_terminate in Windows compatibility tests.
- Added steps to install the package in editable mode before running tests in dockerised-postgres.yml, oldest-postgres.yml, and single-postgres.yml.
- Streamlined the testing process by ensuring the package is available in the current environment for all workflows.
- Modified the package installation command to include the --no-deps flag, ensuring that only the editable package is installed without its dependencies before running tests.
- Added verification step to ensure pg_ctl is found in expected locations during the GitHub Actions workflow for single-postgres.yml.
- Implemented error logging and exit strategy if PostgreSQL is not detected, improving robustness of the setup process.
- Introduced separate command templates for Unix and Windows to handle quoting and configuration differences.
- Updated tests to validate the correct command template is used based on the operating system.
- Enhanced test coverage for command formatting, ensuring proper handling of paths with spaces on Unix and omission of unnecessary parameters on Windows.
- Updated the pg_ctl path in single-postgres.yml to include the .exe extension for compatibility with Windows environments, ensuring proper execution of PostgreSQL commands.
- Changed the conftest file generation to use a more explicit pytest_plugins declaration for better clarity and compatibility with pytest's plugin system.
…for improved clarity

- Changed the pytest_plugins declaration in the conftest file generation to specify the plugin path explicitly, enhancing compatibility with pytest's plugin system.
…tgreSQLExecutor

- Added tests to verify correct command templates for Windows, Unix, and Darwin platforms, ensuring proper handling of `unix_socket_directories` and `log_destination`.
- Implemented checks for locale settings on Darwin and preserved quoting for `postgres_options` across different platforms.
- Improved test assertions for command generation with special characters and empty parameters, enhancing overall test robustness.
…andling

- Introduced a pytest fixture to set Windows-compatible locale environment variables, ensuring compatibility with PostgreSQL's initdb on Windows.
- Updated test cases for PostgreSQL start commands across Windows, Unix, and Darwin platforms to include a password parameter, enhancing test coverage and consistency.
… fixture from conftest.py

- Modified locale settings in executor.py to ensure compatibility across Darwin and Windows platforms.
- Removed the Windows locale setup fixture from conftest.py as the locale handling is now managed directly in executor.py, simplifying the test configuration.
…Executor

- Updated the test case to create a dedicated socket directory for Unix systems, improving clarity and organization in the test setup.
- Adjusted the path for the `unixsocketdir` parameter to use the newly created socket directory, ensuring proper configuration for PostgreSQLExecutor.
- Modified the upload path for pytest results to include both the temporary runner directory and a specific /tmp directory, ensuring comprehensive coverage of test artifacts during the workflow execution.
…etemp for improved temporary directory handling

- Added the --basetemp option to pytest commands to specify a base temporary directory, enhancing the management of test artifacts during execution.
- Simplified the upload path for pytest results to focus on the temporary runner directory, ensuring efficient artifact collection.
…t collection

- Simplified the upload path for pytest results by removing the specific wildcard in the temporary directory, ensuring more efficient collection of test artifacts during the workflow execution.
Resolved conflict in .github/workflows/dockerised-postgres.yml by keeping the three-step workflow approach from edit branch and updating pipenv-setup action version to v4.2.1 to match main branch updates.

The resolution maintains consistency with other workflow files (oldest-postgres.yml and single-postgres.yml) which use the same pattern:
- pipenv-setup@v4.2.1 for environment setup
- pipenv-run@v4.1.1 for package installation and test execution

Co-authored-by: Cursor <cursoragent@cursor.com>
Upgraded fizyk/actions-reuse pipenv-setup action from v4.2.1 to v4.4.0 which includes built-in support for editable package installation via the editable flag. This simplifies the workflows by removing the explicit pip install -e . steps.

Changes:
- Updated pipenv-setup to v4.4.0 in all workflow files
- Added editable: true parameter to pipenv-setup steps
- Removed separate "Install package in editable mode" steps from dockerised-postgres.yml, single-postgres.yml, and oldest-postgres.yml

This aligns with the upstream pattern established in pytest-mongo and reduces workflow complexity while maintaining the same functionality.

Co-authored-by: Cursor <cursoragent@cursor.com>
… checks

- Upgraded the pipenv-run action to v4.2.1 in dockerised-postgres.yml, single-postgres.yml, and oldest-postgres.yml for consistency across workflows.
- Refined the conditional check for installing libpq to use matrix.python-version instead of inputs.python-versions in oldest-postgres.yml and single-postgres.yml, improving clarity and accuracy.

These changes enhance the maintainability and consistency of the workflow configurations.
@aliciusschroeder aliciusschroeder changed the title Edit Add Windows Compatibility Feb 18, 2026
@aliciusschroeder aliciusschroeder marked this pull request as ready for review February 18, 2026 13:17
@aliciusschroeder aliciusschroeder merged commit b884e02 into aliciusschroeder:main Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants