[pytest] Improve 'cached' decorator#3112
Merged
lolyu merged 2 commits intosonic-net:masterfrom Mar 12, 2021
Merged
Conversation
|
This pull request introduces 2 alerts when merging a7aeaf09311c7d51efbc1d8213931c16981ae541 into b4b6d21 - view on LGTM.com new alerts:
|
6d21d9e to
bf14562
Compare
Signed-off-by: Longxiang Lyu <[email protected]>
Collaborator
Author
|
/AZP run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
bingwang-ms
reviewed
Mar 10, 2021
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
bingwang-ms
approved these changes
Mar 10, 2021
Collaborator
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Longxiang Lyu <[email protected]>
Collaborator
Author
|
/AZP run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
kazinator-arista
pushed a commit
to kazinator-arista/sonic-mgmt
that referenced
this pull request
Mar 4, 2026
…atically (sonic-net#17938) #### Why I did it src/sonic-utilities ``` * c5e30e38 - (HEAD -> 202305, origin/202305) [202305] Enhanced route_check.py for multi_asic platforms (sonic-net#3112) (21 hours ago) [Deepak Singhal] ``` #### How I did it #### How to verify it #### Description for the changelog
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.
Description of PR
Summary:
Fixes # (issue)
Type of change
Approach
What is the motivation for this PR?
cacheddecorator has limitations that it only supports being used for methods of classAnsibleBaseHostand its derivatives.FactsCachereturnsNonein either theFactsCachefails to find cached facts or the decorated function returnsNone.tests/common/utilitiesthat try to retrieve host variables share a similar call pattern that the arguments all havehostnamedefined and have the same logic to check the inventory in cache reading or add the inventory in cache writing.How did you do it?
zone_getterargument to thecacheddecorator to let it receives a customizable function to get the zone.FactsCachefails to find cached facts, let it returnsFactsCache.NOTEXISTinstead ofNone(Noneis a valid return from the decorated function)after_writeandbefore_readto thecacheddecorator to let it have extra functionalities to process the facts after the cache reading/before the cache writing.How did you verify/test it?
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation