dev/microsft-agents-testing polish - #480
Conversation
There was a problem hiding this comment.
Pull request overview
This PR focuses on polishing the dev/microsoft-agents-testing package by applying broad, consistent formatting updates (imports, line wrapping, whitespace) across the library, CLI, and tests, with a couple of small typing/annotation touch-ups.
Changes:
- Normalize formatting across testing utilities, fluent predicate/selection code, CLI commands, and extensive test coverage (primarily import grouping and line wrapping).
- Minor type/annotation improvements (e.g., more precise generics/return types in fluent selection utilities).
- CLI option declarations were reformatted, but currently leave an inconsistency around
--json_filevs--json-file(see PR comments).
Reviewed changes
Copilot reviewed 84 out of 103 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| dev/microsoft-agents-testing/tests/utils/test_pred.py | Test formatting/line wrapping cleanup |
| dev/microsoft-agents-testing/tests/utils/test_poll.py | Test formatting/line wrapping cleanup |
| dev/microsoft-agents-testing/tests/test_transcript_formatter.py | Import wrapping + test formatting cleanup |
| dev/microsoft-agents-testing/tests/test_source_scenario.py | Test formatting cleanup (patch context manager wrapping, asserts) |
| dev/microsoft-agents-testing/tests/test_scenario_registry.py | Test formatting cleanup (blank lines, string literals, raises formatting) |
| dev/microsoft-agents-testing/tests/test_scenario_registry_plugin.py | Test whitespace/blank-line normalization |
| dev/microsoft-agents-testing/tests/test_pytest_plugin.py | Test whitespace/blank-line normalization |
| dev/microsoft-agents-testing/tests/test_aiohttp_scenario.py | Test formatting cleanup (raises formatting) |
| dev/microsoft-agents-testing/tests/test_aiohttp_scenario_integration.py | Test formatting cleanup + minor literal normalization |
| dev/microsoft-agents-testing/tests/manual.py | Whitespace cleanup in manual test script |
| dev/microsoft-agents-testing/tests/core/transport/transcript/test_transcript.py | Test whitespace/line wrapping cleanup |
| dev/microsoft-agents-testing/tests/core/transport/transcript/test_exchange.py | Test formatting cleanup + line wrapping |
| dev/microsoft-agents-testing/tests/core/transport/test_aiohttp_sender.py | Test formatting cleanup (spacing/line wrapping) |
| dev/microsoft-agents-testing/tests/core/transport/test_aiohttp_callback_server.py | Test formatting cleanup + minor dict literal trailing commas |
| dev/microsoft-agents-testing/tests/core/test_type_defs.py | Remove trailing whitespace line |
| dev/microsoft-agents-testing/tests/core/fluent/test_select.py | Test formatting cleanup (blank line) |
| dev/microsoft-agents-testing/tests/core/fluent/test_model_template.py | Import wrapping + test formatting cleanup |
| dev/microsoft-agents-testing/tests/core/fluent/backend/types/test_unset.py | Test whitespace cleanup |
| dev/microsoft-agents-testing/tests/core/fluent/backend/types/test_readonly.py | Test whitespace cleanup |
| dev/microsoft-agents-testing/tests/core/fluent/backend/test_transform.py | Test formatting cleanup (blank lines + dict literal wrapping) |
| dev/microsoft-agents-testing/tests/core/fluent/backend/test_model_predicate.py | Test formatting cleanup (blank lines + wrapping) |
| dev/microsoft-agents-testing/tests/core/fluent/backend/test_describe.py | Import wrapping + test formatting cleanup |
| dev/microsoft-agents-testing/tests/cli/test_output.py | Whitespace cleanup in commented-out tests |
| dev/microsoft-agents-testing/tests/cli/test_cli_integration.py | Whitespace cleanup in commented-out tests |
| dev/microsoft-agents-testing/microsoft_agents/testing/utils/send.py | Docstring whitespace cleanup + spacing normalization |
| dev/microsoft-agents-testing/microsoft_agents/testing/utils/poll.py | Formatting cleanup + trailing whitespace removal |
| dev/microsoft-agents-testing/microsoft_agents/testing/source_scenario.py | Formatting cleanup (args, list literal wrapping) |
| dev/microsoft-agents-testing/microsoft_agents/testing/scenario_registry.py | Docstring whitespace cleanup + formatting/line wrapping |
| dev/microsoft-agents-testing/microsoft_agents/testing/pytest_plugin.py | Formatting cleanup (blank lines/indentation) |
| dev/microsoft-agents-testing/microsoft_agents/testing/presets/localhost/e2e-tests/tests/test_my_agent.py | Whitespace cleanup in preset test |
| dev/microsoft-agents-testing/microsoft_agents/testing/presets/localhost/e2e-tests/tests/init.py | Whitespace cleanup |
| dev/microsoft-agents-testing/microsoft_agents/testing/presets/basic/e2e-tests/tests/test_my_agent.py | Whitespace cleanup in preset test |
| dev/microsoft-agents-testing/microsoft_agents/testing/presets/basic/e2e-tests/tests/init.py | Whitespace cleanup |
| dev/microsoft-agents-testing/microsoft_agents/testing/formatting/utils.py | Docstring whitespace cleanup |
| dev/microsoft-agents-testing/microsoft_agents/testing/formatting/transcript_formatter.py | Formatting cleanup (blank line, trailing spaces) |
| dev/microsoft-agents-testing/microsoft_agents/testing/formatting/print.py | Formatting cleanup (blank lines, trailing spaces) |
| dev/microsoft-agents-testing/microsoft_agents/testing/formatting/json_transcript_formatter.py | Line wrapping for list comprehension |
| dev/microsoft-agents-testing/microsoft_agents/testing/formatting/conversation_transcript_formatter.py | Import simplification + line wrapping |
| dev/microsoft-agents-testing/microsoft_agents/testing/formatting/activity_transcript_formatter.py | Line wrapping for list comprehension |
| dev/microsoft-agents-testing/microsoft_agents/testing/formatting/init.py | Import formatting + __all__ formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/utils.py | Formatting cleanup + line wrapping |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/type_defs.py | Add copyright header + spacing/blank line normalization |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/transport/transcript/transcript.py | Docstring whitespace cleanup + trailing spaces |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/transport/transcript/exchange.py | Formatting cleanup + minor wrapping |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/transport/transcript/init.py | __all__ formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/transport/sender.py | Method signature formatting (line wrapping) |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/transport/callback_server.py | Method signature formatting + trailing whitespace cleanup |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/transport/aiohttp_sender.py | Formatting cleanup + clearer exception raising formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/transport/aiohttp_callback_server.py | Formatting cleanup (signature wrapping, response creation) |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/transport/init.py | __all__ formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/scenario.py | Docstring whitespace cleanup + method signature wrapping |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/fluent/utils.py | Whitespace cleanup + minor formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/fluent/select.py | Formatting fixes + improved get() return type annotation |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/fluent/model_template.py | Formatting cleanup (signature wrapping, boolean expression wrapping) |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/fluent/expect.py | Import cleanup + docstring clarifications + formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/fluent/backend/utils.py | Formatting cleanup + clearer multi-line errors |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/fluent/backend/types/unset.py | Whitespace cleanup + singleton declaration formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/fluent/backend/types/safe_object.py | Formatting cleanup (blank lines, docstrings) |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/fluent/backend/types/readonly.py | Formatting cleanup + line wrapping |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/fluent/backend/types/init.py | __all__ formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/fluent/backend/transform.py | Formatting cleanup + minor constant normalization |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/fluent/backend/quantifier.py | Protocol signature formatting + blank line normalization |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/fluent/backend/model_predicate.py | Formatting cleanup + minor internal typing fix |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/fluent/backend/describe.py | Formatting cleanup + line wrapping |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/fluent/backend/init.py | __all__ formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/fluent/init.py | __all__ formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/external_scenario.py | Docstring whitespace cleanup + minor formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/config.py | Docstring whitespace cleanup + blank line normalization |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/_aiohttp_client_factory.py | Docstring whitespace cleanup + formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/core/init.py | __all__ formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/scenarios/basic_scenario.py | Formatting cleanup + blank line normalization |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/scenarios/auth_scenario.py | Formatting cleanup (wrapping long strings/calls) |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/scenarios/init.py | Formatting cleanup (list literal wrapping) |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/main.py | Formatting cleanup (click option layout + register loop wrapping) |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/core/utils.py | Formatting cleanup; contains outdated comment needing update |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/core/output.py | Formatting cleanup + minor wrapping |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/core/decorators.py | Formatting cleanup (click option layout + spacing) |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/core/cli_config.py | Formatting cleanup + map literal wrapping |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/core/init.py | __all__ formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/commands/scenario/scenario_group.py | Formatting cleanup |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/commands/scenario/_utils.py | Formatting cleanup; error strings need flag-name alignment |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/commands/scenario/_run.py | Import formatting + error message wrapping |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/commands/scenario/_post.py | Click option formatting; currently inconsistent flag naming vs docs/messages |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/commands/scenario/_load.py | Click option formatting; currently inconsistent flag naming vs docs/messages |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/commands/scenario/_list.py | Import formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/commands/scenario/_chat.py | Formatting cleanup (wrapping long click.secho calls) |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/commands/scenario/init.py | __all__ formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/commands/init.py | Formatting cleanup (option wrapping + info output wrapping) |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/commands/environment/env_group.py | Formatting cleanup |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/commands/environment/_show.py | Formatting cleanup |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/commands/environment/_help.py | Formatting cleanup + wrapping long string |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/commands/environment/init.py | __all__ formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/commands/env.py | Formatting cleanup |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/commands/init.py | __all__ formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/cli/init.py | __all__ formatting |
| dev/microsoft-agents-testing/microsoft_agents/testing/aiohttp_scenario.py | Import wrapping + formatting cleanup |
| dev/microsoft-agents-testing/microsoft_agents/testing/init.py | Trailing comma normalization + __all__ formatting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… through an exception' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 84 out of 103 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (3)
dev/microsoft-agents-testing/microsoft_agents/testing/cli/commands/scenario/_post.py:33
- The CLI help/docstring refer to
--json-file, but the actual Click option is registered as--json_file. This is a breaking UX/API change and makes the guidance in_utils.load_activity()(which errors with--json-file) incorrect. Consider using the conventional hyphenated flag name and keep the Python parameter namejson_filevia the third argument.
@click.option(
"--message", "-m", required=False, help="Text message to send to the agent."
)
@click.option(
"--json_file",
"-j",
"json_file",
required=False,
type=click.File("rb"),
help="JSON activity to send to the agent.",
)
dev/microsoft-agents-testing/microsoft_agents/testing/cli/commands/scenario/_load.py:128
- For consistency with other CLI flags (which are hyphenated) and to match the user-facing guidance in
_utils.load_activity()(--json-file), this option should be exposed as--json-filerather than--json_file. Click can still bind it to thejson_fileparameter via the third argument.
@click.option(
"--json_file",
"-j",
required=False,
type=click.File("rb"),
help="JSON activity to send to the agent.",
)
dev/microsoft-agents-testing/microsoft_agents/testing/cli/commands/scenario/_load.py:152
- If this command’s option is exposed as
--json-file, the docstring should match the public flag name (right now it documents--json_file).
"""Run a concurrent load test against an agent and report latency statistics.
Sends the same message or activity to the agent ``--num`` times concurrently
This pull request focuses on improving code readability, consistency, and maintainability across the CLI commands and testing utilities for the Microsoft Agents Testing framework. The changes primarily involve reformatting code for clarity, standardizing naming conventions, and breaking up long lines for better readability. No functional or behavioral changes are introduced.
Code formatting and readability improvements:
Reformatted long import statements and function calls to use one-per-line or multi-line formatting for better readability in files such as
aiohttp_scenario.py,init.py,env.py,_help.py,_show.py,_chat.py,_list.py,_load.py, and_post.py. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25]Broke up long lines and improved error messages for clarity, such as multi-line error raising and multi-line info messages. [1] [2] [3] [4] [5]
Naming and consistency:
--json_fileinstead of--json-file) for consistency across commands.Minor code cleanup:
Module export and import fixes:
__init__.pyto maintain correct module exports. [1] [2]These changes collectively make the codebase easier to read and maintain, especially for future contributors. No logic or features have been altered.