-
Notifications
You must be signed in to change notification settings - Fork 526
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
fix(test): make unit tests deterministic #3856
Conversation
This PR makes all unit tests deterministic. We have found non-deterministic unit tests have more disadvantages than advantages. Read more: https://softwareengineering.stackexchange.com/questions/221632/testing-deterministic-or-non-deterministic Signed-off-by: Jinzhe Zeng <[email protected]>
WalkthroughWalkthroughThe recent changes in the test files primarily involve introducing a global seed for Changes
Assessment against linked issues
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (16)
Files skipped from review as they are similar to previous changes (15)
Additional comments not posted (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## devel #3856 +/- ##
==========================================
- Coverage 82.67% 82.66% -0.01%
==========================================
Files 515 517 +2
Lines 49549 49724 +175
Branches 2989 2989
==========================================
+ Hits 40965 41105 +140
- Misses 7673 7709 +36
+ Partials 911 910 -1 ☔ View full report in Codecov by Sentry. |
Several tests in
|
fyi @iProzd |
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.
shall we provide a global rand seed for all the tests?
so if one wants to change the seed he/she needs to change only one line, rather than replace all the 20240604
strings across the code.
we may decrease the epsilon to reduce the difference.. |
we should parameterize the seed, also make it dynamic by pulling the current date if possible. That way, it's reproducible and covers more test cases. |
This will make the tests fail on random days, which should not be used in the automatic CI environment. |
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
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.
Actionable comments posted: 6
I changed from 1e-5 to 1e-6 but seems not working. |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
Signed-off-by: Jinzhe Zeng <[email protected]>
This reverts commit d25a290.
I just realized that I forgot to set |
Fix deepmodeling#3847. This PR makes all unit tests deterministic. We have found non-deterministic unit tests have more disadvantages than advantages. Read more: https://softwareengineering.stackexchange.com/questions/221632/testing-deterministic-or-non-deterministic <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Tests** - Introduced a global seed for consistent random number generation across various test files. - Updated the initialization of random tensors to include a generator parameter seeded with the global seed. - Adjusted epsilon values and setup methods in specific test cases for accuracy and consistency. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Jinzhe Zeng <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Fix #3847.
This PR makes all unit tests deterministic. We have found non-deterministic unit tests have more disadvantages than advantages.
Read more: https://softwareengineering.stackexchange.com/questions/221632/testing-deterministic-or-non-deterministic
Summary by CodeRabbit