Skip to content
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

refactor: test utils and simplify the case code #1136

Merged
merged 6 commits into from
Feb 29, 2024

Conversation

vanpipy
Copy link
Collaborator

@vanpipy vanpipy commented Feb 23, 2024

No description provided.

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`
Copy link
Collaborator

Choose a reason for hiding this comment

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

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the coverage of the unit test is a good way to measure it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

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`
Copy link
Collaborator

Choose a reason for hiding this comment

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

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`

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it should be, update later.

Copy link
Collaborator Author

@vanpipy vanpipy Feb 27, 2024

Choose a reason for hiding this comment

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

Update

tests/helper.py Outdated
try:
self._git_repo.git.remote("add", "origin", origin_url)
except GitCommandError:
pass
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should log the error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The log is better but the throw is not expected.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Update

@spacewander spacewander merged commit a17d2fb into tj:main Feb 29, 2024
5 checks passed
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.

2 participants