added get_readers/writers/excs methods to hubs.hub.Hub; made api_test.py use them

This commit is contained in:
Denis Bilenko
2008-10-30 01:57:34 +06:00
parent 5185663fc2
commit e1b7c59f4d
2 changed files with 12 additions and 3 deletions

View File

@@ -321,3 +321,12 @@ class BaseHub(object):
except KeyError: except KeyError:
pass pass
def get_readers(self):
return self.readers
def get_writers(self):
return self.writers
def get_excs(self):
return self.excs

View File

@@ -39,8 +39,8 @@ def check_hub():
api.sleep(0) api.sleep(0)
api.sleep(0) api.sleep(0)
hub = api.get_hub() hub = api.get_hub()
for nm in 'readers', 'writers', 'excs': for nm in 'get_readers', 'get_writers', 'get_excs':
dct = getattr(hub, nm) dct = getattr(hub, nm)()
assert not dct, "hub.%s not empty: %s" % (nm, dct) assert not dct, "hub.%s not empty: %s" % (nm, dct)
# Stop the runloop # Stop the runloop
api.get_hub().abort() api.get_hub().abort()
@@ -85,7 +85,7 @@ class TestApi(tests.TestCase):
check_hub() check_hub()
def test_connect_ssl(self): def test_connect_ssl(self):
def accept_once(listenfd): def accept_once(listenfd):
try: try:
conn, addr = listenfd.accept() conn, addr = listenfd.accept()