Commit 6cc31547 authored by Jason Madden's avatar Jason Madden

Tweak timeout for PyPy3 that fails on travis sometimes.

parent 8b40093a
...@@ -84,6 +84,8 @@ elif sys.version_info[0] == 2: ...@@ -84,6 +84,8 @@ elif sys.version_info[0] == 2:
# Python 2, < 2.7.9 # Python 2, < 2.7.9
NON_APPLICABLE_SUFFIXES.append('279') NON_APPLICABLE_SUFFIXES.append('279')
PYPY3 = PYPY and PY3
if sys.platform.startswith('win'): if sys.platform.startswith('win'):
NON_APPLICABLE_SUFFIXES.append("posix") NON_APPLICABLE_SUFFIXES.append("posix")
# This is intimately tied to FileObjectPosix # This is intimately tied to FileObjectPosix
...@@ -113,7 +115,7 @@ else: ...@@ -113,7 +115,7 @@ else:
return f return f
return dec return dec
if PYPY and PY3 and RUNNING_ON_CI: if PYPY3 and RUNNING_ON_CI:
# Same as above, for PyPy3.3-5.5-alpha # Same as above, for PyPy3.3-5.5-alpha
skipOnPyPy3OnCI = unittest.skip skipOnPyPy3OnCI = unittest.skip
else: else:
...@@ -122,6 +124,8 @@ else: ...@@ -122,6 +124,8 @@ else:
return f return f
return dec return dec
EXPECT_POOR_TIMER_RESOLUTION = PYPY3 or RUNNING_ON_APPVEYOR
class ExpectedException(Exception): class ExpectedException(Exception):
"""An exception whose traceback should be ignored""" """An exception whose traceback should be ignored"""
......
...@@ -11,14 +11,13 @@ FUZZY = SMALL / 2 ...@@ -11,14 +11,13 @@ FUZZY = SMALL / 2
# setting up signal does not affect join() # setting up signal does not affect join()
gevent.signal(1, lambda: None) # wouldn't work on windows gevent.signal(1, lambda: None) # wouldn't work on windows
from greentest import RUNNING_ON_APPVEYOR from greentest import EXPECT_POOR_TIMER_RESOLUTION
@contextmanager @contextmanager
def expected_time(expected, fuzzy=None): def expected_time(expected, fuzzy=None):
if fuzzy is None: if fuzzy is None:
if RUNNING_ON_APPVEYOR: if EXPECT_POOR_TIMER_RESOLUTION:
# The noted timer jitter issues on appveyor # The noted timer jitter issues on appveyor/pypy3
fuzzy = expected * 5.0 fuzzy = expected * 5.0
else: else:
fuzzy = expected / 2.0 fuzzy = expected / 2.0
...@@ -28,7 +27,7 @@ def expected_time(expected, fuzzy=None): ...@@ -28,7 +27,7 @@ def expected_time(expected, fuzzy=None):
assert expected - fuzzy <= elapsed <= expected + fuzzy, 'Expected: %r; elapsed: %r; fuzzy %r' % (expected, elapsed, fuzzy) assert expected - fuzzy <= elapsed <= expected + fuzzy, 'Expected: %r; elapsed: %r; fuzzy %r' % (expected, elapsed, fuzzy)
def no_time(fuzzy=(0.001 if not RUNNING_ON_APPVEYOR else 1.0)): def no_time(fuzzy=(0.001 if not EXPECT_POOR_TIMER_RESOLUTION else 1.0)):
return expected_time(0, fuzzy=fuzzy) return expected_time(0, fuzzy=fuzzy)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment