refactor: test utils and simplify the case code#1136
Merged
spacewander merged 6 commits intotj:mainfrom Feb 29, 2024
Merged
Conversation
* test_git_browse_ci.py
* test_git_browse.py
5a19d4d to
8a3b8bd
Compare
spacewander
reviewed
Feb 26, 2024
| 3. Create a test case `test_init`, and some test fixtures can be used, `temp_repo`, `named_temp_repo` etc. | ||
| * `temp_repo` is module scoped fixture which create a temporary directory and available in the test suite `test_git_alias.py`. | ||
| * `named_temp_repo` is just same as `temp_repo` except the custom directory renaming. | ||
| 4. Loop the third step until the 100% coverage of the function of the `git-alias` |
Collaborator
There was a problem hiding this comment.
Suggested change
| 4. Loop the third step until the 100% coverage of the function of the `git-alias` | |
| 4. Loop the third step until the 100% coverage of the function of the `git-alias` |
Could we have a way to measure it?
Collaborator
Author
There was a problem hiding this comment.
I think the coverage of the unit test is a good way to measure it.
Collaborator
Author
There was a problem hiding this comment.
The pytest coverage will be update in another PR.
tests/README.md
Outdated
|
|
||
| For example, | ||
|
|
||
| 1. The `git-alias` should has a test suite, so create `test_git_alias.py` in the directory `test` |
Collaborator
There was a problem hiding this comment.
Suggested change
| 1. The `git-alias` should has a test suite, so create `test_git_alias.py` in the directory `test` | |
| 1. The `git-alias` should have a test suite, so create `test_git_alias.py` in the directory `test` |
Collaborator
There was a problem hiding this comment.
We should rename https://github.com/tj/git-extras/blob/main/tests/test_authors.py?
Collaborator
Author
There was a problem hiding this comment.
Yes, it should be, update later.
tests/helper.py
Outdated
| try: | ||
| self._git_repo.git.remote("add", "origin", origin_url) | ||
| except GitCommandError: | ||
| pass |
Collaborator
There was a problem hiding this comment.
We should log the error?
Collaborator
Author
There was a problem hiding this comment.
The log is better but the throw is not expected.
spacewander
approved these changes
Feb 27, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.