Repository navigation
Open
Labels
pythonUsage: [Issues, PRs], Target: PythonUsage: [Issues, PRs], Target: Pythonready-for-implementationMaintainers agree the problem and direction are ready for implementation.Maintainers agree the problem and direction are ready for implementation.
Description
Description
python/tests/samples can't be collected on main. Four of its six test modules import sample files that no longer exist:
$ uv run pytest tests/samples --collect-only -q
ERROR tests/samples/getting_started/test_agent_samples.py
ERROR tests/samples/getting_started/test_chat_client_samples.py
ERROR tests/samples/getting_started/test_threads_samples.py
ERROR tests/samples/hosting/test_toolbox_endpoint.py - FileNotFoundError: [Errno 2] No such file or directory: '.../responses/04_foundry_toolbox/main.py'
!!!!!!!!!!!!!!!!!!! Interrupted: 4 errors during collection !!!!!!!!!!!!!!!!!!!!
getting_started/*.py(56 imports) importsamples.getting_started.agents.*,samples.getting_started.client.*andsamples.getting_started.threads.*. That tree was replaced by the01-get-started…05-end-to-endlayout in Python: restructure: Python samples into progressive 01-05 layout #3862. Several of the referenced samples also use clients that were later removed, such as the Azure assistants clients removed in Python: [BREAKING] Remove deprecated Python OpenAI/Azure AI surfaces #4990. Every import fails withModuleNotFoundError: No module named 'samples.getting_started'.hosting/test_toolbox_endpoint.pyloads04_foundry_toolbox/main.pyand06_files/main.py. Python: Remove indices in FHA sample names #7405 renamed those folders, and the samples no longer defineresolve_toolbox_endpoint. The resolver now lives inagent_framework_foundry_hosting._toolbox._resolve_toolbox_endpoint, andpackages/foundry_hosting/tests/test_toolbox.pytests it.
Pytest stops the whole session on collection errors. So the "Test OpenAI samples" and "Test Azure samples" steps in python-merge-tests.yml (uv run pytest tests/samples/ -m "openai" / -m "azure", gated on RUN_SAMPLES_TESTS) can't run any test, including the two modules that still collect.
Expected behavior
pytest tests/samples collects. The sample integration tests either target samples that exist or are removed.
Proposed fix
hosting/test_toolbox_endpoint.py: delete it. Its cases are covered bypackages/foundry_hosting/tests/test_toolbox.py, and I'm porting the one extra case (several trailing slashes on the project endpoint). I have a PR for this part.getting_started/*.py: this needs a maintainer decision. Either repoint the tests at the current01-get-started/02-agentssamples, or delete them if the sample integration tests aren't maintained any more. I'm happy to do either.
Package Versions
main at c4de86d
Python Version
3.13
AI Assistance
Claude Code helped find this while checking which sample files the tests reference, and helped draft this report. I reproduced the collection errors locally.
Metadata
Metadata
Labels
pythonUsage: [Issues, PRs], Target: PythonUsage: [Issues, PRs], Target: Pythonready-for-implementationMaintainers agree the problem and direction are ready for implementation.Maintainers agree the problem and direction are ready for implementation.
Type
Projects
- StatusShow more project fieldsNo status
Activity
eavanvalkenburg commentedon Nov 2, 2026
Could you provide a coverage map for the three remaining getting_started test modules, separating cases that map to current maintained samples from cases whose APIs/samples were intentionally removed? That would let us choose repointing versus retirement without silently losing supported-scenario coverage. Existing #9762 is explicitly the hosting-only part and does not resolve those three collection failures.
Wilson0511 commentedon Nov 11, 2026
Here is the coverage map for
python/tests/sampleson currentmain(@ b193c1b), built by parsing all 56 parametrized cases in the threegetting_startedmodules and resolving each against the currentsamples/tree.hosting/test_toolbox_endpoint.py— no longer testable as writtenThe module tests
resolve_toolbox_endpoint()in04_foundry_toolbox/main.pyand06_files/main.py. Neither function exists anymore: after the #7405 rename the directories areresponses/foundry_toolbox/andresponses/files/, and bothmain.pyfiles were rewritten to build aFoundryToolbox(credential)insidecreate_agent()— no local endpoint-resolution helper. That logic now lives in the product package and is already covered bypython/packages/foundry_hosting/tests/test_toolbox.py(_resolve_toolbox_endpoint, lines 42/329-350). Disposition: delete the module; coverage is subsumed by the package tests.getting_startedmodules — 56 param cases(A) 38 cases map to a maintained sample that exists today (each target verified to still define
main):agents.openai.openai_responses_client_*02-agents/providers/openai/client_{basic,reasoning,with_code_interpreter,with_explicit_settings,with_file_search,with_function_tools,with_local_mcp,with_session,with_web_search}agents.openai.openai_chat_client_*02-agents/providers/openai/chat_completion_client_{basic,with_explicit_settings,with_function_tools,with_local_mcp,with_session,with_web_search}agents.azure_ai.azure_ai_*02-agents/providers/foundry/foundry_agent_basic,foundry_chat_client_{with_code_interpreter,with_local_mcp,with_session}(_with_thread→with_session)agents.azure_openai.azure_responses_client_*02-agents/providers/azure/openai_client_{basic,with_function_tools,with_session}agents.azure_openai.azure_chat_client_*02-agents/providers/azure/openai_chat_completion_client_{basic,with_explicit_settings,with_function_tools,with_session}client.*(non-assistants)02-agents/providers/{openai,azure}/…client_basic,foundry_chat_client_basic,chat_client/chat_response_cancellationthreads.*02-agents/conversations/{custom_history_provider,suspend_resume_session}agents.openai.azure_ai_basicetc.(B) 15 cases reference removed assistants clients —
azure_assistants_*(6),openai_assistants_*(7),client.{azure,openai}_assistants_client(2). The assistants client family was removed in #4990 and has no maintained successor sample. Disposition: drop these param cases.(C) 3 cases have no current equivalent:
agents.azure_openai.azure_responses_client_with_code_interpreterand…_with_explicit_settings— the Azure Responses-API variants were never recreated underproviders/azure/(onlyopenai_client_{basic,with_function_tools,with_session,with_structured_output}exist). Disposition: either drop, or cover via the plain-openaiequivalents.agents.azure_ai.azure_ai_with_function_tools— the test importsmixed_tools_example/tools_on_agent_level/tools_on_run_level; today'sfoundry_agent_with_function_tools.pydefines a different surface. Disposition: re-point tofoundry_agent_with_function_tools.mainand rewrite the case, or drop.Caveat + proposal
The map above is filename/symbol-level. Re-pointing (A) still needs each case's mocked-response list re-checked against the new samples' actual call sequences — the old recorded responses were written against the removed API shapes. I'm happy to take this issue: re-point the 38 (A) cases with refreshed mocks, drop the 15 (B) and 2–3 (C) cases per your preference, delete the hosting module, and get
pytest tests/samples --collect-onlygreen again.🤖 This analysis was prepared with AI assistance (ZCode); publishing was confirmed by the human author.
Co-Authored-By: ZCode noreply@zcode.local