diff options
author | Guido van Rossum <guido@python.org> | 2013-12-02 17:26:25 -0800 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2013-12-02 17:26:25 -0800 |
commit | 8fa817af554f99fec64384d3864dda2ae167eb37 (patch) | |
tree | c467397dc70662b2a547817524c693adbf819bee /asyncio/test_utils.py | |
parent | 03f8a142181336bca1c3bc3bf1daed6544748e31 (diff) | |
download | trollius-8fa817af554f99fec64384d3864dda2ae167eb37.tar.gz |
Incorporate selectors.py refactoring from CPython repo.
Diffstat (limited to 'asyncio/test_utils.py')
-rw-r--r-- | asyncio/test_utils.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/asyncio/test_utils.py b/asyncio/test_utils.py index c278dd1..d7d8442 100644 --- a/asyncio/test_utils.py +++ b/asyncio/test_utils.py @@ -142,9 +142,23 @@ def make_test_protocol(base): class TestSelector(selectors.BaseSelector): + def __init__(self): + self.keys = {} + + def register(self, fileobj, events, data=None): + key = selectors.SelectorKey(fileobj, 0, events, data) + self.keys[fileobj] = key + return key + + def unregister(self, fileobj): + return self.keys.pop(fileobj) + def select(self, timeout): return [] + def get_map(self): + return self.keys + class TestLoop(base_events.BaseEventLoop): """Loop for unittests. |