-
-
Notifications
You must be signed in to change notification settings - Fork 305
tests: fixes all warnings #1746
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: master
Are you sure you want to change the base?
tests: fixes all warnings #1746
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1746 +/- ##
==========================================
- Coverage 97.92% 97.88% -0.04%
==========================================
Files 60 60
Lines 2604 2604
==========================================
- Hits 2550 2549 -1
- Misses 54 55 +1 ☔ View full report in Codecov by Sentry. |
Lee-W
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.
This PR is awesome! Just browsed through it Left a few nits and need some time to take a deeper look
woile
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.
Beautiful! Thanks. LGTM!
72047ac to
7ffbdb3
Compare
|
PR updated with all changes 👍🏼 |
| - output glitch | ||
|
|
||
| ## 1.0.0 (1970-01-01) | ||
| ## 1.0.0 (2025-12-29) |
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.
qq: will this test fail tomorrow?
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.
I just wanted to know where 2025-12-29 comes from. I haven't found related logic besides datetime.now() in this PR.
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.
Let me quickly rerun a test, it's 2025-12-30 UTC time now.
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.
No it won't fail, time is frozen with freezegun (I just rebased the PR on master and CI is still passing while it's 2025-12-30).
I just set yesterday date as freeze time because I add to set one and I though freezing on the day of change give an hint on when it has been done.
The test is decorated with @pytest.mark.freeze_time('2025-12-29'), so time has been frozen to 2025-12-29T00:00:00 at the start of the test and each call to util.*() methods will advance time by 1s. It makes it easy to manage changelog dates in test while also guaranteeing commit and tags sequentiality without ever waiting with sleep().
You can also manually advance time with util.tick().
When I'll port the other tests, if some require bigger time intervals, I'll add another util.move_to(date) method but it was not the case for those tests.
…for_tag()` function, removing the associated warnings
7ffbdb3 to
77c20c7
Compare
Description
This PR fixes all raised warnings during tests (making it easier to read actual errors).
Moving from 30 warnings and a duration of ~40s:
to no warnings for a duration of less than 10s:
The time gained is because we don't rely on
sleepanymore.Checklist
Code Changes
pyproject.tomlutil: UtilFixturehelper (freeze time withFreezeGunonce required):cli(*args)helper also time-controlled (underlying git operations have the time frozen too). Reduce the amount of boilerplate to execute the cli during testswait_for_tagintest_changelog_command.py(the only one still depending onwait_for_tag)test_changelog_command(all but those based on legacy pytesttmpdir/py.path.localtype which is badly typed)1970-01-01)The fixtures has not yet replaced helpers in other tests to reduce the size of the PR (will be done in separate pull requests)
Documentation Changes
None
Expected Behavior
Faster (no sleep) and fully deterministic (full control over time) tests execution.
Cleaner output (no more pages of warnings)
Easier to maintain tests
Steps to Test This Pull Request
Execute
poetry testonmasterand this branch to observe the differences of execution (speed and output).Additional Context
This was a long task but this was also (IMHO) required to make it easier to maintain tests on long term.
I'll update other test files when this one is merged
Fixes #1623