403Webshell
Server IP : 61.19.30.66  /  Your IP : 216.73.216.15
Web Server : Apache/2.2.22 (Ubuntu)
System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64
User : www-data ( 33)
PHP Version : 5.3.10-1ubuntu3.48
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/share/pyshared/twisted/internet/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/pyshared/twisted/internet/test/test_gtkreactor.py
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.

"""
Tests to ensure all attributes of L{twisted.internet.gtkreactor} are 
deprecated.
"""

import sys

from twisted.trial.unittest import TestCase


class GtkReactorDeprecation(TestCase):
    """
    Tests to ensure all attributes of L{twisted.internet.gtkreactor} are 
    deprecated.
    """

    class StubGTK:
        class GDK:
            INPUT_READ = None
        def input_add(self, *params):
            pass

    class StubPyGTK:
        def require(self, something):
            pass

    def setUp(self):
        """
        Create a stub for the module 'gtk' if it does not exist, so that it can
        be imported without errors or warnings.
        """
        self.mods = sys.modules.copy()
        sys.modules['gtk'] = self.StubGTK()
        sys.modules['pygtk'] = self.StubPyGTK()


    def tearDown(self):
        """
        Return sys.modules to the way it was before the test.
        """
        sys.modules.clear()
        sys.modules.update(self.mods)


    def lookForDeprecationWarning(self, testmethod, attributeName):
        warningsShown = self.flushWarnings([testmethod])
        self.assertEqual(len(warningsShown), 1)
        self.assertIdentical(warningsShown[0]['category'], DeprecationWarning)
        self.assertEqual(
            warningsShown[0]['message'],
            "twisted.internet.gtkreactor." + attributeName + " "
            "was deprecated in Twisted 10.1.0: All new applications should be "
            "written with gtk 2.x, which is supported by "
            "twisted.internet.gtk2reactor.")


    def test_gtkReactor(self):
        """
        Test deprecation of L{gtkreactor.GtkReactor}
        """
        from twisted.internet import gtkreactor
        gtkreactor.GtkReactor();
        self.lookForDeprecationWarning(self.test_gtkReactor, "GtkReactor")


    def test_portableGtkReactor(self):
        """
        Test deprecation of L{gtkreactor.GtkReactor}
        """
        from twisted.internet import gtkreactor
        gtkreactor.PortableGtkReactor()
        self.lookForDeprecationWarning(self.test_portableGtkReactor,
                                       "PortableGtkReactor")


    def test_install(self):
        """
        Test deprecation of L{gtkreactor.install}
        """
        from twisted.internet import gtkreactor
        self.assertRaises(AssertionError, gtkreactor.install)
        self.lookForDeprecationWarning(self.test_install, "install")


    def test_portableInstall(self):
        """
        Test deprecation of L{gtkreactor.portableInstall}
        """
        from twisted.internet import gtkreactor
        self.assertRaises(AssertionError, gtkreactor.portableInstall)
        self.lookForDeprecationWarning(self.test_portableInstall,
                                       "portableInstall")

Youez - 2016 - github.com/yon3zu
LinuXploit