summaryrefslogtreecommitdiff
path: root/tests/hub_test_kqueue_unsupported.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hub_test_kqueue_unsupported.py')
-rw-r--r--tests/hub_test_kqueue_unsupported.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/hub_test_kqueue_unsupported.py b/tests/hub_test_kqueue_unsupported.py
new file mode 100644
index 0000000..2c477d5
--- /dev/null
+++ b/tests/hub_test_kqueue_unsupported.py
@@ -0,0 +1,31 @@
+# https://github.com/eventlet/eventlet/issues/38
+# get_hub on windows broken by kqueue
+from __future__ import print_function
+
+# no standard tests in this file, ignore
+__test__ = False
+
+
+if __name__ == '__main__':
+ # Simulate absence of kqueue even on platforms that support it.
+ import select
+ try:
+ del select.kqueue
+ except AttributeError:
+ pass
+
+ from eventlet.support.six.moves import builtins
+ original_import = builtins.__import__
+
+ def fail_import(name, *args, **kwargs):
+ if 'epoll' in name:
+ raise ImportError('disabled for test')
+ if 'kqueue' in name:
+ print('kqueue tried')
+ return original_import(name, *args, **kwargs)
+
+ builtins.__import__ = fail_import
+
+ import eventlet.hubs
+ eventlet.hubs.get_default_hub()
+ print('ok')