Skip to content

Conversation

@Nikhil172913832
Copy link
Contributor

@Nikhil172913832 Nikhil172913832 commented Nov 12, 2025

Pre-flight checklist

Summary

This PR fixes Windows CI failures by refactoring tests/test_match.py to use threading instead of subprocess for starting the Flask provider server. The threading approach matches the pattern used in examples/http/aiohttp_and_flask/test_provider.py and avoids Windows-specific subprocess issues with stderr/stdout buffering and process handling.

Additionally, this re-enables 61 previously disabled compatibility suite tests that were skipped on Windows due to this issue.

Motivation

Issue #639 identified that provider tests fail on Windows because the Flask server started via subprocess.Popen cannot be reached. The subprocess approach has known issues on Windows with:

  • Stderr/stdout buffering differences
  • Process pipe handling
  • URL extraction via regex from stderr

The threading approach eliminates these platform-specific issues and uses pact._util.find_free_port() for dynamic port allocation as requested by maintainers.

Test Plan

  • The refactored code follows the exact pattern from existing working examples
  • All previously disabled Windows tests have been re-enabled
  • CI will validate on Windows with Python 3.10, 3.11, 3.12, and 3.13

🔗 Related issues/PRs

Copilot AI review requested due to automatic review settings November 12, 2025 06:42
Copilot finished reviewing on behalf of Nikhil172913832 November 12, 2025 06:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes Windows CI failures by refactoring the Flask provider server startup mechanism from subprocess to threading. The change addresses platform-specific issues with subprocess handling on Windows (stderr/stdout buffering, pipe handling) by adopting the threading pattern already used successfully in examples/http/aiohttp_and_flask/test_provider.py. Additionally, it re-enables 61 compatibility suite tests that were previously disabled on Windows.

Key Changes

  • Replaced subprocess-based Flask server startup with thread-based approach in tests/test_match.py
  • Implemented dynamic port allocation using pact._util.find_free_port()
  • Removed Windows-specific test skips across compatibility suite test files (V1-V4 provider and message tests)

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/test_match.py Refactored start_provider() to use threading instead of subprocess, eliminating Windows-specific server startup issues
tests/compatibility_suite/test_v1_provider.py Removed @pytest.mark.skipif decorators for Windows, re-enabling 28 provider tests
tests/compatibility_suite/test_v2_provider.py Removed Windows skip decorators, re-enabling 4 V2 provider tests
tests/compatibility_suite/test_v3_provider.py Removed Windows skip decorators, re-enabling 2 V3 provider tests
tests/compatibility_suite/test_v3_message_producer.py Removed Windows skip decorators, re-enabling 19 V3 message provider tests
tests/compatibility_suite/test_v3_http_matching.py Removed Windows skip decorators, re-enabling 8 V3 HTTP matching tests
tests/compatibility_suite/test_v4_provider.py Removed Windows skip decorators, re-enabling 2 V4 provider tests
tests/compatibility_suite/test_v4_message_provider.py Removed Windows skip decorators, re-enabling 2 V4 message provider tests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Nikhil172913832
Copy link
Contributor Author

The CI failure is caused by a port already in use in an unrelated test. All Windows provider tests now pass with the threading fix.

@JP-Ellis JP-Ellis enabled auto-merge (squash) November 12, 2025 23:55
Copy link
Contributor

@JP-Ellis JP-Ellis left a comment

Choose a reason for hiding this comment

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

Awesome work! Very neat 🚀

@JP-Ellis JP-Ellis disabled auto-merge November 12, 2025 23:56
@JP-Ellis JP-Ellis merged commit f71f304 into pact-foundation:main Nov 12, 2025
143 of 150 checks passed
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.

[CI] Windows Provider Unreachable

2 participants