Skip to content

Commit

Permalink
Merge pull request #209 from onefinestay/better_keyboardinterrupt_test
Browse files Browse the repository at this point in the history
safer test for keyboardinterrupt
  • Loading branch information
davidszotten committed Feb 17, 2015
2 parents 1f1b077 + 1229b19 commit 5c5b86e
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions test/standalone/test_rpc_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,10 @@ def test_recover_from_keyboardinterrupt(
def call():
return proxy.spam(ham=0)

gt = eventlet.spawn(call)
eventlet.sleep(.1) # make sure `call` is scheduled

gt.kill(KeyboardInterrupt('killing from test'))
# wait for it to die
try:
gt.wait()
except KeyboardInterrupt:
pass
with patch('nameko.standalone.rpc.queue_iterator') as iterator:
iterator.side_effect = KeyboardInterrupt('killing from test')
with pytest.raises(KeyboardInterrupt):
proxy.spam(ham=0)

container = container_factory(FooService, rabbit_config)
container.start()
Expand Down

0 comments on commit 5c5b86e

Please sign in to comment.