예제 #1
0
파일: edmp.py 프로젝트: OfflineIMAP/imapfw
    # python3 -m imapfw.edmp
    #
    # We catch exception since it's run as a test in travis.

    _DEBUG = True  # Set to True for more output and stack trace on error.

    import sys
    from imapfw.concurrency.concurrency import Concurrency
    from imapfw.ui.tty import TTY

    c = Concurrency("multiprocessing")
    ui = TTY(c.createLock())
    ui.configure()
    if _DEBUG:
        ui.enableDebugCategories(["emitters"])
    ui.setCurrentWorkerNameFunction(c.getCurrentWorkerNameFunction())

    runtime.set_module("ui", ui)
    runtime.set_module("concurrency", c)

    def run_async():
        ui.info("******** running run_async()")

        __REMOTE__ = "http://imapfw.github.io"
        __CONNECTED__ = "would be connected"
        driverReceiver, driverEmitter = newEmitterReceiver("driver")

        def connect(remote, port):
            print("would connect to %s:%s" % (remote, port))
            assert remote == __REMOTE__
            assert port == 80
예제 #2
0
파일: edmp.py 프로젝트: openology/imapfw
    # python3 -m imapfw.edmp
    #
    # We catch exception since it's run as a test in travis.

    _DEBUG = True  # Set to True for more output and stack trace on error.

    import sys
    from imapfw.concurrency.concurrency import Concurrency
    from imapfw.ui.tty import TTY

    c = Concurrency('multiprocessing')
    ui = TTY(c.createLock())
    ui.configure()
    if _DEBUG:
        ui.enableDebugCategories(['emitters'])
    ui.setCurrentWorkerNameFunction(c.getCurrentWorkerNameFunction())

    runtime.set_module('ui', ui)
    runtime.set_module('concurrency', c)

    def run_async():
        ui.info("******** running run_async()")

        __REMOTE__ = 'http://imapfw.github.io'
        __CONNECTED__ = 'would be connected'
        driverReceiver, driverEmitter = newEmitterReceiver('driver')

        def connect(remote, port):
            print("would connect to %s:%s" % (remote, port))
            assert remote == __REMOTE__
            assert port == 80