Repository navigation
Python: fix(python): fix tests/samples collection for missing sample imports - #10235
Open
pratik wayase (PratikWayase) wants to merge 1 commit into
Open
pratik wayase (PratikWayase) wants to merge 1 commit into
pratik wayase (PratikWayase) wants to merge 1 commit into
Conversation
pratik wayase (PratikWayase)
deployed
to
github-app-auth
November 10, 2026 15:06 — with
GitHub Actions
Active
pratik wayase (PratikWayase)
deployed
to
github-app-auth
November 10, 2026 15:06 — with
GitHub Actions
Active
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The deletions leave CI steps filtering for nonexistent openai/azure-marked sample tests, causing both commands to fail with pytest exit code 5 when RUN_SAMPLES_TESTS=true.
No open issues 🎉
What changed in this PR
Fixes Python sample-test collection failures from #9761 by removing tests that import retired or renamed samples. Preserves the remaining toolbox endpoint edge case in the Foundry hosting package tests, incorporating the scope of #9762.
Changes:
- Deletes three obsolete getting-started test modules and the stale hosting endpoint test module.
- Parametrizes the package resolver test for zero, one, and three trailing slashes.
- Changes tests only; product code is unchanged.
| File | Description |
|---|---|
python/tests/samples/hosting/test_toolbox_endpoint.py |
Removes tests loading renamed samples and an obsolete resolver. |
python/tests/samples/getting_started/test_threads_samples.py |
Removes tests importing retired thread samples. |
python/tests/samples/getting_started/test_chat_client_samples.py |
Removes tests importing obsolete client samples. |
python/tests/samples/getting_started/test_agent_samples.py |
Removes tests importing obsolete agent samples. |
python/packages/foundry_hosting/tests/test_toolbox.py |
Adds trailing-slash variants to endpoint resolution coverage. |
Review effort: Balanced
This branch was successfully deployed
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.
Motivation & Context
python/tests/samplesfails to collect on main (#9761): four test modules import samples that no longer exist the threegetting_startedmodules use the tree removed by the 01–05 restructure (#3862, plus Assistants clients removed in #4990), andhosting/test_toolbox_endpoint.pyloads samples renamed in #7405. Collection errors abort the whole pytest session, so no test intests/samplescan run.Description & Review Guide
Major changes
getting_startedtest modules (56 parametrized cases, allRUN_SAMPLES_TESTS-gated, never running due to the collection failure).hosting/test_toolbox_endpoint.py; the resolver it tested is covered bypackages/foundry_hosting/tests/test_toolbox.py.test_resolve_endpoint_builds_from_project_and_nameas a 3-variant parametrization, matching draft Python: Remove the stale hosted toolbox endpoint sample test #9762 (co-author credit).Impact
uv run pytest tests/samples --collect-only -q: 4 collection errors → 14 tests, 0 errors.uv run pytest packages/foundry_hosting/tests/test_toolbox.py -q: 180 passed.openai/azuremarkers, so the "Test OpenAI/Azure samples" CI steps will collect 0 tests (exit 5) happy to fix those in a follow-up.Reviewer focus
Coverage map
getting_started/test_agent_samples.pyazure, 9azure_ai, 22openaigetting_started/test_chat_client_samples.pyazure, 1azure_ai, 3openaigetting_started/test_threads_samples.pyopenaihosting/test_toolbox_endpoint.pytest_toolbox.py, trailing-slash case portedRelated Issue
Fixes #9761
#9762 (draft) covered only the hosting part; per maintainer direction this PR folds it in, with Naveen Chatlapalli (@1aifanatic) credited as co-author. #9762 can be closed in favor of this PR.
AI Assistance
AI assistance details: draft this description. Verify the fix locally; all changes were reviewed and tested by me.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.