File: patcher_import_patched_defaults.py

package info (click to toggle)
python-eventlet 0.40.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,200 kB
  • sloc: python: 25,101; sh: 78; makefile: 31
file content (18 lines) | stat: -rw-r--r-- 664 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
__test__ = False

if __name__ == '__main__':
    import sys
    # On eventlet<=0.20.0 uncommenting this unpatched import fails test
    # because import_patched did not agressively repatch sub-imported modules cached in sys.modules
    # to be fixed in https://github.com/eventlet/eventlet/issues/368
    # import tests.patcher.shared_import_socket

    import eventlet
    target = eventlet.import_patched('tests.patcher.shared1').shared
    t = target.socket.socket
    import eventlet.green.socket as g
    if not issubclass(t, g.socket):
        print('Fail. Target socket not green: {} bases {}'.format(t, t.__bases__))
        sys.exit(1)

    print('pass')