diff options
Diffstat (limited to 'lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/test/test_default.py')
-rwxr-xr-x | lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/test/test_default.py | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/test/test_default.py b/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/test/test_default.py deleted file mode 100755 index 635c0f9c..00000000 --- a/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/test/test_default.py +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright (c) Twisted Matrix Laboratories. -# See LICENSE for details. - -""" -Tests for L{twisted.internet.default}. -""" - -import select -from twisted.trial.unittest import TestCase -from twisted.python.runtime import Platform -from twisted.internet.default import _getInstallFunction - -unix = Platform('posix', 'other') -linux = Platform('posix', 'linux2') -windows = Platform('nt', 'win32') -osx = Platform('posix', 'darwin') - - -class PollReactorTests(TestCase): - """ - Tests for the cases of L{twisted.internet.default._getInstallFunction} - in which it picks the poll(2) or epoll(7)-based reactors. - """ - - def assertIsPoll(self, install): - """ - Assert the given function will install the poll() reactor, or select() - if poll() is unavailable. - """ - if hasattr(select, "poll"): - self.assertEqual( - install.__module__, 'twisted.internet.pollreactor') - else: - self.assertEqual( - install.__module__, 'twisted.internet.selectreactor') - - - def test_unix(self): - """ - L{_getInstallFunction} chooses the poll reactor on arbitrary Unix - platforms, falling back to select(2) if it is unavailable. - """ - install = _getInstallFunction(unix) - self.assertIsPoll(install) - - - def test_linux(self): - """ - L{_getInstallFunction} chooses the epoll reactor on Linux, or poll if - epoll is unavailable. - """ - install = _getInstallFunction(linux) - try: - from twisted.internet import epollreactor - except ImportError: - self.assertIsPoll(install) - else: - self.assertEqual( - install.__module__, 'twisted.internet.epollreactor') - - - -class SelectReactorTests(TestCase): - """ - Tests for the cases of L{twisted.internet.default._getInstallFunction} - in which it picks the select(2)-based reactor. - """ - def test_osx(self): - """ - L{_getInstallFunction} chooses the select reactor on OS X. - """ - install = _getInstallFunction(osx) - self.assertEqual( - install.__module__, 'twisted.internet.selectreactor') - - - def test_windows(self): - """ - L{_getInstallFunction} chooses the select reactor on Windows. - """ - install = _getInstallFunction(windows) - self.assertEqual( - install.__module__, 'twisted.internet.selectreactor') |