-
Notifications
You must be signed in to change notification settings - Fork 32
♻️ [Maintenance] Refactor Tests Utilities and Typing (Spin-off 2 from PR #8141) #8368
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
♻️ [Maintenance] Refactor Tests Utilities and Typing (Spin-off 2 from PR #8141) #8368
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #8368 +/- ##
==========================================
+ Coverage 87.87% 89.79% +1.92%
==========================================
Files 1945 1320 -625
Lines 75626 55810 -19816
Branches 1321 175 -1146
==========================================
- Hits 66454 50117 -16337
+ Misses 8774 5635 -3139
+ Partials 398 58 -340
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
🧪 CI InsightsHere's what we observed from your CI run for 85d00cf. 🟢 All jobs passed!But CI Insights is watching 👀 |
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 is a maintenance refactor focused on improving test utilities and type hinting across the codebase. It includes enhancements to type annotations, test assertion improvements, and minor code quality fixes as a spin-off from a larger PR.
- Updates type hinting to use modern union syntax and improves error handling clarity
- Replaces direct equality assertions with DeepDiff comparisons for more flexible test validation
- Adds missing imports and fixes minor code style issues
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
services/web/server/tests/unit/with_dbs/04/workspaces/test_workspaces__moving_projects_between_workspaces.py | Updates dictionary access to use .get() method for safer key access |
services/web/server/tests/unit/with_dbs/04/workspaces/test_workspaces__folders_and_projects_crud.py | Updates dictionary access to use .get() method for safer key access |
services/web/server/tests/unit/with_dbs/04/notifications/test_notifications__db_comp_tasks_listening_task.py | Refactors mock patching to use explicit import and patch.object() |
services/web/server/tests/unit/with_dbs/02/test_projects_states_handlers.py | Replaces equality assertions with DeepDiff comparisons and adds missing imports |
services/web/server/tests/unit/with_dbs/02/test_projects_ports_handlers.py | Replaces equality assertions with DeepDiff comparisons and fixes test decorator |
services/web/server/tests/unit/with_dbs/02/test_projects_nodes_handlers__patch.py | Adds missing fields to node output assertions and replaces equality with DeepDiff |
services/web/server/tests/unit/with_dbs/02/test_projects_crud_handlers.py | Replaces equality assertions with DeepDiff comparisons and adds utility imports |
services/web/server/tests/data/fake-project.json | Updates progress value from integer to float |
services/director-v2/src/simcore_service_director_v2/utils/dags.py | Adds assertion for workbench node validation |
services/director-v2/src/simcore_service_director_v2/modules/db/tables.py | Updates __all__ to tuple format and adds missing imports |
services/director-v2/src/simcore_service_director_v2/modules/db/repositories/comp_tasks/_utils.py | Enhances error context with additional fields |
packages/simcore-sdk/src/simcore_sdk/node_ports_v2/port.py | Updates type annotations to use modern union syntax and improves error messages |
services/web/server/tests/unit/with_dbs/02/test_projects_ports_handlers.py
Show resolved
Hide resolved
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.
🙆♂️
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.
thanks!
services/web/server/tests/unit/with_dbs/02/test_projects_crud_handlers.py
Show resolved
Hide resolved
@mergify queue |
🟠 Waiting for conditions to match
|
|
What do these changes do?
This pull request is a spin-off from PR #8141, which focuses on refactoring the
project.workbench
and therefore includes many many changes. This PR can be merged independently and will help reduce the size of the original PR and therefore make it easier to review. The changes here are mostly enhancements and utilities and do not introduce critical modifications to existing features.Type Hinting and Error Handling Improvements:
packages/simcore-sdk/src/simcore_sdk/node_ports_v2/port.py
to use modern union syntax (e.g.,FileLink | DownloadLink
instead of tuples) and refactored error messages for clarity. This affects value validation and async value retrieval logic. [1] [2] [3]Test Assertion Refactoring:
DeepDiff
comparisons, allowing for exclusion of fields likelastChangeDate
and ignoring order where necessary. This change enhances robustness and flexibility of test checks. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]Database Table and Import Cleanups:
services/director-v2/src/simcore_service_director_v2/modules/db/tables.py
to use a tuple for__all__
and added missing imports forprojects_nodes
.Test Fixture and Assertion Enhancements:
DeepDiff
imports to relevant test files and replaced some equality assertions with custom helpers likeassert_equal_ignoring_none
for more accurate test validation. [1] [2] [3] [4]Miscellaneous Fixes:
user_id
,product_name
, andproject_id
in exceptions.Let me know if you'd like a deeper explanation of any specific change!
Related issue/s
projects_nodes
table instead ofprojects.workbench
(🗃️) #8141 ready to mergeHow to test
Dev-ops