Skip to content

refactor(tests): parametrize and harden transport branching tests for main.py#231

Merged
bashandbone merged 4 commits intotest-conditional-branches-main-run-11527433060213632688from
copilot/sub-pr-225
Mar 16, 2026
Merged

refactor(tests): parametrize and harden transport branching tests for main.py#231
bashandbone merged 4 commits intotest-conditional-branches-main-run-11527433060213632688from
copilot/sub-pr-225

Conversation

Copy link
Contributor

Copilot AI commented Mar 16, 2026

Review feedback on the original test_main.py identified two issues: duplicate test functions and brittle assert_called_once_with(...) assertions that would break on any incidental call signature change.

Changes

  • Parametrized: Collapsed test_run_stdio_transport and test_run_streamable_http_transport into a single test_run_dispatches_to_correct_server parametrized over transport cases — new transports require one pytest.param entry.

  • Focused assertions: Replaced assert_called_once_with(all_kwargs) with assert_called_once() + targeted call_args.kwargs checks on only the semantically meaningful routing parameters (host, port).

mock_expected.assert_called_once()
kwargs = mock_expected.call_args.kwargs
assert kwargs.get("host") == host
assert kwargs.get("port") == port
mock_other.assert_not_called()
  • Style compliance: Added SPDX header, module docstring, from __future__ import annotations, and pytestmark = [pytest.mark.unit].

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Copilot AI and others added 2 commits March 16, 2026 13:20
…test_main.py

Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com>
Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com>
Copilot AI changed the title [WIP] [1152743306021] Add tests for conditional branches in main.py run() refactor(tests): parametrize and harden transport branching tests for main.py Mar 16, 2026
Copilot AI requested a review from bashandbone March 16, 2026 13:25
@bashandbone bashandbone marked this pull request as ready for review March 16, 2026 13:57
Copilot AI review requested due to automatic review settings March 16, 2026 13:57
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

Updates the unit tests for codeweaver.main.run() to follow repository test header conventions and to reduce duplication while still validating transport-based dispatch.

Changes:

  • Added SPDX headers, module docstring, and pytestmark = [pytest.mark.unit] to align with unit-test conventions.
  • Refactored two transport-specific tests into a single parametrized async test using AsyncMock patching.

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

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com>
@bashandbone bashandbone merged commit cc1c3e8 into test-conditional-branches-main-run-11527433060213632688 Mar 16, 2026
6 checks passed
@bashandbone bashandbone deleted the copilot/sub-pr-225 branch March 16, 2026 15:57
@bashandbone bashandbone restored the copilot/sub-pr-225 branch March 16, 2026 15:57
@bashandbone bashandbone deleted the copilot/sub-pr-225 branch March 16, 2026 15:57
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.

3 participants