diff options
| author | Sergey Shepelev <temotor@gmail.com> | 2015-03-05 16:32:40 +0300 |
|---|---|---|
| committer | Sergey Shepelev <temotor@gmail.com> | 2015-03-05 16:32:40 +0300 |
| commit | 8ca2b0d5ff27bf963db78c01bab77e679baa0abc (patch) | |
| tree | 9ff77b27986f9ac31a07bef14caa44ed6b1804af /tests/hub_test.py | |
| parent | 84b535becafcdc932ab905061f5fa2fbea35dc74 (diff) | |
| download | eventlet-tm4.tar.gz | |
tests: move some into isolatedtm4
Diffstat (limited to 'tests/hub_test.py')
| -rw-r--r-- | tests/hub_test.py | 57 |
1 files changed, 9 insertions, 48 deletions
diff --git a/tests/hub_test.py b/tests/hub_test.py index 07e502a..759e5b8 100644 --- a/tests/hub_test.py +++ b/tests/hub_test.py @@ -1,15 +1,14 @@ from __future__ import with_statement import sys - -import tests -from tests import LimitedTestCase, main, skip_with_pyevent, skip_if_no_itimer, skip_unless -from tests.patcher_test import ProcessBase import time + import eventlet from eventlet import hubs from eventlet.event import Event from eventlet.semaphore import Semaphore from eventlet.support import greenlets, six +import tests +from tests import LimitedTestCase, skip_with_pyevent, skip_if_no_itimer, skip_unless DELAY = 0.001 @@ -206,6 +205,10 @@ class TestExceptionInGreenthread(LimitedTestCase): g.kill() +class Foo(object): + pass + + class TestHubSelection(LimitedTestCase): def test_explicit_hub(self): @@ -357,47 +360,5 @@ class TestDeadRunLoop(LimitedTestCase): assert g.dead # sanity check that dummyproc has completed -class Foo(object): - pass - - -class TestDefaultHub(ProcessBase): - - def test_kqueue_unsupported(self): - # https://github.com/eventlet/eventlet/issues/38 - # get_hub on windows broken by kqueue - module_source = r''' -from __future__ import print_function - -# 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') -''' - self.write_to_tempfile('newmod', module_source) - output, _ = self.launch_subprocess('newmod.py') - self.assertEqual(output, 'kqueue tried\nok\n') - - -if __name__ == '__main__': - main() +def test_kqueue_unsupported(): + tests.run_isolated('hub_kqueue_unsupported.py') |
