Skip to content

chore: remove usage of getattr() - #1375

Merged
nejch merged 1 commit into
python-gitlab:masterfrom
JohnVillalovos:jlvillal/update_uses_post
Apr 17, 2021
Merged

chore: remove usage of getattr()#1375
nejch merged 1 commit into
python-gitlab:masterfrom
JohnVillalovos:jlvillal/update_uses_post

Conversation

@JohnVillalovos

@JohnVillalovos JohnVillalovos commented Mar 14, 2021

Copy link
Copy Markdown
Member
Remove usage of getattr(self, "_update_uses_post", False)

Instead add it to class and set default value to False.

Add a test that shows it is set to True for the
ProjectMergeRequestApprovalManager class.

@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #1375 (a8f4c23) into master (8ace76a) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1375   +/-   ##
=======================================
  Coverage   79.95%   79.96%           
=======================================
  Files          73       73           
  Lines        4016     4017    +1     
=======================================
+ Hits         3211     3212    +1     
  Misses        805      805           
Flag Coverage Δ
unit 79.96% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
gitlab/mixins.py 77.47% <100.00%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8ace76a...a8f4c23. Read the comment docs.

@JohnVillalovos
JohnVillalovos marked this pull request as draft March 15, 2021 14:22
@JohnVillalovos
JohnVillalovos marked this pull request as ready for review March 15, 2021 14:27
Remove usage of getattr(self, "_update_uses_post", False)

Instead add it to class and set default value to False.

Add a tests that shows it is set to True for the
ProjectMergeRequestApprovalManager and ProjectApprovalManager classes.
@JohnVillalovos

Copy link
Copy Markdown
Member Author

@nejch If you have time to review, it would be appreciated.

@nejch nejch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again! :) Left a side note for a follow-up if we get to it.

def test_project_approval_manager_update_uses_post(project, resp_snippet):
"""Ensure the
gitlab.v4.objects.merge_request_approvals.ProjectApprovalManager object has
_update_uses_post set to True"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was originally thinking this would be more appropriate in a separate test/fake manager, to test just this specific aspect of it, e.g. in test_object_mixin_attributes.py. But since it's only used here I think it's ok, maybe for a follow-up PR :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do that, though I'm not quite sure what you want me to do 😕

Do you want a test that shows that update_uses_post exists and is False in test_object_mixin_attributes.py ?

@nejch
nejch merged commit d236267 into python-gitlab:master Apr 17, 2021
@JohnVillalovos
JohnVillalovos deleted the jlvillal/update_uses_post branch April 18, 2021 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants