-
Notifications
You must be signed in to change notification settings - Fork 12
Add git info test #85
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
base: main
Are you sure you want to change the base?
Conversation
As per issue neuroinformatics-unit#8, the git-related code is not being tested. This commit can be a starting point for git-related tests. It exposes the repo object, which in turn can be used for various assertions. Completed during UCL ARC's Winter Open-Source Good First Issue Hackathon. Co-authored-by: Matthew Scroggs <[email protected]>
adamltyson
left a comment
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.
Hi @wael-mahlous, thanks for this, much appreciated!
Looks good, I've just left a few small comments.
| "tox", | ||
| "pre-commit", | ||
| "setuptools_scm", | ||
| ] |
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.
This is needed to ensure that git is installed when setting up a development environment.
| "fancylog[git]" | |
| ] |
| from rich.logging import RichHandler | ||
|
|
||
| import fancylog | ||
| import fancylog.tools.git |
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.
This isn't really needed as fancylog is imported above.
| import fancylog.tools.git |
| A gitpython repo object. | ||
| """ | ||
| self.repo = repo | ||
| self.head = GitHead(repo.head.commit) |
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.
Just to use this variable consistently
| self.head = GitHead(repo.head.commit) | |
| self.head = GitHead(self.repo.head.commit) |
| assert f"{'pytest':20} {'1.1.1'}" | ||
|
|
||
|
|
||
| def test_git_info(): |
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.
Could you add a short description to explain what this text is doing?
|
@adamltyson thanks a lot for your comments and apologies for the late response (due to conflicting priorities). Will address all of these by end of the week! |
Description
What is this PR
Why is this PR needed?
tools/git.py is not currently covered by tests.
What does this PR do?
It exposes the repo object (https://gitpython.readthedocs.io/en/stable/reference.html#git.repo.base.Repo), which in turn can be used for various assertions, as demonstrated by the new test, or perhaps even for logging. Previously, only the head was exposed (https://gitpython.readthedocs.io/en/stable/reference.html#git.repo.base.Repo.head).
References
Issue #8
How has this PR been tested?
The tests were run locally. Coverage was also run locally and increased as a result of the new test.
Is this a breaking change?
No
Does this PR require an update to the documentation?
No
Checklist: