fix: avoid rounding microsecond to 1_000_000#11861
Merged
nicoddemus merged 3 commits intopytest-dev:mainfrom Jan 27, 2024
dqkqd:fix-bug-formatter-round-microsecond-to-1000000
Merged
fix: avoid rounding microsecond to 1_000_000#11861nicoddemus merged 3 commits intopytest-dev:mainfrom dqkqd:fix-bug-formatter-round-microsecond-to-1000000
1_000_000#11861nicoddemus merged 3 commits intopytest-dev:mainfrom
dqkqd:fix-bug-formatter-round-microsecond-to-1000000
Conversation
nicoddemus
requested changes
Jan 27, 2024
Member
nicoddemus
left a comment
There was a problem hiding this comment.
Other than my comment, could you please also add a changelog entry? Thanks!
Contributor
Author
|
Thanks for reviewing, I added comment and changelog. |
jsuchenia
pushed a commit
to jsuchenia/adventofcode
that referenced
this pull request
Jan 29, 2024
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [pytest](https://docs.pytest.org/en/latest/) ([source](https://github.com/pytest-dev/pytest), [changelog](https://docs.pytest.org/en/stable/changelog.html)) | dev | major | `7.4.4` -> `8.0.0` | --- ### Release Notes <details> <summary>pytest-dev/pytest (pytest)</summary> ### [`v8.0.0`](https://github.com/pytest-dev/pytest/releases/tag/8.0.0): pytest 8.0.0 (2024-01-27) [Compare Source](pytest-dev/pytest@7.4.4...8.0.0) See [8.0.0rc1](https://github.com/pytest-dev/pytest/releases/tag/8.0.0rc1) and [8.0.0rc2](https://github.com/pytest-dev/pytest/releases/tag/8.0.0rc2) for the full changes since pytest 7.4! #### Bug Fixes - [#​11842](pytest-dev/pytest#11842): Properly escape the `reason` of a `skip <pytest.mark.skip ref>`{.interpreted-text role="ref"} mark when writing JUnit XML files. - [#​11861](pytest-dev/pytest#11861): Avoid microsecond exceeds `1_000_000` when using `log-date-format` with `%f` specifier, which might cause the test suite to crash. </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xMzAuMCIsInVwZGF0ZWRJblZlciI6IjM3LjEzMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIn0=--> Reviewed-on: https://git.apud.pl/jacek/adventofcode/pulls/52 Co-authored-by: Renovate <renovate@apud.pl> Co-committed-by: Renovate <renovate@apud.pl>
gisbdzhch
pushed a commit
to gisktzh/gb3-search_api
that referenced
this pull request
Jan 31, 2024
This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [pytest](https://docs.pytest.org/en/latest/) ([source](https://github.com/pytest-dev/pytest), [changelog](https://docs.pytest.org/en/stable/changelog.html)) | `==7.4.4` -> `==8.0.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>pytest-dev/pytest (pytest)</summary> ### [`v8.0.0`](https://github.com/pytest-dev/pytest/releases/tag/8.0.0): pytest 8.0.0 (2024-01-27) [Compare Source](pytest-dev/pytest@7.4.4...8.0.0) See [8.0.0rc1](https://github.com/pytest-dev/pytest/releases/tag/8.0.0rc1) and [8.0.0rc2](https://github.com/pytest-dev/pytest/releases/tag/8.0.0rc2) for the full changes since pytest 7.4! #### Bug Fixes - [#​11842](pytest-dev/pytest#11842): Properly escape the `reason` of a `skip <pytest.mark.skip ref>`{.interpreted-text role="ref"} mark when writing JUnit XML files. - [#​11861](pytest-dev/pytest#11861): Avoid microsecond exceeds `1_000_000` when using `log-date-format` with `%f` specifier, which might cause the test suite to crash. </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or rename PR to start with "rebase!". 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
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.
I'm using pytest with python 3.9, and my
log-date-formatis enabled for microseconds. However, my testsuite occasionally fails with the message below:I'm pretty sure the issue occurred because we're rounding up microsecond here, which make it exceeds 999999.
pytest/src/_pytest/logging.py
Lines 72 to 75 in ac2cd72
As we can see
msecscan take more than 4 digits after decimal points, hence it can be rounded up to1_000_000after multiplying with1_000. (in python 3.9)This is "fixed" in python 3.10 and 3.11 python/cpython#89047
They floored
msecsso it will always never be rounded to1_000_000.However, since we also support 3.8 and 3.9, I think we should fix this by flooring microsecond as well.
(I don't know how to write test for this case without mocking
time.time())