forked from adamchainz/time-machine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Raise our own utcnow DeprecationWarning with the right stacklevel
Previously, when time is mocked, no DeprecationWarning would be reported at all, and when time is not mocked, the original datetime.utcnow would misattribute its reported DeprecationWarning to the code of time_machine itself. Fix both cases to attribute the DeprecationWarning to the user code that called utcnow, by raising it ourselves with the right stacklevel, and test that we did so correctly. Fixes adamchainz#445. Signed-off-by: Anders Kaseorg <[email protected]>
- Loading branch information
Showing
3 changed files
with
40 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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