Fix unit test failures: pygments lazy module access and PyTorch 2.6 compatibility #3374
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.
Why are the changes needed?
Two categories of unit tests were failing:
test_source_code_renderer- lazy module attribute access doesn't support nested pathstorch.loaddefault fromweights_only=FalsetoTrueWhat changes were proposed in this pull request?
1. SourceCodeRenderer pygments import
File:
plugins/flytekit-deck-standard/flytekitplugins/deck/renderer.pyReplace lazy module attribute chain with direct imports:
Aligns with pattern already used in
flytekit/deck/renderer.py.2. PyTorch backward compatibility
Files:
flytekit/extras/pytorch/native.py,flytekit/extras/pytorch/checkpoint.pyAdded explicit
weights_only=Falsetotorch.loadcalls:Maintains compatibility with models/checkpoints saved before PyTorch 2.6. Includes security warnings about arbitrary code execution risk when loading untrusted pickle files.
How was this patch tested?
plugins/flytekit-deck-standard/tests/test_renderer.py: All 10 tests passtests/flytekit/unit/extras/pytorch/: All 13 tests passSetup process
N/A
Screenshots
N/A
Check all the applicable boxes
Related PRs
N/A
Docs link
N/A
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.