Skip to content

Commit

Permalink
Merge branch 'master' into on_error#128
Browse files Browse the repository at this point in the history
  • Loading branch information
spaceone committed Feb 17, 2017
2 parents bccfe7f + 1b69122 commit cc19ac1
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -93,4 +93,4 @@ There are also several places you can reach out to the circuits community:
Disclaimer
==========

Whilst I (James Mills) continue to contribute and maintain the circuits project I do not represent the interests or business of my employer Facebook Inc. The contributions I make are of my own free time and have no bearing or relevance o Facebook Inc.
Whilst I (James Mills) continue to contribute and maintain the circuits project I do not represent the interests or business of my employer Facebook Inc. The contributions I make are of my own free time and have no bearing or relevance to Facebook Inc.
2 changes: 1 addition & 1 deletion README.rst
Expand Up @@ -139,4 +139,4 @@ Disclaimer
Whilst I (James Mills) continue to contribute and maintain the circuits project
I do not represent the interests or business of my employer Facebook Inc. The
contributions I make are of my own free time and have no bearing or relevance
o Facebook Inc.
to Facebook Inc.
4 changes: 3 additions & 1 deletion circuits/web/errors.py
Expand Up @@ -162,7 +162,7 @@ def __init__(self, request, response, urls, code=None):

super(redirect, self).__init__(request, response, code)

if code in (300, 301, 302, 303, 307):
if code in (300, 301, 302, 303, 307, 308):
response.headers["Content-Type"] = "text/html"
# "The ... URI SHOULD be given by the Location field
# in the response."
Expand All @@ -180,6 +180,8 @@ def __init__(self, request, response, urls, code=None):
"<a href='%s'>%s</a>."),
307: ("This resource has moved temporarily to "
"<a href='%s'>%s</a>."),
308: ("This resource has permanently moved to "
"<a href='%s'>%s</a>."),
}[code]
response.body = "<br />\n".join([msg % (u, u) for u in urls])
# Previous code may have set C-L, so we have to reset it
Expand Down
4 changes: 2 additions & 2 deletions examples/dnsclient.py
Expand Up @@ -7,7 +7,7 @@
deconstruction (*a really nice library btw with
great integration into circuits*).
Specify the server, port and query as argumetns
Specify the server, port, and query as arguments
to perform a lookup against a server using UDP.
To run this example::
Expand Down Expand Up @@ -69,7 +69,7 @@ class DNSClient(Component):
"""DNS Client
This ties everything together in a nice
configurable way with protocol, transport
configurable way with protocol, transport,
and dummy handler as well as optional debugger.
"""

Expand Down
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 cc19ac1

Please sign in to comment.