-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Enhancement: Refactor Test Code for Efficiency and Quality #7609
Conversation
During the refactoring, two bugs were identified.
…test cases execution time and simplify test cases
…undant code and reduce the execution time
Hi @KumoLiu, I'll take a look through the changes. |
Hi @freddiewanah. We discussed this PR in our regular meeting and we'd like to request that it gets broken up into smaller, more manageable pieces rather than a monolithic PR that touches 65 different files. Ideally, it should be as follows:
Would this be ok? |
Hi @atbenmurray thanks for the review. If I understand correctly, do you want me to break this PR into 4 PRs, where each of them addresses one smell/issue you listed in the comment? |
Yes, that's correct. It might also be worth splitting category 3 into a few smaller PRs. We prefer to avoid PRs that many files if they can be subdivided into smaller PRs. |
…7671) ### Description As discussed in PR #7609, I tried to break the suboptimal test refactors to smaller pieces. Suboptimal Assert: Instead of using statements such as assertIsNone, assertIsInstance, always simply use assertTrue or assertFalse. This will decrease the code overall readability and increase the execution time as extra logic needed. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Han Wang <freddie.wanah@gmail.com> Co-authored-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
### Description As discussed in PR #7609, I tried to break the suboptimal test refactors to smaller pieces. In this PR all asserts are checking textual content or instance of a parameter. Suboptimal Assert: Instead of using statements such as assertIsNone, assertIsInstance, always simply use assertTrue or assertFalse. This will decrease the code overall readability and increase the execution time as extra logic needed. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Han Wang <freddie.wanah@gmail.com> Signed-off-by: Ben Murray <ben.murray@gmail.com> Signed-off-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> Co-authored-by: YunLiu <55491388+KumoLiu@users.noreply.github.com> Co-authored-by: Ben Murray <ben.murray@gmail.com>
Description
As a first-time contributor with a background in researching Python unit tests, I conducted a thorough static analysis of the project's test code. This examination revealed various "test smells" that could potentially degrade both the efficiency and quality of our tests. To address these issues, I've refactored the relevant code segments. The modifications I propose not only aim to eliminate these inefficiencies but are also expected to reduce execution time within GitHub Actions. This reduction could contribute to lower operational costs for the project. Additionally, I've identified three issues within the test code that could cause problems during CICD.
Three issues:
Test smells refactored:
I didn't change any of the testing logic or testing values. The refactoring only focuses on reducing the test smells.
Please feel free to let me know if you are interested in more refactoring like this or if there're any changes that you don't wish.
Types of changes
./runtests.sh -f -u --net --coverage
../runtests.sh --quick --unittests --disttests
.make html
command in thedocs/
folder.