-
Notifications
You must be signed in to change notification settings - Fork 24
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
Incorrect test duration recorded when test uses freezegun #16
Comments
Thanks for letting me know. I need to look at freeze gun and figure out what's going on. Give me a few days. |
I've had a look myself and I have a patch, will raise a PR later- fairly
simple to fix fortunately!
…On 15 Jun 2017 1:43 p.m., "Michael Herman" ***@***.***> wrote:
Thanks for letting me know. I need to look at freeze gun and figure out
what's going on. Give me a few days.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#16 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABIxepuUPaMThuBYLjPUq9XehFyxBHeZks5sESb_gaJpZM4N7Am_>
.
|
petedmarsh
added a commit
to petedmarsh/django-slow-tests
that referenced
this issue
Jun 16, 2017
freezegun is a Python library used to set the date/time returned by the Python date/time functions to make testing time-sensitive code easier. time.time() is used here to measure the duration of test cases, if freezegun was in use then the time returned by this could be the time the test had set up, rather than the actual time. This lead to test durations being reported as negative (if frozen time is in the past), or much longer than expected (if fronzen time is in the future). freezegun exposes the unmodified time.time() via an alias. This changes TimingSuite so that it uses this alias if freezegun is installed.
petedmarsh
added a commit
to petedmarsh/django-slow-tests
that referenced
this issue
Jun 16, 2017
freezegun is a Python library used to set the date/time returned by the Python date/time functions to make testing time-sensitive code easier. time.time() is used here to measure the duration of test cases, if freezegun was in use then the time returned by this could be the time the test had set up, rather than the actual time. This lead to test durations being reported as negative (if frozen time is in the past), or much longer than expected (if fronzen time is in the future). freezegun exposes the unmodified time.time() via an alias. This changes TimingSuite so that it uses this alias if freezegun is installed.
petedmarsh
added a commit
to petedmarsh/django-slow-tests
that referenced
this issue
Jun 16, 2017
freezegun is a Python library used to set the date/time returned by the Python date/time functions to make testing time-sensitive code easier. time.time() is used here to measure the duration of test cases, if freezegun was in use then the time returned by this could be the time the test had set up, rather than the actual time. This lead to test durations being reported as negative (if frozen time is in the past), or much longer than expected (if fronzen time is in the future). freezegun exposes the unmodified time.time() via an alias. This changes TimingSuite so that it uses this alias if freezegun is installed.
petedmarsh
added a commit
to petedmarsh/django-slow-tests
that referenced
this issue
Jun 16, 2017
freezegun is a Python library used to set the date/time returned by the Python date/time functions to make testing time-sensitive code easier. time.time() is used here to measure the duration of test cases, if freezegun was in use then the time returned by this could be the time the test had set up, rather than the actual time. This lead to test durations being reported as negative (if frozen time is in the past), or much longer than expected (if fronzen time is in the future). freezegun exposes the unmodified time.time() via an alias. This changes TimingSuite so that it uses this alias if freezegun is installed.
mjhea0
added a commit
that referenced
this issue
Jun 17, 2017
Fixed #16 - Incorrect test duration with freezegun
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I came across this project yesterday and I tried it out on my Django project, I got some strange output:
Now, my some of my tests are on the slow side but they don't take > 2 years to run!
I remember that some of my test cases use freezegun to test date/time sensitive code - I think that's likely the cause.
In my case
other.TestCase.test_b
uses freezegun:but
some.TestCase.test_a
does not - and when I runother.TestCase.test_b
in isolation I get a reasonable recorded duration, so it seems that using freezegun in one test affects the recorded time of another.The text was updated successfully, but these errors were encountered: