Skip to content

Commit

Permalink
Write a test for issue #226
Browse files Browse the repository at this point in the history
* waiting for an already finished event should work
  • Loading branch information
ke4roh authored and spaceone committed Feb 15, 2017
1 parent 351410d commit 1b69122
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions requirements-test.txt
@@ -1,6 +1,7 @@
codecov
pytest
pytest-cov
pytest-timeout
flake8
isort
tox
Expand Down
24 changes: 13 additions & 11 deletions tests/core/test_call_wait.py
Expand Up @@ -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())
Expand Down Expand Up @@ -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))
1 change: 1 addition & 0 deletions tox.ini
Expand Up @@ -10,6 +10,7 @@ commands=py.test {posargs}
deps=
pytest
pytest-cov
pytest-timeout

[testenv:docs]
basepython=python
Expand Down

0 comments on commit 1b69122

Please sign in to comment.