8000 test time: Fix for unrealistic time slice requirement by illume · Pull Request #3878 · pygame/pygame · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

test time: Fix for unrealistic time slice requirement #3878

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

Merged
merged 1 commit into from
May 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion test/time_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os
import platform
import unittest
import pygame
import time
Expand Down Expand Up @@ -63,6 +65,10 @@ def test_get_rawtime(self):
c2 = c.get_time()
self.assertAlmostEqual(c1, c2, delta=delta)

@unittest.skipIf(platform.machine() == "s390x", "Fails on s390x")
@unittest.skipIf(
os.environ.get("CI", None), "CI can have variable time slices, slow."
)
def test_get_time(self):
# Testing parameters
delay = 0.1 # seconds
Expand Down Expand Up @@ -93,6 +99,10 @@ def test_get_time(self):
) #'time' module elapsed time converted to milliseconds
self.assertAlmostEqual(d0, c1, delta=delta)

@unittest.skipIf(platform.machine() == "s390x", "Fails on s390x")
@unittest.skipIf(
os.environ.get("CI", None), "CI can have variable time slices, slow."
)
def test_tick(self):
"""Tests time.Clock.tick()"""
"""
Expand All @@ -103,7 +113,8 @@ def test_tick(self):
"""

# Adjust this value to increase the acceptable sleep jitter
epsilon = 1.5
epsilon = 5 # 1.5

# Adjust this value to increase the acceptable locked frame-rate jitter
epsilon2 = 0.3
# adjust this value to increase the acceptable frame-rate margin
Expand Down Expand Up @@ -239,6 +250,10 @@ def test_tick_busy_loop(self):
class TimeModuleTest(unittest.TestCase):
__tags__ = ["timing"]

@unittest.skipIf(platform.machine() == "s390x", "Fails on s390x")
@unittest.skipIf(
os.environ.get("CI", None), "CI can have variable time slices, slow."
)
def test_delay(self):
"""Tests time.delay() function."""
millis = 50 # millisecond to wait on each iteration
Expand Down Expand Up @@ -270,6 +285,10 @@ def test_get_ticks(self):
# Assert almost equality of the ticking time and time difference
self.assertAlmostEqual(ticks_diff, time_diff, delta=delta)

@unittest.skipIf(platform.machine() == "s390x", "Fails on s390x")
@unittest.skipIf(
os.environ.get("CI", None), "CI can have variable time slices, slow."
)
def test_set_timer(self):
"""Tests time.set_timer()"""
"""
Expand Down
0