Mercurial > summit-idp
view tests/test_locking.py @ 77:bd006fdd172f default tip
removed cachedfilestorage from easy, since it makes wsgi configs w/ multiple processes fail.
author | Atul Varma <avarma@mozilla.com> |
---|---|
date | Fri, 02 Jul 2010 18:33:32 -0400 |
parents | 50297a64414c |
children |
line wrap: on
line source
from summitidp import locking def fake_start_response(*args, **kwargs): pass class FakeException(Exception): pass def test_synced_app_works_consecutively(): @locking.synced_app def myapp(environ, start_response): assert start_response == fake_start_response assert isinstance(environ, dict) return [] assert myapp({}, fake_start_response) == [] assert myapp({}, fake_start_response) == [] def test_synced_app_throws_exception(): @locking.synced_app def myapp(environ, start_response): assert start_response == fake_start_response assert isinstance(environ, dict) raise FakeException() try: myapp({}, fake_start_response) raise Exception("exception should have been raised!") except FakeException: pass # Ensure the lock was released when the exception was thrown. try: myapp({}, fake_start_response) raise Exception("exception should have been raised!") except FakeException: pass