-
Notifications
You must be signed in to change notification settings - Fork 5k
lazy load v2_swagger_client module #22154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #22154 +/- ##
===========================================
+ Coverage 45.36% 65.88% +20.51%
===========================================
Files 244 1072 +828
Lines 13333 115713 +102380
Branches 2719 2925 +206
===========================================
+ Hits 6049 76238 +70189
- Misses 6983 35249 +28266
- Partials 301 4226 +3925
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces lazy loading of the v2_swagger_client module via importlib to avoid import errors before the Swagger client is generated. It replaces direct imports and references with calls to a local swagger_module helper.
- Added a
swagger_modulehelper function and replaced directv2_swagger_clientimports with dynamic imports in three modules. - Updated API client instantiations and exception handling to use the dynamically loaded module.
- Removed direct imports of
v2_swagger_clientand commented out the staticApiExceptionimport.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| tests/apitests/python/testutils.py | Added swagger_module helper and replaced direct v2_swagger_client calls. |
| tests/apitests/python/library/repository.py | Introduced dynamic import helper; updated API calls and exception handling. |
| tests/apitests/python/library/base.py | Added swagger_module helper; updated client creation to use dynamic import. |
Signed-off-by: my036811 <[email protected]>
e715375 to
71cc70c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Signed-off-by: my036811 <[email protected]>
Signed-off-by: my036811 <[email protected]>
Signed-off-by: my036811 <[email protected]>
Signed-off-by: my036811 <[email protected]>
Thank you for contributing to Harbor!
Comprehensive Summary of your change
lazy load v2_swagger_client module when running Setup robot case before swagger file generated.
Issue being fixed
#22123
Please indicate you've done the following: