Permalink
Browse files

Write a test for issue #226

* waiting for an already finished event should work
  • Loading branch information...
ke4roh authored and spaceone committed Feb 15, 2017
1 parent 351410d commit 1b6912291b6dbde1f47f9f48f1df73a145d35648
Showing with 15 additions and 11 deletions.
  1. +1 −0 requirements-test.txt
  2. +13 −11 tests/core/test_call_wait.py
  3. +1 −0 tox.ini
View
@@ -1,6 +1,7 @@
codecov
pytest
pytest-cov
pytest-timeout
flake8
isort
tox
@@ -5,67 +5,56 @@
class wait(Event):
"""wait Event"""
success = True
class call(Event):
"""call Event"""
success = True
class long_call(Event):
"""long_call Event"""
success = True
class long_wait(Event):
"""long_wait Event"""
success = True
class wait_return(Event):
"""wait_return Event"""
success = True
class hello(Event):
"""hello Event"""
success = True
class foo(Event):
"""foo Event"""
success = True
class get_x(Event):
"""get_x Event"""
success = True
class get_y(Event):
"""get_y Event"""
success = True
class eval(Event):
"""eval Event"""
success = True
class App(Component):
@handler("wait")
def _on_wait(self):
x = self.fire(hello())
@@ -168,3 +157,16 @@ def test_eval(manager, watcher, app):
value = x.value
assert value == 3
@pytest.mark.xfail(reason='Issue #226')
@pytest.mark.timeout(1)
def test_wait_too_late(manager, watcher, app):
event = foo()
manager.fire(event)
assert watcher.wait("foo_success")
manager.tick()
x = manager.wait(event, timeout=.1)
value = next(x)
assert value == list(range(1, 10))
View
@@ -10,6 +10,7 @@ commands=py.test {posargs}
deps=
pytest
pytest-cov
pytest-timeout
[testenv:docs]
basepython=python

0 comments on commit 1b69122

Please sign in to comment.