[pypy-commit] pypy default: Fix test.
arigo
noreply at buildbot.pypy.org
Tue Oct 4 09:28:41 CEST 2011
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r47818:15798ab8cf48
Date: 2011-10-04 09:28 +0200
http://bitbucket.org/pypy/pypy/changeset/15798ab8cf48/
Log: Fix test.
diff --git a/pypy/interpreter/executioncontext.py b/pypy/interpreter/executioncontext.py
--- a/pypy/interpreter/executioncontext.py
+++ b/pypy/interpreter/executioncontext.py
@@ -350,6 +350,7 @@
elif interval > MAX:
interval = MAX
self.checkinterval_scaled = interval * TICK_COUNTER_STEP
+ self.reset_ticker(-1)
def _rebuild_action_dispatcher(self):
periodic_actions = unrolling_iterable(self._periodic_actions)
diff --git a/pypy/interpreter/test/test_executioncontext.py b/pypy/interpreter/test/test_executioncontext.py
--- a/pypy/interpreter/test/test_executioncontext.py
+++ b/pypy/interpreter/test/test_executioncontext.py
@@ -42,6 +42,7 @@
assert i == 9
def test_periodic_action(self):
+ from pypy.interpreter.executioncontext import ActionFlag
class DemoAction(executioncontext.PeriodicAsyncAction):
counter = 0
@@ -53,17 +54,20 @@
space = self.space
a2 = DemoAction(space)
- space.actionflag.register_periodic_action(a2, True)
try:
- for i in range(500):
- space.appexec([], """():
- n = 5
- return n + 2
- """)
- except Finished:
- pass
- checkinterval = space.actionflag.getcheckinterval()
- assert checkinterval / 10 < i < checkinterval * 1.1
+ space.actionflag.setcheckinterval(100)
+ space.actionflag.register_periodic_action(a2, True)
+ try:
+ for i in range(500):
+ space.appexec([], """():
+ n = 5
+ return n + 2
+ """)
+ except Finished:
+ pass
+ finally:
+ space.actionflag = ActionFlag() # reset to default
+ assert 10 < i < 110
def test_llprofile(self):
l = []
More information about the pypy-commit
mailing list