Skip to content
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

Added time.get_ticks() tests & increase error deltas for other time module tests #1880

Merged
merged 3 commits into from Jun 3, 2020

Conversation

Gogotchuri
Copy link
Contributor

Implemented correct return-type assertion and ensuring correct time gaps for each call to get_ticks().

@MyreMylar
Copy link
Contributor

Looks good to me. Though I think we may need to increase the delta for all these timing tests as we've had one build fail on appveyor here:

https://ci.appveyor.com/project/pygame/pygame/builds/33224276/job/2epwec92vadmopcm#L4046

with this output:

======================================================================
FAIL: test_delay (pygame.tests.time_test.TimeModuleTest)
Tests time.delay() function.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Python35\lib\site-packages\pygame\tests\time_test.py", line 145, in test_delay
    self._wait_delay_check(pygame.time.delay, millis, iterations, delta)
  File "C:\Python35\lib\site-packages\pygame\tests\time_test.py", line 203, in _wait_delay_check
    self.assertAlmostEqual(wait_time, millis, delta=delta)
AssertionError: 52 != 50 within 1 delta
======================================================================
FAIL: test_wait (pygame.tests.time_test.TimeModuleTest)
Tests time.wait() function.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Python35\lib\site-packages\pygame\tests\time_test.py", line 186, in test_wait
    self._wait_delay_check(pygame.time.wait, millis, iterations, delta)
  File "C:\Python35\lib\site-packages\pygame\tests\time_test.py", line 203, in _wait_delay_check
    self.assertAlmostEqual(wait_time, millis, delta=delta)
AssertionError: 75 != 50 within 5 delta
----------------------------------------------------------------------

Perhaps we should be assuming time.delay is under 5ms accuracy and time.wait() can be more like 50ms? Definitely useful information to find out! And each time the CI builds run we'll gather more data.

@illume
Copy link
Member

illume commented May 31, 2020

I'm temporarily disabling the time tests in this PR for the release: #1882

@Gogotchuri
Copy link
Contributor Author

So, I underestimated delta values. I will increase them to 50ms for time.wait() and to 5ms for time.delay(), as you suggested. I think those should be a big enough error margin to pass every test and also to make sure that functionality is correct. I will make another commit to this branch with changed values in all 3 tests. Really appreciate your feedback, thanks for helping.

Copy link
Contributor

@MyreMylar MyreMylar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!
Hopefully the Continuous Integration gods will approve.

@Gogotchuri
Copy link
Contributor Author

Thanks for your approval. I hope, my contributions were helpful. Trying to get into open source and planning to contribute more.

Copy link
Contributor

@MyreMylar MyreMylar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I think the new deltas should be enough that the tests won't fail, but I suppose we shall find out over time.

@MyreMylar MyreMylar changed the title Added time.get_ticks() tests. Added time.get_ticks() tests & increase error deltas for other time module tests Jun 1, 2020
Copy link
Member

@illume illume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great :) Thank you.

@illume illume merged commit 108d07f into pygame:master Jun 3, 2020
@MyreMylar
Copy link
Contributor

Looks good. I think the new deltas should be enough that the tests won't fail, but I suppose we shall find out over time.

Hah, just saw one appveyor build fail with a difference of 88 milliseconds on the slow test so it looks like I was too optimistic as to that function's accuracy.

@illume illume added the time pygame.time label Sep 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
time pygame.time
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants