-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Improve Test Coverage for github/models #328
base: main
Are you sure you want to change the base?
Conversation
yashpandey06
commented
Jan 1, 2025
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 for submitting this @yashpandey06
Please address the comments below when you get a chance:
d89c98b
to
c413bd3
Compare
dbdace2
to
1557da5
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.
Please address all comment and leave actual marking comments as resolved to reviewers.
a88e394
to
2f078b2
Compare
|
||
|
||
class TestIssueIndexMixin: | ||
CREATED_AT = "2021-09-01T00:00:00Z" |
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.
Reason for this :
Earlier directly writing constants values into assertions were failing pre-commit checks , therefore assigned variables to them in required files .
1a4abce
to
f46dbea
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.
Same here -- this doesn't test actual RespsitoryIndexMixin
logic.
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.
I used the explicit MockModel class to extend this Mixin, so we can properly test the functions and their return values.
Any references would be helpful. Also, could you please take a look at the recent commit changes?
I might be missing something, and a reference would certainly help.
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.
Take a look at how you test Organization mixin -- you test actual code behavior. You don't have to mock, keep it simple and readable.
def test_from_github(self): | ||
default_contribution_value = 5 | ||
repository_contributor = RepositoryContributor() | ||
gh_label = Mock(contributions=default_contribution_value) |
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.
It's still named gh_label
, why was this marked as resolved?
012fb9d
to
a602024
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.
Take a look at how you test Organization mixin -- you test actual code behavior. You don't have to mock, keep it simple and readable.
@@ -7,26 +7,28 @@ class TestRepositoryContributor: | |||
def test_from_github(self): | |||
default_contribution_value = 5 | |||
repository_contributor = RepositoryContributor() | |||
gh_label = Mock(contributions=default_contribution_value) | |||
repository_contributor.from_github(gh_label) | |||
gh_label_mock = Mock(contributions=default_contribution_value) |
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.
You test repository contributor entity but create it from a GitHub label data?
fc6fbee
to
089525c
Compare
92f0eba
to
a602024
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.
@yashpandey06 please address the comments when you get a chance. This keeps us from enforcing 75% coverage threshold for the backend.
Thank you!
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.
Let me know if you still want to complete this. I'm going to re-assign it has been open for a while with no end result.
This is a blocker to 75% coverage enforcement.
Required test coverage of 50% reached. Total coverage: 74.66%
@arkid15r will push the latest changes today ...was busy with the other work ..Apologies for late intimation |
965d31b
to
377fcf5
Compare