refactor(tests): parametrize and harden transport branching tests for main.py#231
Merged
bashandbone merged 4 commits intotest-conditional-branches-main-run-11527433060213632688from Mar 16, 2026
Conversation
…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
Contributor
There was a problem hiding this comment.
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
AsyncMockpatching.
💡 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>
cc1c3e8
into
test-conditional-branches-main-run-11527433060213632688
6 checks passed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Review feedback on the original
test_main.pyidentified two issues: duplicate test functions and brittleassert_called_once_with(...)assertions that would break on any incidental call signature change.Changes
Parametrized: Collapsed
test_run_stdio_transportandtest_run_streamable_http_transportinto a singletest_run_dispatches_to_correct_serverparametrized over transport cases — new transports require onepytest.paramentry.Focused assertions: Replaced
assert_called_once_with(all_kwargs)withassert_called_once()+ targetedcall_args.kwargschecks on only the semantically meaningful routing parameters (host,port).from __future__ import annotations, andpytestmark = [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.