Ejemplo n.º 1
0
 def test_socketserver(self):
     green = emulation.patched("asyncore")
     assert green.select.select is emulation.select.green_select
     assert getattr(green.select, "poll", emulation.select.green_poll) is \
             emulation.select.green_poll
     assert getattr(green.select, "epoll",
             emulation.select.green_epoll) is emulation.select.green_epoll
     assert getattr(green.select, "kqueue", emulation.select.green_kqueue) \
             is emulation.select.green_kqueue
Ejemplo n.º 2
0
 def test_socketserver(self):
     green = emulation.patched("asyncore")
     assert green.select.select is emulation.select.green_select
     assert getattr(green.select, "poll", emulation.select.green_poll) is \
             emulation.select.green_poll
     assert getattr(
         green.select, "epoll",
         emulation.select.green_epoll) is emulation.select.green_epoll
     assert getattr(green.select, "kqueue", emulation.select.green_kqueue) \
             is emulation.select.green_kqueue
Ejemplo n.º 3
0
    def test_urllib(self):
        import socket as socket1, urllib as urllib1
        assert urllib1.socket.socket is socket1.socket

        green = emulation.patched("urllib")
        assert green.socket.socket is io.Socket
        assert green.socket.socketpair is emulation.socket.green_socketpair
        assert green.socket.fromfd is io.sockets.socket_fromfd

        import socket, urllib
        assert socket is socket1
        assert socket.socket is socket1.socket
        assert urllib is urllib1
        assert urllib.socket.socket is urllib1.socket.socket
Ejemplo n.º 4
0
    def test_urllib(self):
        import socket as socket1, urllib as urllib1
        assert urllib1.socket.socket is socket1.socket

        green = emulation.patched("urllib")
        assert green.socket.socket is io.Socket
        assert green.socket.socketpair is emulation.socket.green_socketpair
        assert green.socket.fromfd is io.sockets.socket_fromfd

        import socket, urllib
        assert socket is socket1
        assert socket.socket is socket1.socket
        assert urllib is urllib1
        assert urllib.socket.socket is urllib1.socket.socket
Ejemplo n.º 5
0
    def test_logging(self):
        import thread as thread1, threading as threading1, logging as logging1
        assert logging1.thread is thread1
        assert logging1.threading is threading1

        green = emulation.patched("logging")
        assert green.thread.allocate_lock is util.Lock
        assert green.thread.allocate is util.Lock
        assert green.thread.start_new_thread is emulation.threading.green_start
        assert green.thread.start_new is emulation.threading.green_start
        assert green.threading.Event is util.Event
        assert green.threading.Lock is util.Lock
        assert green.threading.RLock is util.RLock
        assert green.threading.Condition is util.Condition
        assert green.threading.Semaphore is util.Semaphore
        assert green.threading.BoundedSemaphore is util.BoundedSemaphore
        assert green.threading.Timer is util.Timer
        assert green.threading.Thread is util.Thread
        assert green.threading.local is util.Local
        assert green.threading.enumerate is util._enumerate_threads
        assert green.threading.active_count is util._active_thread_count
        assert green.threading.activeCount is util._active_thread_count
        assert green.threading.current_thread is util._current_thread
        assert green.threading.currentThread is util._current_thread

        import thread, threading, logging
        assert logging.thread.allocate_lock is thread1.allocate_lock
        assert logging.thread.allocate is thread1.allocate
        assert logging.thread.start_new_thread is thread1.start_new_thread
        assert logging.thread.start_new is thread1.start_new
        assert logging.threading.Event is threading1.Event
        assert logging.threading.Lock is threading1.Lock
        assert logging.threading.RLock is threading1.RLock
        assert logging.threading.Condition is threading1.Condition
        assert logging.threading.Semaphore is threading1.Semaphore
        assert logging.threading.BoundedSemaphore is threading1.BoundedSemaphore
        assert logging.threading.Timer is threading1.Timer
        assert logging.threading.Thread is threading1.Thread
        assert logging.threading.local is threading1.local
        assert logging.threading.enumerate is threading1.enumerate
        assert logging.threading.active_count is threading1.active_count
        assert logging.threading.activeCount is threading1.activeCount
        assert logging.threading.current_thread is threading1.current_thread
        assert logging.threading.currentThread is threading1.currentThread
        assert logging.thread.allocate_lock is thread.allocate_lock
        assert logging.thread.allocate is thread.allocate
        assert logging.thread.start_new_thread is thread.start_new_thread
        assert logging.thread.start_new is thread.start_new
        assert logging.threading.Event is threading.Event
        assert logging.threading.Lock is threading.Lock
        assert logging.threading.RLock is threading.RLock
        assert logging.threading.Condition is threading.Condition
        assert logging.threading.Semaphore is threading.Semaphore
        assert logging.threading.BoundedSemaphore is threading.BoundedSemaphore
        assert logging.threading.Timer is threading.Timer
        assert logging.threading.Thread is threading.Thread
        assert logging.threading.local is threading.local
        assert logging.threading.enumerate is threading.enumerate
        assert logging.threading.active_count is threading.active_count
        assert logging.threading.activeCount is threading.activeCount
        assert logging.threading.current_thread is threading.current_thread
        assert logging.threading.currentThread is threading.currentThread
Ejemplo n.º 6
0
    def test_logging(self):
        import thread as thread1, threading as threading1, logging as logging1
        assert logging1.thread is thread1
        assert logging1.threading is threading1

        green = emulation.patched("logging")
        assert green.thread.allocate_lock is util.Lock
        assert green.thread.allocate is util.Lock
        assert green.thread.start_new_thread is emulation.threading.green_start
        assert green.thread.start_new is emulation.threading.green_start
        assert green.threading.Event is util.Event
        assert green.threading.Lock is util.Lock
        assert green.threading.RLock is util.RLock
        assert green.threading.Condition is util.Condition
        assert green.threading.Semaphore is util.Semaphore
        assert green.threading.BoundedSemaphore is util.BoundedSemaphore
        assert green.threading.Timer is util.Timer
        assert green.threading.Thread is util.Thread
        assert green.threading.local is util.Local
        assert green.threading.enumerate is gthreading.enumerate_threads
        assert green.threading.active_count is gthreading.active_thread_count
        assert green.threading.activeCount is gthreading.active_thread_count
        assert green.threading.current_thread is gthreading.current_thread
        assert green.threading.currentThread is gthreading.current_thread

        import thread, threading, logging
        assert logging.thread.allocate_lock is thread1.allocate_lock
        assert logging.thread.allocate is thread1.allocate
        assert logging.thread.start_new_thread is thread1.start_new_thread
        assert logging.thread.start_new is thread1.start_new
        assert logging.threading.Event is threading1.Event
        assert logging.threading.Lock is threading1.Lock
        assert logging.threading.RLock is threading1.RLock
        assert logging.threading.Condition is threading1.Condition
        assert logging.threading.Semaphore is threading1.Semaphore
        assert logging.threading.BoundedSemaphore is threading1.BoundedSemaphore
        assert logging.threading.Timer is threading1.Timer
        assert logging.threading.Thread is threading1.Thread
        assert logging.threading.local is threading1.local
        assert logging.threading.enumerate is threading1.enumerate
        assert logging.threading.active_count is threading1.active_count
        assert logging.threading.activeCount is threading1.activeCount
        assert logging.threading.current_thread is threading1.current_thread
        assert logging.threading.currentThread is threading1.currentThread
        assert logging.thread.allocate_lock is thread.allocate_lock
        assert logging.thread.allocate is thread.allocate
        assert logging.thread.start_new_thread is thread.start_new_thread
        assert logging.thread.start_new is thread.start_new
        assert logging.threading.Event is threading.Event
        assert logging.threading.Lock is threading.Lock
        assert logging.threading.RLock is threading.RLock
        assert logging.threading.Condition is threading.Condition
        assert logging.threading.Semaphore is threading.Semaphore
        assert logging.threading.BoundedSemaphore is threading.BoundedSemaphore
        assert logging.threading.Timer is threading.Timer
        assert logging.threading.Thread is threading.Thread
        assert logging.threading.local is threading.local
        assert logging.threading.enumerate is threading.enumerate
        assert logging.threading.active_count is threading.active_count
        assert logging.threading.activeCount is threading.activeCount
        assert logging.threading.current_thread is threading.current_thread
        assert logging.threading.currentThread is threading.currentThread