test(tensorboard): drop three duplicated copies of the presigned-URL test block - #6266
Open
Anai-Guo wants to merge 1 commit into
Open
test(tensorboard): drop three duplicated copies of the presigned-URL test block#6266Anai-Guo wants to merge 1 commit into
Anai-Guo wants to merge 1 commit into
Conversation
…test block
`sagemaker-core/tests/unit/interactive_apps/test_tensorboard.py` contains the
same four-test block four times over, plus an older superseded copy of three of
them. Because a later `def` silently rebinds an earlier one at module scope,
only the last definition of each name is collected, so ~420 lines of the file
are dead:
* `test_tb_presigned_url_invalid_params` - 4 byte-identical definitions
* `test_tb_presigned_url_failure` - 1 superseded + 4 byte-identical
* `test_tb_invalid_presigned_kwargs` - 1 superseded + 4 byte-identical
* `test_tb_valid_presigned_kwargs` - 1 superseded + 3 byte-identical
+ 1 truncated
The three superseded definitions are the pre-rewrite originals: the newer ones
patch `BaseInteractiveApp.__init__` and build the `tb_app` fixture explicitly.
The old `test_tb_valid_presigned_kwargs` is in fact broken - its trailing
web-browser block dereferences a `tb_app` name it never binds, which is exactly
the defect the rewrite fixed - so nothing is lost by removing it.
One behavioural detail matters: the *last* copy of
`test_tb_valid_presigned_kwargs` (the only one that was actually collected) is a
truncated version that drops the final assertions covering
`open_in_default_web_browser=True`. Keeping the first complete copy instead
restores that coverage.
This change keeps exactly one definition of each test and deletes the rest.
Verified with `pytest tests/unit/interactive_apps/test_tensorboard.py`: 11 tests
collected both before and after, and the same 10 pass / 1 pre-existing
environment failure (`test_tb_init_with_default_region`, which needs a default
AWS region) in both runs - with the restored web-browser assertions now
executing.
Signed-off-by: Anai-Guo <antai12232931@outlook.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Anai-Guo
requested a deployment
to
manual-approval
September 12, 2026 16:11 — with
GitHub Actions
Waiting
Anai-Guo
requested a deployment
to
manual-approval
September 12, 2026 16:11 — with
GitHub Actions
Waiting
Anai-Guo
requested a deployment
to
manual-approval
September 12, 2026 16:12 — with
GitHub Actions
Waiting
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.
Issue
None (found by auditing duplicate top-level
defnames in the test suite).Description
sagemaker-core/tests/unit/interactive_apps/test_tensorboard.pycontains the same four-test block four times over, plus an older superseded copy of three of them. Because a laterdefsilently rebinds an earlier one at module scope, only the last definition of each name is ever collected — so roughly 420 of the file's 840 lines are dead code:test_tb_presigned_url_invalid_paramstest_tb_presigned_url_failuretest_tb_invalid_presigned_kwargstest_tb_valid_presigned_kwargsTwo details worth calling out:
The three superseded definitions are the pre-rewrite originals. The newer versions patch
BaseInteractiveApp.__init__and build thetb_appfixture explicitly. The oldtest_tb_valid_presigned_kwargsis in fact broken — its trailing web-browser block dereferences atb_appname it never binds (NameError), which is precisely the defect the rewrite fixed. Nothing is lost by removing them.The only copy that actually ran was the truncated one. The last
test_tb_valid_presigned_kwargsdrops the final assertions coveringopen_in_default_web_browser=True. Keeping the first complete copy instead restores that coverage, which is the sole behavioural effect of this PR.This change keeps exactly one definition of each test and deletes the rest (
+0 / −421).Testing done
--collect-only: 11 tests before, 11 tests after (no test is added or removed — the duplicates were never collected).test_tb_init_with_default_region, a pre-existing environment dependency (it needs a default AWS region configured) and is unaffected by this change.open_in_default_web_browser=Trueassertions execute and pass.Merge Checklist
Tests
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
🤖 Generated with Claude Code