refactor(tests): replace deprecated pytest-freezegun with time-machine - #1036
Open
armorbreak001 wants to merge 1 commit into
Open
refactor(tests): replace deprecated pytest-freezegun with time-machine#1036armorbreak001 wants to merge 1 commit into
armorbreak001 wants to merge 1 commit into
Conversation
pytest-freezegun is unmaintained (last release 2020) and generates hundreds of DeprecationWarning on Python 3.12+ due to its reliance on distutils.version.LooseVersion. This commit replaces it with time-machine, which is actively maintained and provides equivalent time-freezing capabilities: - Replace pytest-freezegun dependency with time-machine>=2.14.0 - Replace @mark.freeze_time() decorators with @time_machine.travel() - Replace FakeDatetime with datetime.datetime - Replace freezegun's freezer fixture with time_machine fixture All 186 tests pass with zero deprecation warnings from this change. Closes scanapi#957
|
📌 Esta mensagem está tanto em português quanto em inglês (mais abaixo) — assim todo mundo consegue acompanhar! 🇧🇷 Português 👋 Olá! Este PR está obsoleto porque ficou aberto por 30 dias sem atividade. Remova o rótulo de stale ou comente, caso contrário ele será fechado em 15 dias. 🇬🇧 English Hey there! 👋 This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 15 days. |
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.
Summary
Replace the unmaintained
pytest-freezegun(last release 2020) withtime-machine, which is actively maintained and provides equivalent time-freezing capabilities.Problem
pytest-freezegungenerates hundreds ofDeprecationWarningon Python 3.12+ because it relies on the deprecateddistutils.version.LooseVersion:Changes
pytest-freezegun==0.4.2withtime-machine>=2.14.0freezegun.api.FakeDatetimewithdatetime.datetime@mark.freeze_time()with@time_machine.travel()@mark.freeze_time()with@time_machine.travel()freezer.move_to()withtime_machinefixtureTesting
All 186 tests pass with zero deprecation warnings.
Closes #957