Datetime and Time packages do not have the same behavior when being frozen #535
Description
Hello!
A few days ago a bug occured and we discover that the time were not frozen correctly in our tests. We reported the issue in pytest-freezer (pytest-dev/pytest-freezer#14) but after deeper investigations it seems that the function _should_use_real_time
reports that we should use realtime when it should'nt.
When using the 2 additional ignore elements freezegun.configure("_pytest.runner", "_pytest.terminal")
(which are added to mitigate the bug on the pytest --durations
option) time functions return real time in teardown fixtures while datetime functions return correct mocked time. @wimglenn tracked this here pytest-dev/pytest-freezer#14 (comment)
More precisely; the guilty ignore option is _pytest.runner
. I see 3 possibilities (maybe more?):
- Fix the
_should_use_real_time
; don't know if it is the right solution - Or try to deeply identity which element in the
_pytest.runner
package we need to ignore; to work with the current code without breaking the--durations
option. - Use a plain Fake object for the
time
package; just like thedatetime
package