test: merge three stranded twins into the files that shadow them - #37600
Conversation
Greptile SummaryThe PR consolidates previously uncollected duplicate tests into the active test tree and updates the coverage allowlist. The follow-up adds an environment-isolation fixture that clears every OCI environment fallback used by the affected credential-validation and URL-generation paths.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| tests/test_litellm/llms/oci/chat/test_oci_chat_transformation.py | Adds the merged OCI coverage and clears all seven environment variables consulted by OCI credential resolution, resolving the prior nondeterminism. |
| tests/test_litellm/llms/deepseek/chat/test_deepseek_chat_transformation.py | Consolidates the stranded DeepSeek tests and aligns the disabled-thinking assertion with the handler’s current mapping. |
| tests/test_litellm/proxy/management_endpoints/test_common_utils.py | Consolidates helper and premium-field behavior tests into the actively collected suite. |
| .github/ci-coverage-allowlist.yml | Removes the three consolidated test files from the allowlist and documents why the sole remaining duplicate is still exempt. |
Reviews (2): Last reviewed commit: "test(oci): stop the OCI suite reading cr..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Fixed the ambient OCI env issue with a fixture, and applied it to TestOCIChatConfig which had the same latent dependency. @greptileai |
The second mirror's last four files each share a filename with a live test, so
the previous commit could not move them. Three of the four turn out to be plain
additions: their classes collide with nothing in the live file, so the tests are
extra coverage that has sat unrun rather than a competing version of anything.
Appending them takes the three files from 156 collected tests to 196, and all
196 pass. The 40 recovered are 13 OCI cases covering key normalization,
credential validation, complete-URL building and image-url transformation, 15
management-endpoint cases covering empty-value handling and the premium check,
and 12 DeepSeek thinking-parameter cases.
One assertion had to change. test_map_reasoning_effort_none_does_not_enable_thinking
asserted that reasoning_effort='none' leaves no thinking key, while the handler
maps it to {'type': 'disabled'} on purpose, documented in map_openai_params as
the OpenAI-style way to ask for thinking off. The test's stated intent holds,
since disabled does not enable anything, so it now asserts the disabled mapping
instead of the key's absence. Two imports moved to module scope for the
appended code, and no live test was touched.
test_discoverable_endpoints.py is the one left. Its twin grew from 1268 lines
to 9434, 25 of its assertions fail against today's code, and only 5 of its 19
tests have no counterpart, so deciding what survives that rewrite is a
judgement about the endpoints rather than a merge. The allowlist now holds
exactly that file and that reasoning.
validate_environment falls back to os.environ for every OCI credential and only defaults the region when OCI_REGION is unset, so on a machine with OCI configured the missing-credential test finds credentials it never passed and the default-region test builds a URL for the ambient region. The suite then passes or fails depending on who runs it. A fixture drops the seven OCI variables for the four classes this branch added and for TestOCIChatConfig, which had the same dependency before any of this and fails the same way: with OCI_USER and friends exported, two of its cases fail on origin/litellm_internal_staging today. clean env: 83 passed ambient OCI env: 83 passed Same numbers either way, where the pre-existing file gave 68 passed / 2 failed under the second.
496c6e9 to
4fc09cc
Compare
tin-berri
left a comment
There was a problem hiding this comment.
Merges 3 of 4 stranded never-run test files into their live twins (156 -> 196 collected tests, all passing), with an AST-based collision check proving no name clashes before merging. The one real behavior fix (DeepSeek reasoning_effort='none' mapping) is justified against the handler's own documented mapping rather than guessed. Correctly adds an env-var-clearing fixture for the appended OCI tests since validate_environment falls back to os.environ. Fourth file left out with a stated reason (twin was rewritten past it). CI green.
TLDR
Problem this solves:
How it solves it:
User Flow
Before: two files named the same thing, one of which is invisible
tests/test_litellm/llms/oci/chat/test_oci_chat_transformation.pyand finds no coverage of CRLF or escaped newlines inoci_keytests/litellm/, which no job runsreasoning_effort="none"produces nothinkingkey, and nothing notices that the handler has mapped it to{"type": "disabled"}for some timeAfter: one file per name, and it holds everything
TestOCIKeyNormalization,TestOCIValidateEnvironment,TestOCIGetCompleteUrlandTestOCIImageUrlTransformationllmsshardtests/litellm/is down to a single file, and the allowlist says exactly why that one is differentRelevant issues
Linear ticket
Pre-Submission checklist
uv run pytest tests/test_litellm/<your_test_file>.py -vScreenshots / Proof of Fix
Nothing collided
The merge is only safe if no name in the stranded file already exists in the live one, since a later definition would shadow the earlier silently.
Before
After
40 more tests, all green
The one assertion that changed, and why
The handler decides this deliberately, and says so:
The OCI suite no longer reads credentials from the environment
validate_environmentfalls back toos.environfor every OCI credential, so these tests would find credentials they never passed on a machine with OCI configured. A fixture drops the seven variables for the appended classes and forTestOCIChatConfig, which had the same dependency already.The pre-existing file gives
2 failed, 68 passedunder the second command.The shards they live in still collect
No new lint
What is left
Type
🧹 Refactoring
✅ Test
Caveats
TestOCIChatConfiggains the env fixture too; it had the same latent dependency before this branchFinal Attestation