diff options
| author | Ryan Williams <rdw@lindenlab.com> | 2009-12-17 10:37:59 -0800 |
|---|---|---|
| committer | Ryan Williams <rdw@lindenlab.com> | 2009-12-17 10:37:59 -0800 |
| commit | 441f72f4081c8a3ede26d0fc06d6c2ca2eff81fd (patch) | |
| tree | dd00600b0651fb231c1dadf8d568c9bd008e4e7e /tests/api_test.py | |
| parent | c7d3432b298f3e05e6775ffd999418006be14d77 (diff) | |
| download | eventlet-441f72f4081c8a3ede26d0fc06d6c2ca2eff81fd.tar.gz | |
Moved get_hub, use_hub, get_default_hub to eventlet.hubs. This is a step in the direction of better factoring and fewer circular-ish dependencies.
Diffstat (limited to 'tests/api_test.py')
| -rw-r--r-- | tests/api_test.py | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/tests/api_test.py b/tests/api_test.py index 1ca9306..3e29cfe 100644 --- a/tests/api_test.py +++ b/tests/api_test.py @@ -6,21 +6,21 @@ from unittest import TestCase, main from eventlet import api from eventlet import greenio from eventlet import util - +from eventlet import hubs def check_hub(): # Clear through the descriptor queue api.sleep(0) api.sleep(0) - hub = api.get_hub() + hub = hubs.get_hub() for nm in 'get_readers', 'get_writers': dct = getattr(hub, nm)() assert not dct, "hub.%s not empty: %s" % (nm, dct) # Stop the runloop (unless it's twistedhub which does not support that) - if not getattr(api.get_hub(), 'uses_twisted_reactor', None): - api.get_hub().abort() + if not getattr(hub, 'uses_twisted_reactor', None): + hub.abort() api.sleep(0) - ### ??? assert not api.get_hub().running + ### ??? assert not hubs.get_hub().running class TestApi(TestCase): @@ -145,16 +145,6 @@ class TestApi(TestCase): check_hub() - if not getattr(api.get_hub(), 'uses_twisted_reactor', None): - def test_explicit_hub(self): - oldhub = api.get_hub() - try: - api.use_hub(Foo) - assert isinstance(api.get_hub(), Foo), api.get_hub() - finally: - api._threadlocal.hub = oldhub - check_hub() - def test_named(self): named_foo = api.named('tests.api_test.Foo') self.assertEquals( @@ -233,8 +223,6 @@ class TestApi(TestCase): self.assertRaises(api.TimeoutError, api.with_timeout, 0.1, func) - - class Foo(object): pass |
