-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add more tests #571
Add more tests #571
Conversation
Reviewer's Guide by SourceryThis pull request adds tests for the kfactory CLI. It includes tests for the version callback and the show command. The tests cover cases with existing files, non-existent files, directories, and files with no permissions. No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #571 +/- ##
==========================================
+ Coverage 59.30% 60.75% +1.44%
==========================================
Files 49 49
Lines 9160 9185 +25
Branches 1739 1735 -4
==========================================
+ Hits 5432 5580 +148
+ Misses 3196 3085 -111
+ Partials 532 520 -12 ☔ View full report in Codecov by Sentry. |
Fix locking logic
add some basic thread safety locks
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.
We've reviewed this pull request using the Sourcery rules engine. If you would also like our AI-powered code review then let us know.
for p1 in (True, False) | ||
for p2 in (True, False) | ||
], | ||
smart_bundle_routing_params, | ||
) | ||
def test_smart_routing( |
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.
issue (code-quality): Low code quality found in test_smart_routing - 7% (low-code-quality
)
Explanation
The quality score for this function is below the quality threshold of 25%.This score is a combination of the method length, cognitive complexity and working memory.
How can you solve this?
It might be worth refactoring this function to make it shorter and more readable.
- Reduce the function length by extracting pieces of functionality out into
their own functions. This is the most important thing you can do - ideally a
function should be less than 10 lines. - Reduce nesting, perhaps by introducing guard clauses to return early.
- Ensure that variables are tightly scoped, so that code using related concepts
sits together within the function rather than being scattered.
assert valid_data.key3 == [1, 2, 3] | ||
|
||
with pytest.raises(ValidationError): | ||
Info(key1=set([1, 2, 3])) |
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.
suggestion (code-quality): Unwrap a constant iterable constructor (unwrap-iterable-construction
)
Info(key1=set([1, 2, 3])) | |
Info(key1={1, 2, 3}) |
assert check_metadata_type({"key": "value"}) == {"key": "value"} | ||
|
||
with pytest.raises(ValueError): | ||
check_metadata_type(set([1, 2, 3])) # type: ignore |
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.
suggestion (code-quality): Unwrap a constant iterable constructor (unwrap-iterable-construction
)
check_metadata_type(set([1, 2, 3])) # type: ignore | |
check_metadata_type({1, 2, 3}) |
Summary by Sourcery
Tests:
show
command in the CLI.