File: patcher_blocking_select_methods_are_deleted.py

package info (click to toggle)
python-eventlet 0.26.1-7%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,916 kB
  • sloc: python: 24,898; makefile: 98
file content (32 lines) | stat: -rw-r--r-- 899 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
__test__ = False

if __name__ == '__main__':
    import eventlet
    eventlet.monkey_patch()

    # Leaving unpatched select methods in the select module is a recipe
    # for trouble and this test makes sure we don't do that.
    #
    # Issues:
    # * https://bitbucket.org/eventlet/eventlet/issues/167
    # * https://github.com/eventlet/eventlet/issues/169
    import select
    for name in ['devpoll', 'poll', 'epoll', 'kqueue', 'kevent']:
        assert not hasattr(select, name), name

    import sys

    if sys.version_info >= (3, 4):
        import selectors
        for name in [
            'PollSelector',
            'EpollSelector',
            'DevpollSelector',
            'KqueueSelector',
        ]:
            assert not hasattr(selectors, name), name

        default = selectors.DefaultSelector
        assert default is selectors.SelectSelector, default

    print('pass')